From 9faea2364dee4fbc9391ad233c570b70256ef002 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 13 Mar 2020 16:05:46 +0100 Subject: Use `dyn Trait` for working with databse It improves compile time in `--release` mode quite a bit, it doesn't really slow things down and, conceptually, it seems closer to what we want the physical architecture to look like (we don't want to monomorphise EVERYTHING in a single leaf crate). --- crates/ra_hir_ty/src/traits/builtin.rs | 36 +++++------ crates/ra_hir_ty/src/traits/chalk.rs | 111 ++++++++++++++++----------------- 2 files changed, 70 insertions(+), 77 deletions(-) (limited to 'crates/ra_hir_ty/src/traits') diff --git a/crates/ra_hir_ty/src/traits/builtin.rs b/crates/ra_hir_ty/src/traits/builtin.rs index 03f9b4e27..73e3c5c78 100644 --- a/crates/ra_hir_ty/src/traits/builtin.rs +++ b/crates/ra_hir_ty/src/traits/builtin.rs @@ -26,7 +26,7 @@ pub(super) struct BuiltinImplAssocTyValueData { } pub(super) fn get_builtin_impls( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, ty: &Ty, // The first argument for the trait, if present @@ -59,7 +59,7 @@ pub(super) fn get_builtin_impls( } fn get_builtin_unsize_impls( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, ty: &Ty, // The first argument for the trait, if present @@ -79,7 +79,7 @@ fn get_builtin_unsize_impls( // FIXME what about more complicated dyn tys with marker traits? if let Some(trait_ref) = ty.dyn_trait_ref() { if trait_ref.trait_ != target_trait.trait_ { - let super_traits = all_super_traits(db, trait_ref.trait_); + let super_traits = all_super_traits(db.upcast(), trait_ref.trait_); if super_traits.contains(&target_trait.trait_) { callback(Impl::UnsizeToSuperTraitObject(UnsizeToSuperTraitObjectData { trait_: trait_ref.trait_, @@ -94,7 +94,7 @@ fn get_builtin_unsize_impls( } } -pub(super) fn impl_datum(db: &impl HirDatabase, krate: CrateId, impl_: Impl) -> BuiltinImplData { +pub(super) fn impl_datum(db: &dyn HirDatabase, krate: CrateId, impl_: Impl) -> BuiltinImplData { match impl_ { Impl::ImplDef(_) => unreachable!(), Impl::ClosureFnTraitImpl(data) => closure_fn_trait_impl_datum(db, krate, data), @@ -107,7 +107,7 @@ pub(super) fn impl_datum(db: &impl HirDatabase, krate: CrateId, impl_: Impl) -> } pub(super) fn associated_ty_value( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, data: AssocTyValue, ) -> BuiltinImplAssocTyValueData { @@ -122,7 +122,7 @@ pub(super) fn associated_ty_value( // Closure Fn trait impls fn check_closure_fn_trait_impl_prerequisites( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, data: super::ClosureFnTraitImplData, ) -> bool { @@ -143,7 +143,7 @@ fn check_closure_fn_trait_impl_prerequisites( } fn closure_fn_trait_impl_datum( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, data: super::ClosureFnTraitImplData, ) -> BuiltinImplData { @@ -189,7 +189,7 @@ fn closure_fn_trait_impl_datum( } fn closure_fn_trait_output_assoc_ty_value( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, data: super::ClosureFnTraitImplData, ) -> BuiltinImplAssocTyValueData { @@ -223,17 +223,17 @@ fn closure_fn_trait_output_assoc_ty_value( // Array unsizing -fn check_unsize_impl_prerequisites(db: &impl HirDatabase, krate: CrateId) -> bool { +fn check_unsize_impl_prerequisites(db: &dyn HirDatabase, krate: CrateId) -> bool { // the Unsize trait needs to exist and have two type parameters (Self and T) let unsize_trait = match get_unsize_trait(db, krate) { Some(t) => t, None => return false, }; - let generic_params = generics(db, unsize_trait.into()); + let generic_params = generics(db.upcast(), unsize_trait.into()); generic_params.len() == 2 } -fn array_unsize_impl_datum(db: &impl HirDatabase, krate: CrateId) -> BuiltinImplData { +fn array_unsize_impl_datum(db: &dyn HirDatabase, krate: CrateId) -> BuiltinImplData { // impl Unsize<[T]> for [T; _] // (this can be a single impl because we don't distinguish array sizes currently) @@ -260,7 +260,7 @@ fn array_unsize_impl_datum(db: &impl HirDatabase, krate: CrateId) -> BuiltinImpl // Trait object unsizing fn trait_object_unsize_impl_datum( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, trait_: TraitId, ) -> BuiltinImplData { @@ -295,7 +295,7 @@ fn trait_object_unsize_impl_datum( } fn super_trait_object_unsize_impl_datum( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, data: UnsizeToSuperTraitObjectData, ) -> BuiltinImplData { @@ -313,7 +313,7 @@ fn super_trait_object_unsize_impl_datum( let self_bounds = vec![GenericPredicate::Implemented(self_trait_ref.clone())]; // we need to go from our trait to the super trait, substituting type parameters - let path = crate::utils::find_super_trait_path(db, data.trait_, data.super_trait); + let path = crate::utils::find_super_trait_path(db.upcast(), data.trait_, data.super_trait); let mut current_trait_ref = self_trait_ref; for t in path.into_iter().skip(1) { @@ -344,11 +344,7 @@ fn super_trait_object_unsize_impl_datum( BuiltinImplData { num_vars, trait_ref, where_clauses: Vec::new(), assoc_ty_values: Vec::new() } } -fn get_fn_trait( - db: &impl HirDatabase, - krate: CrateId, - fn_trait: super::FnTrait, -) -> Option { +fn get_fn_trait(db: &dyn HirDatabase, krate: CrateId, fn_trait: super::FnTrait) -> Option { let target = db.lang_item(krate, fn_trait.lang_item_name().into())?; match target { LangItemTarget::TraitId(t) => Some(t), @@ -356,7 +352,7 @@ fn get_fn_trait( } } -fn get_unsize_trait(db: &impl HirDatabase, krate: CrateId) -> Option { +fn get_unsize_trait(db: &dyn HirDatabase, krate: CrateId) -> Option { let target = db.lang_item(krate, "unsize".into())?; match target { LangItemTarget::TraitId(t) => Some(t), diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index 62509bc29..943d5f125 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs @@ -127,11 +127,11 @@ pub type AssociatedTyValue = chalk_rust_ir::AssociatedTyValue; pub(super) trait ToChalk { type Chalk; - fn to_chalk(self, db: &impl HirDatabase) -> Self::Chalk; - fn from_chalk(db: &impl HirDatabase, chalk: Self::Chalk) -> Self; + fn to_chalk(self, db: &dyn HirDatabase) -> Self::Chalk; + fn from_chalk(db: &dyn HirDatabase, chalk: Self::Chalk) -> Self; } -pub(super) fn from_chalk(db: &impl HirDatabase, chalk: ChalkT) -> T +pub(super) fn from_chalk(db: &dyn HirDatabase, chalk: ChalkT) -> T where T: ToChalk, { @@ -140,7 +140,7 @@ where impl ToChalk for Ty { type Chalk = chalk_ir::Ty; - fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Ty { + fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::Ty { match self { Ty::Apply(apply_ty) => { let name = apply_ty.ctor.to_chalk(db); @@ -179,7 +179,7 @@ impl ToChalk for Ty { } } } - fn from_chalk(db: &impl HirDatabase, chalk: chalk_ir::Ty) -> Self { + fn from_chalk(db: &dyn HirDatabase, chalk: chalk_ir::Ty) -> Self { match chalk.data().clone() { chalk_ir::TyData::Apply(apply_ty) => match apply_ty.name { TypeName::Error => Ty::Unknown, @@ -217,11 +217,11 @@ impl ToChalk for Ty { impl ToChalk for Substs { type Chalk = chalk_ir::Substitution; - fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Substitution { + fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::Substitution { chalk_ir::Substitution::from(self.iter().map(|ty| ty.clone().to_chalk(db))) } - fn from_chalk(db: &impl HirDatabase, parameters: chalk_ir::Substitution) -> Substs { + fn from_chalk(db: &dyn HirDatabase, parameters: chalk_ir::Substitution) -> Substs { let tys = parameters .into_iter() .map(|p| match p.ty() { @@ -236,13 +236,13 @@ impl ToChalk for Substs { impl ToChalk for TraitRef { type Chalk = chalk_ir::TraitRef; - fn to_chalk(self: TraitRef, db: &impl HirDatabase) -> 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); chalk_ir::TraitRef { trait_id, substitution } } - fn from_chalk(db: &impl HirDatabase, trait_ref: chalk_ir::TraitRef) -> Self { + fn from_chalk(db: &dyn HirDatabase, trait_ref: chalk_ir::TraitRef) -> Self { let trait_ = from_chalk(db, trait_ref.trait_id); let substs = from_chalk(db, trait_ref.substitution); TraitRef { trait_, substs } @@ -252,11 +252,11 @@ impl ToChalk for TraitRef { impl ToChalk for hir_def::TraitId { type Chalk = TraitId; - fn to_chalk(self, _db: &impl HirDatabase) -> TraitId { + fn to_chalk(self, _db: &dyn HirDatabase) -> TraitId { chalk_ir::TraitId(self.as_intern_id()) } - fn from_chalk(_db: &impl HirDatabase, trait_id: TraitId) -> hir_def::TraitId { + fn from_chalk(_db: &dyn HirDatabase, trait_id: TraitId) -> hir_def::TraitId { InternKey::from_intern_id(trait_id.0) } } @@ -264,7 +264,7 @@ impl ToChalk for hir_def::TraitId { impl ToChalk for TypeCtor { type Chalk = TypeName; - fn to_chalk(self, db: &impl HirDatabase) -> TypeName { + fn to_chalk(self, db: &dyn HirDatabase) -> TypeName { match self { TypeCtor::AssociatedType(type_alias) => { let type_id = type_alias.to_chalk(db); @@ -278,7 +278,7 @@ impl ToChalk for TypeCtor { } } - fn from_chalk(db: &impl HirDatabase, type_name: TypeName) -> TypeCtor { + fn from_chalk(db: &dyn HirDatabase, type_name: TypeName) -> TypeCtor { match type_name { TypeName::Struct(struct_id) => db.lookup_intern_type_ctor(struct_id.into()), TypeName::AssociatedType(type_id) => TypeCtor::AssociatedType(from_chalk(db, type_id)), @@ -293,11 +293,11 @@ impl ToChalk for TypeCtor { impl ToChalk for Impl { type Chalk = ImplId; - fn to_chalk(self, db: &impl HirDatabase) -> ImplId { + fn to_chalk(self, db: &dyn HirDatabase) -> ImplId { db.intern_chalk_impl(self).into() } - fn from_chalk(db: &impl HirDatabase, impl_id: ImplId) -> Impl { + fn from_chalk(db: &dyn HirDatabase, impl_id: ImplId) -> Impl { db.lookup_intern_chalk_impl(impl_id.into()) } } @@ -305,11 +305,11 @@ impl ToChalk for Impl { impl ToChalk for TypeAliasId { type Chalk = AssocTypeId; - fn to_chalk(self, _db: &impl HirDatabase) -> AssocTypeId { + fn to_chalk(self, _db: &dyn HirDatabase) -> AssocTypeId { chalk_ir::AssocTypeId(self.as_intern_id()) } - fn from_chalk(_db: &impl HirDatabase, type_alias_id: AssocTypeId) -> TypeAliasId { + fn from_chalk(_db: &dyn HirDatabase, type_alias_id: AssocTypeId) -> TypeAliasId { InternKey::from_intern_id(type_alias_id.0) } } @@ -317,11 +317,11 @@ impl ToChalk for TypeAliasId { impl ToChalk for AssocTyValue { type Chalk = AssociatedTyValueId; - fn to_chalk(self, db: &impl HirDatabase) -> AssociatedTyValueId { + fn to_chalk(self, db: &dyn HirDatabase) -> AssociatedTyValueId { db.intern_assoc_ty_value(self).into() } - fn from_chalk(db: &impl HirDatabase, assoc_ty_value_id: AssociatedTyValueId) -> AssocTyValue { + fn from_chalk(db: &dyn HirDatabase, assoc_ty_value_id: AssociatedTyValueId) -> AssocTyValue { db.lookup_intern_assoc_ty_value(assoc_ty_value_id.into()) } } @@ -329,7 +329,7 @@ impl ToChalk for AssocTyValue { impl ToChalk for GenericPredicate { type Chalk = chalk_ir::QuantifiedWhereClause; - fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::QuantifiedWhereClause { + fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::QuantifiedWhereClause { match self { GenericPredicate::Implemented(trait_ref) => { make_binders(chalk_ir::WhereClause::Implemented(trait_ref.to_chalk(db)), 0) @@ -346,7 +346,7 @@ impl ToChalk for GenericPredicate { } fn from_chalk( - db: &impl HirDatabase, + db: &dyn HirDatabase, where_clause: chalk_ir::QuantifiedWhereClause, ) -> GenericPredicate { match where_clause.value { @@ -365,7 +365,7 @@ impl ToChalk for GenericPredicate { impl ToChalk for ProjectionTy { type Chalk = chalk_ir::AliasTy; - fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::AliasTy { + fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::AliasTy { chalk_ir::AliasTy { associated_ty_id: self.associated_ty.to_chalk(db), substitution: self.parameters.to_chalk(db), @@ -373,7 +373,7 @@ impl ToChalk for ProjectionTy { } fn from_chalk( - db: &impl HirDatabase, + db: &dyn HirDatabase, projection_ty: chalk_ir::AliasTy, ) -> ProjectionTy { ProjectionTy { @@ -386,11 +386,11 @@ impl ToChalk for ProjectionTy { impl ToChalk for super::ProjectionPredicate { type Chalk = chalk_ir::Normalize; - fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Normalize { + fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::Normalize { chalk_ir::Normalize { alias: self.projection_ty.to_chalk(db), ty: self.ty.to_chalk(db) } } - fn from_chalk(_db: &impl HirDatabase, _normalize: chalk_ir::Normalize) -> Self { + fn from_chalk(_db: &dyn HirDatabase, _normalize: chalk_ir::Normalize) -> Self { unimplemented!() } } @@ -398,14 +398,14 @@ impl ToChalk for super::ProjectionPredicate { impl ToChalk for Obligation { type Chalk = chalk_ir::DomainGoal; - fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::DomainGoal { + fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::DomainGoal { match self { Obligation::Trait(tr) => tr.to_chalk(db).cast(), Obligation::Projection(pr) => pr.to_chalk(db).cast(), } } - fn from_chalk(_db: &impl HirDatabase, _goal: chalk_ir::DomainGoal) -> Self { + fn from_chalk(_db: &dyn HirDatabase, _goal: chalk_ir::DomainGoal) -> Self { unimplemented!() } } @@ -416,13 +416,13 @@ where { type Chalk = chalk_ir::Canonical; - fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Canonical { + fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::Canonical { let parameter = chalk_ir::ParameterKind::Ty(chalk_ir::UniverseIndex::ROOT); let value = self.value.to_chalk(db); chalk_ir::Canonical { value, binders: vec![parameter; self.num_vars] } } - fn from_chalk(db: &impl HirDatabase, canonical: chalk_ir::Canonical) -> Canonical { + fn from_chalk(db: &dyn HirDatabase, canonical: chalk_ir::Canonical) -> Canonical { Canonical { num_vars: canonical.binders.len(), value: from_chalk(db, canonical.value) } } } @@ -430,7 +430,7 @@ where impl ToChalk for Arc { type Chalk = chalk_ir::Environment; - fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::Environment { + fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::Environment { let mut clauses = Vec::new(); for pred in &self.predicates { if pred.is_error() { @@ -445,7 +445,7 @@ impl ToChalk for Arc { } fn from_chalk( - _db: &impl HirDatabase, + _db: &dyn HirDatabase, _env: chalk_ir::Environment, ) -> Arc { unimplemented!() @@ -458,7 +458,7 @@ where { type Chalk = chalk_ir::InEnvironment; - fn to_chalk(self, db: &impl HirDatabase) -> chalk_ir::InEnvironment { + fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::InEnvironment { chalk_ir::InEnvironment { environment: self.environment.to_chalk(db), goal: self.value.to_chalk(db), @@ -466,7 +466,7 @@ where } fn from_chalk( - db: &impl HirDatabase, + db: &dyn HirDatabase, in_env: chalk_ir::InEnvironment, ) -> super::InEnvironment { super::InEnvironment { @@ -479,7 +479,7 @@ where impl ToChalk for builtin::BuiltinImplData { type Chalk = ImplDatum; - fn to_chalk(self, db: &impl HirDatabase) -> ImplDatum { + fn to_chalk(self, db: &dyn HirDatabase) -> ImplDatum { let impl_type = chalk_rust_ir::ImplType::External; let where_clauses = self.where_clauses.into_iter().map(|w| w.to_chalk(db)).collect(); @@ -495,7 +495,7 @@ impl ToChalk for builtin::BuiltinImplData { } } - fn from_chalk(_db: &impl HirDatabase, _data: ImplDatum) -> Self { + fn from_chalk(_db: &dyn HirDatabase, _data: ImplDatum) -> Self { unimplemented!() } } @@ -503,7 +503,7 @@ impl ToChalk for builtin::BuiltinImplData { impl ToChalk for builtin::BuiltinImplAssocTyValueData { type Chalk = AssociatedTyValue; - fn to_chalk(self, db: &impl HirDatabase) -> AssociatedTyValue { + fn to_chalk(self, db: &dyn HirDatabase) -> AssociatedTyValue { let value_bound = chalk_rust_ir::AssociatedTyValueBound { ty: self.value.to_chalk(db) }; chalk_rust_ir::AssociatedTyValue { @@ -514,7 +514,7 @@ impl ToChalk for builtin::BuiltinImplAssocTyValueData { } fn from_chalk( - _db: &impl HirDatabase, + _db: &dyn HirDatabase, _data: AssociatedTyValue, ) -> builtin::BuiltinImplAssocTyValueData { unimplemented!() @@ -529,7 +529,7 @@ fn make_binders(value: T, num_vars: usize) -> chalk_ir::Binders { } fn convert_where_clauses( - db: &impl HirDatabase, + db: &dyn HirDatabase, def: GenericDefId, substs: &Substs, ) -> Vec> { @@ -545,10 +545,7 @@ fn convert_where_clauses( result } -impl<'a, DB> chalk_solve::RustIrDatabase for ChalkContext<'a, DB> -where - DB: HirDatabase, -{ +impl<'a> chalk_solve::RustIrDatabase for ChalkContext<'a> { fn associated_ty_data(&self, id: AssocTypeId) -> Arc { self.db.associated_ty_data(id) } @@ -618,16 +615,16 @@ where } pub(crate) fn associated_ty_data_query( - db: &impl HirDatabase, + db: &dyn HirDatabase, id: AssocTypeId, ) -> Arc { debug!("associated_ty_data {:?}", id); let type_alias: TypeAliasId = from_chalk(db, id); - let trait_ = match type_alias.lookup(db).container { + let trait_ = match type_alias.lookup(db.upcast()).container { AssocContainerId::TraitId(t) => t, _ => panic!("associated type not in trait"), }; - let generic_params = generics(db, type_alias.into()); + let generic_params = generics(db.upcast(), type_alias.into()); let bound_data = chalk_rust_ir::AssociatedTyDatumBound { // FIXME add bounds and where clauses bounds: vec![], @@ -643,7 +640,7 @@ pub(crate) fn associated_ty_data_query( } pub(crate) fn trait_datum_query( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, trait_id: TraitId, ) -> Arc { @@ -651,11 +648,11 @@ pub(crate) fn trait_datum_query( let trait_: hir_def::TraitId = from_chalk(db, trait_id); let trait_data = db.trait_data(trait_); debug!("trait {:?} = {:?}", trait_id, trait_data.name); - let generic_params = generics(db, trait_.into()); + let generic_params = generics(db.upcast(), trait_.into()); let bound_vars = Substs::bound_vars(&generic_params); let flags = chalk_rust_ir::TraitFlags { auto: trait_data.auto, - upstream: trait_.lookup(db).container.module(db).krate != krate, + upstream: trait_.lookup(db.upcast()).container.module(db.upcast()).krate != krate, non_enumerable: true, coinductive: false, // only relevant for Chalk testing // FIXME set these flags correctly @@ -676,7 +673,7 @@ pub(crate) fn trait_datum_query( } pub(crate) fn struct_datum_query( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, struct_id: StructId, ) -> Arc { @@ -688,7 +685,7 @@ pub(crate) fn struct_datum_query( let where_clauses = type_ctor .as_generic_def() .map(|generic_def| { - let generic_params = generics(db, generic_def); + let generic_params = generics(db.upcast(), generic_def); let bound_vars = Substs::bound_vars(&generic_params); convert_where_clauses(db, generic_def, &bound_vars) }) @@ -708,7 +705,7 @@ pub(crate) fn struct_datum_query( } pub(crate) fn impl_datum_query( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, impl_id: ImplId, ) -> Arc { @@ -722,7 +719,7 @@ pub(crate) fn impl_datum_query( } fn impl_def_datum( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, chalk_id: ImplId, impl_id: hir_def::ImplId, @@ -734,10 +731,10 @@ fn impl_def_datum( .value; let impl_data = db.impl_data(impl_id); - let generic_params = generics(db, impl_id.into()); + let generic_params = generics(db.upcast(), impl_id.into()); let bound_vars = Substs::bound_vars(&generic_params); let trait_ = trait_ref.trait_; - let impl_type = if impl_id.lookup(db).container.module(db).krate == krate { + let impl_type = if impl_id.lookup(db.upcast()).container.module(db.upcast()).krate == krate { chalk_rust_ir::ImplType::Local } else { chalk_rust_ir::ImplType::External @@ -786,7 +783,7 @@ fn impl_def_datum( } pub(crate) fn associated_ty_value_query( - db: &impl HirDatabase, + db: &dyn HirDatabase, krate: CrateId, id: AssociatedTyValueId, ) -> Arc { @@ -800,12 +797,12 @@ pub(crate) fn associated_ty_value_query( } fn type_alias_associated_ty_value( - db: &impl HirDatabase, + db: &dyn HirDatabase, _krate: CrateId, type_alias: TypeAliasId, ) -> Arc { let type_alias_data = db.type_alias_data(type_alias); - let impl_id = match type_alias.lookup(db).container { + let impl_id = match type_alias.lookup(db.upcast()).container { AssocContainerId::ImplId(it) => it, _ => panic!("assoc ty value should be in impl"), }; -- cgit v1.2.3