diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-11-26 11:32:09 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-11-26 11:32:09 +0000 |
commit | 6e36eadd261b1f7765bef32ec74899003c5c3517 (patch) | |
tree | 5f05620adde03f7cb521b2f59aad6b2470e6272e /crates/ra_hir/src/ty.rs | |
parent | 500e022f7decbee29a693b0f0dd2f63789a99e5a (diff) | |
parent | a443b5033c2e95ee58bf086f7093ddc610d4f78f (diff) |
Merge #2409
2409: Id-ify Ty::Adt r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index 388530f31..bd03055b9 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -58,7 +58,7 @@ pub enum TypeCtor { | |||
58 | Float(Uncertain<FloatTy>), | 58 | Float(Uncertain<FloatTy>), |
59 | 59 | ||
60 | /// Structures, enumerations and unions. | 60 | /// Structures, enumerations and unions. |
61 | Adt(Adt), | 61 | Adt(AdtId), |
62 | 62 | ||
63 | /// The pointee of a string slice. Written as `str`. | 63 | /// The pointee of a string slice. Written as `str`. |
64 | Str, | 64 | Str, |
@@ -174,7 +174,7 @@ impl TypeCtor { | |||
174 | | TypeCtor::Tuple { .. } => None, | 174 | | TypeCtor::Tuple { .. } => None, |
175 | // Closure's krate is irrelevant for coherence I would think? | 175 | // Closure's krate is irrelevant for coherence I would think? |
176 | TypeCtor::Closure { .. } => None, | 176 | TypeCtor::Closure { .. } => None, |
177 | TypeCtor::Adt(adt) => adt.krate(db), | 177 | TypeCtor::Adt(adt) => Some(adt.module(db).krate.into()), |
178 | TypeCtor::FnDef(callable) => Some(callable.krate(db).into()), | 178 | TypeCtor::FnDef(callable) => Some(callable.krate(db).into()), |
179 | TypeCtor::AssociatedType(type_alias) => { | 179 | TypeCtor::AssociatedType(type_alias) => { |
180 | Some(type_alias.lookup(db).module(db).krate.into()) | 180 | Some(type_alias.lookup(db).module(db).krate.into()) |
@@ -598,7 +598,7 @@ impl Ty { | |||
598 | pub fn as_adt(&self) -> Option<(Adt, &Substs)> { | 598 | pub fn as_adt(&self) -> Option<(Adt, &Substs)> { |
599 | match self { | 599 | match self { |
600 | Ty::Apply(ApplicationTy { ctor: TypeCtor::Adt(adt_def), parameters }) => { | 600 | Ty::Apply(ApplicationTy { ctor: TypeCtor::Adt(adt_def), parameters }) => { |
601 | Some((*adt_def, parameters)) | 601 | Some(((*adt_def).into(), parameters)) |
602 | } | 602 | } |
603 | _ => None, | 603 | _ => None, |
604 | } | 604 | } |
@@ -889,9 +889,9 @@ impl HirDisplay for ApplicationTy { | |||
889 | } | 889 | } |
890 | TypeCtor::Adt(def_id) => { | 890 | TypeCtor::Adt(def_id) => { |
891 | let name = match def_id { | 891 | let name = match def_id { |
892 | Adt::Struct(s) => s.name(f.db), | 892 | AdtId::StructId(it) => f.db.struct_data(it).name.clone(), |
893 | Adt::Union(u) => u.name(f.db), | 893 | AdtId::UnionId(it) => f.db.union_data(it).name.clone(), |
894 | Adt::Enum(e) => e.name(f.db), | 894 | AdtId::EnumId(it) => f.db.enum_data(it).name.clone(), |
895 | } | 895 | } |
896 | .unwrap_or_else(Name::missing); | 896 | .unwrap_or_else(Name::missing); |
897 | write!(f, "{}", name)?; | 897 | write!(f, "{}", name)?; |