Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/next_solver/interner.rs')
| -rw-r--r-- | crates/hir-ty/src/next_solver/interner.rs | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/crates/hir-ty/src/next_solver/interner.rs b/crates/hir-ty/src/next_solver/interner.rs index 2e52dcea6c..2edf442a8c 100644 --- a/crates/hir-ty/src/next_solver/interner.rs +++ b/crates/hir-ty/src/next_solver/interner.rs @@ -690,15 +690,10 @@ impl<'db> inherent::AdtDef<DbInterner<'db>> for AdtDef { interner: DbInterner<'db>, sizedness: SizedTraitKind, ) -> Option<EarlyBinder<DbInterner<'db>, Ty<'db>>> { - if self.is_struct() { - let tail_ty = self.all_field_tys(interner).skip_binder().into_iter().last()?; - - let constraint_ty = sizedness_constraint_for_ty(interner, sizedness, tail_ty)?; - - Some(EarlyBinder::bind(constraint_ty)) - } else { - None - } + let tail_ty = self.struct_tail_ty(interner)?; + tail_ty + .map_bound(|tail_ty| sizedness_constraint_for_ty(interner, sizedness, tail_ty)) + .transpose() } fn destructor( @@ -1694,7 +1689,7 @@ impl<'db> Interner for DbInterner<'db> { mut f: impl FnMut(Self::ImplId), ) { let krate = self.krate.expect("trait solving requires setting `DbInterner::krate`"); - let trait_block = trait_def_id.0.loc(self.db).container.containing_block(); + let trait_block = trait_def_id.0.loc(self.db).container.block(self.db); let mut consider_impls_for_simplified_type = |simp: SimplifiedType| { let type_block = simp.def().and_then(|def_id| { let module = match def_id { @@ -1713,7 +1708,7 @@ impl<'db> Interner for DbInterner<'db> { | SolverDefId::EnumVariantId(_) | SolverDefId::Ctor(_) => return None, }; - module.containing_block() + module.block(self.db) }); TraitImpls::for_each_crate_and_block_trait_and_type( self.db, @@ -1828,7 +1823,7 @@ impl<'db> Interner for DbInterner<'db> { fn for_each_blanket_impl(self, trait_def_id: Self::TraitId, mut f: impl FnMut(Self::ImplId)) { let Some(krate) = self.krate else { return }; - let block = trait_def_id.0.loc(self.db).container.containing_block(); + let block = trait_def_id.0.loc(self.db).container.block(self.db); TraitImpls::for_each_crate_and_block(self.db, krate, block, &mut |impls| { for &impl_ in impls.blanket_impls(trait_def_id.0) { |