From 7a7e47eab7323a8e122d9994b2936e50e42a1af2 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Thu, 18 Mar 2021 21:53:19 +0100 Subject: Chalkify TraitRef --- crates/hir_ty/src/traits/chalk/mapping.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'crates/hir_ty/src/traits/chalk') diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index d969527dc..0086ce1e9 100644 --- a/crates/hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs @@ -239,15 +239,15 @@ impl ToChalk for TraitRef { type Chalk = chalk_ir::TraitRef; fn to_chalk(self: TraitRef, db: &dyn HirDatabase) -> chalk_ir::TraitRef { - let trait_id = self.trait_.to_chalk(db); - let substitution = self.substs.to_chalk(db); + let trait_id = self.trait_id; + let substitution = self.substitution.to_chalk(db); chalk_ir::TraitRef { trait_id, substitution } } fn from_chalk(db: &dyn HirDatabase, trait_ref: chalk_ir::TraitRef) -> Self { - let trait_ = from_chalk(db, trait_ref.trait_id); + let trait_id = trait_ref.trait_id; let substs = from_chalk(db, trait_ref.substitution); - TraitRef { trait_, substs } + TraitRef { trait_id, substitution: substs } } } @@ -515,17 +515,16 @@ pub(super) fn generic_predicate_to_inline_bound( // We don't have a special type for this, but Chalk does. match pred { GenericPredicate::Implemented(trait_ref) => { - if &trait_ref.substs[0] != self_ty { + if &trait_ref.substitution[0] != self_ty { // we can only convert predicates back to type bounds if they // have the expected self type return None; } - let args_no_self = trait_ref.substs[1..] + let args_no_self = trait_ref.substitution[1..] .iter() .map(|ty| ty.clone().to_chalk(db).cast(&Interner)) .collect(); - let trait_bound = - rust_ir::TraitBound { trait_id: trait_ref.trait_.to_chalk(db), args_no_self }; + let trait_bound = rust_ir::TraitBound { trait_id: trait_ref.trait_id, args_no_self }; Some(rust_ir::InlineBound::TraitBound(trait_bound)) } GenericPredicate::Projection(proj) => { -- cgit v1.2.3