diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-22 17:11:48 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-22 17:11:48 +0000 |
commit | f301da3c3d1c73dd9d438cb0736e23430287dba7 (patch) | |
tree | 586329f5641c520ef61d626736e492e33b227e25 /crates/hir_ty/src/lib.rs | |
parent | b982db88bed5e94913460dce7cd2b728ba925475 (diff) | |
parent | 3de8f57c51192fa8e57713a3580c2bcc6907a194 (diff) |
Merge #7399
7399: Make `ModuleId`'s `krate` field private and audit uses r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/lib.rs')
-rw-r--r-- | crates/hir_ty/src/lib.rs | 14 |
1 files changed, 8 insertions, 6 deletions
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 { | |||
211 | | TypeCtor::Tuple { .. } => None, | 211 | | TypeCtor::Tuple { .. } => None, |
212 | // Closure's krate is irrelevant for coherence I would think? | 212 | // Closure's krate is irrelevant for coherence I would think? |
213 | TypeCtor::Closure { .. } => None, | 213 | TypeCtor::Closure { .. } => None, |
214 | TypeCtor::Adt(adt) => Some(adt.module(db.upcast()).krate), | 214 | TypeCtor::Adt(adt) => Some(adt.module(db.upcast()).krate()), |
215 | TypeCtor::FnDef(callable) => Some(callable.krate(db)), | 215 | TypeCtor::FnDef(callable) => Some(callable.krate(db)), |
216 | TypeCtor::AssociatedType(type_alias) => { | 216 | TypeCtor::AssociatedType(type_alias) => { |
217 | Some(type_alias.lookup(db.upcast()).module(db.upcast()).krate) | 217 | Some(type_alias.lookup(db.upcast()).module(db.upcast()).krate()) |
218 | } | 218 | } |
219 | TypeCtor::ForeignType(type_alias) => { | 219 | TypeCtor::ForeignType(type_alias) => { |
220 | Some(type_alias.lookup(db.upcast()).module(db.upcast()).krate) | 220 | Some(type_alias.lookup(db.upcast()).module(db.upcast()).krate()) |
221 | } | 221 | } |
222 | TypeCtor::OpaqueType(opaque_ty_id) => match opaque_ty_id { | 222 | TypeCtor::OpaqueType(opaque_ty_id) => match opaque_ty_id { |
223 | OpaqueTyId::ReturnTypeImplTrait(func, _) => { | 223 | OpaqueTyId::ReturnTypeImplTrait(func, _) => { |
224 | Some(func.lookup(db.upcast()).module(db.upcast()).krate) | 224 | Some(func.lookup(db.upcast()).module(db.upcast()).krate()) |
225 | } | ||
226 | OpaqueTyId::AsyncBlockTypeImplTrait(def, _) => { | ||
227 | Some(def.module(db.upcast()).krate()) | ||
225 | } | 228 | } |
226 | OpaqueTyId::AsyncBlockTypeImplTrait(def, _) => Some(def.module(db.upcast()).krate), | ||
227 | }, | 229 | }, |
228 | } | 230 | } |
229 | } | 231 | } |
@@ -870,7 +872,7 @@ impl Ty { | |||
870 | Ty::Apply(ApplicationTy { ctor: TypeCtor::OpaqueType(opaque_ty_id), .. }) => { | 872 | Ty::Apply(ApplicationTy { ctor: TypeCtor::OpaqueType(opaque_ty_id), .. }) => { |
871 | match opaque_ty_id { | 873 | match opaque_ty_id { |
872 | OpaqueTyId::AsyncBlockTypeImplTrait(def, _expr) => { | 874 | OpaqueTyId::AsyncBlockTypeImplTrait(def, _expr) => { |
873 | let krate = def.module(db.upcast()).krate; | 875 | let krate = def.module(db.upcast()).krate(); |
874 | if let Some(future_trait) = db | 876 | if let Some(future_trait) = db |
875 | .lang_item(krate, "future_trait".into()) | 877 | .lang_item(krate, "future_trait".into()) |
876 | .and_then(|item| item.as_trait()) | 878 | .and_then(|item| item.as_trait()) |