From 3de8f57c51192fa8e57713a3580c2bcc6907a194 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 22 Jan 2021 18:09:55 +0100 Subject: Make `ModuleId`'s `krate` field private --- crates/hir_ty/src/lib.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'crates/hir_ty/src/lib.rs') diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index e00c7e176..d47f975d2 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs @@ -211,19 +211,21 @@ impl TypeCtor { | TypeCtor::Tuple { .. } => None, // Closure's krate is irrelevant for coherence I would think? TypeCtor::Closure { .. } => None, - TypeCtor::Adt(adt) => Some(adt.module(db.upcast()).krate), + TypeCtor::Adt(adt) => Some(adt.module(db.upcast()).krate()), TypeCtor::FnDef(callable) => Some(callable.krate(db)), TypeCtor::AssociatedType(type_alias) => { - Some(type_alias.lookup(db.upcast()).module(db.upcast()).krate) + Some(type_alias.lookup(db.upcast()).module(db.upcast()).krate()) } TypeCtor::ForeignType(type_alias) => { - Some(type_alias.lookup(db.upcast()).module(db.upcast()).krate) + Some(type_alias.lookup(db.upcast()).module(db.upcast()).krate()) } TypeCtor::OpaqueType(opaque_ty_id) => match opaque_ty_id { OpaqueTyId::ReturnTypeImplTrait(func, _) => { - Some(func.lookup(db.upcast()).module(db.upcast()).krate) + Some(func.lookup(db.upcast()).module(db.upcast()).krate()) + } + OpaqueTyId::AsyncBlockTypeImplTrait(def, _) => { + Some(def.module(db.upcast()).krate()) } - OpaqueTyId::AsyncBlockTypeImplTrait(def, _) => Some(def.module(db.upcast()).krate), }, } } @@ -870,7 +872,7 @@ impl Ty { Ty::Apply(ApplicationTy { ctor: TypeCtor::OpaqueType(opaque_ty_id), .. }) => { match opaque_ty_id { OpaqueTyId::AsyncBlockTypeImplTrait(def, _expr) => { - let krate = def.module(db.upcast()).krate; + let krate = def.module(db.upcast()).krate(); if let Some(future_trait) = db .lang_item(krate, "future_trait".into()) .and_then(|item| item.as_trait()) -- cgit v1.2.3