Upgrade chalk to 0.28.0
This commit is contained in:
parent
5f67571e34
commit
51c781f613
5 changed files with 103 additions and 47 deletions
|
@ -39,6 +39,8 @@ use rustc_middle::ty::{
|
|||
};
|
||||
use rustc_span::def_id::DefId;
|
||||
|
||||
use chalk_ir::{FnSig, ForeignDefId};
|
||||
use rustc_hir::Unsafety;
|
||||
use std::collections::btree_map::{BTreeMap, Entry};
|
||||
|
||||
/// Essentially an `Into` with a `&RustInterner` parameter
|
||||
|
@ -269,8 +271,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Ty<RustInterner<'tcx>>> for Ty<'tcx> {
|
|||
ast::FloatTy::F64 => float(chalk_ir::FloatTy::F64),
|
||||
},
|
||||
Adt(def, substs) => apply(struct_ty(def.did), substs.lower_into(interner)),
|
||||
// FIXME(chalk): lower Foreign
|
||||
Foreign(def_id) => apply(chalk_ir::TypeName::FnDef(chalk_ir::FnDefId(def_id)), empty()),
|
||||
Foreign(def_id) => apply(chalk_ir::TypeName::Foreign(ForeignDefId(def_id)), empty()),
|
||||
Str => apply(chalk_ir::TypeName::Str, empty()),
|
||||
Array(ty, len) => {
|
||||
let value = match len.val {
|
||||
|
@ -340,14 +341,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Ty<RustInterner<'tcx>>> for Ty<'tcx> {
|
|||
collect_bound_vars(interner, interner.tcx, &sig.inputs_and_output());
|
||||
TyData::Function(chalk_ir::FnPointer {
|
||||
num_binders: binders.len(interner),
|
||||
sig: chalk_ir::FnSig {
|
||||
abi: sig.abi(),
|
||||
safety: match sig.unsafety() {
|
||||
rustc_hir::Unsafety::Normal => chalk_ir::Safety::Safe,
|
||||
rustc_hir::Unsafety::Unsafe => chalk_ir::Safety::Unsafe,
|
||||
},
|
||||
variadic: sig.c_variadic(),
|
||||
},
|
||||
sig: sig.lower_into(interner),
|
||||
substitution: chalk_ir::Substitution::from_iter(
|
||||
interner,
|
||||
inputs_and_outputs.iter().map(|ty| {
|
||||
|
@ -721,6 +715,19 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Binders<chalk_ir::QuantifiedWhereClauses<Ru
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> LowerInto<'tcx, chalk_ir::FnSig<RustInterner<'tcx>>> for ty::Binder<ty::FnSig<'tcx>> {
|
||||
fn lower_into(self, _interner: &RustInterner<'_>) -> FnSig<RustInterner<'tcx>> {
|
||||
chalk_ir::FnSig {
|
||||
abi: self.abi(),
|
||||
safety: match self.unsafety() {
|
||||
Unsafety::Normal => chalk_ir::Safety::Safe,
|
||||
Unsafety::Unsafe => chalk_ir::Safety::Unsafe,
|
||||
},
|
||||
variadic: self.c_variadic(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// To collect bound vars, we have to do two passes. In the first pass, we
|
||||
/// collect all `BoundRegion`s and `ty::Bound`s. In the second pass, we then
|
||||
/// replace `BrNamed` into `BrAnon`. The two separate passes are important,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue