Add bound_impl_trait_ref

This commit is contained in:
Jack Huey 2022-05-08 20:53:36 -04:00
parent 6c05e8d009
commit 0247faed29
8 changed files with 28 additions and 25 deletions

View file

@ -310,8 +310,8 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
let bound_vars = bound_vars_for_item(self.interner.tcx, def_id);
let binders = binders_for(self.interner, bound_vars);
let trait_ref = self.interner.tcx.impl_trait_ref(def_id).expect("not an impl");
let trait_ref = EarlyBinder(trait_ref).subst(self.interner.tcx, bound_vars);
let trait_ref = self.interner.tcx.bound_impl_trait_ref(def_id).expect("not an impl");
let trait_ref = trait_ref.subst(self.interner.tcx, bound_vars);
let where_clauses = self.where_clauses_for(def_id, bound_vars);
@ -352,11 +352,11 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
let all_impls = self.interner.tcx.all_impls(def_id);
let matched_impls = all_impls.filter(|impl_def_id| {
use chalk_ir::could_match::CouldMatch;
let trait_ref = self.interner.tcx.impl_trait_ref(*impl_def_id).unwrap();
let trait_ref = self.interner.tcx.bound_impl_trait_ref(*impl_def_id).unwrap();
let bound_vars = bound_vars_for_item(self.interner.tcx, *impl_def_id);
let self_ty = trait_ref.self_ty();
let self_ty = EarlyBinder(self_ty).subst(self.interner.tcx, bound_vars);
let self_ty = trait_ref.map_bound(|t| t.self_ty());
let self_ty = self_ty.subst(self.interner.tcx, bound_vars);
let lowered_ty = self_ty.lower_into(self.interner);
parameters[0].assert_ty_ref(self.interner).could_match(