diff options
author | Florian Diebold <[email protected]> | 2020-05-22 16:50:58 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2020-05-22 18:52:06 +0100 |
commit | 27fe68ad5c908d439af6cfbe7748c56eb6f107fc (patch) | |
tree | 4931a1d08d930dadee18e2f9d521e29d255f81b2 /crates/ra_hir_ty/src/traits | |
parent | 1d0e27254d6376e980dc19e67dfcc598c7e97231 (diff) |
Use TypeCtorId as AdtId directly, and rename the type alias StructId -> AdtId
Diffstat (limited to 'crates/ra_hir_ty/src/traits')
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk.rs | 16 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk/interner.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk/tls.rs | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index 6c286ead7..e2f2a9ccb 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs | |||
@@ -45,7 +45,7 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
45 | fn trait_datum(&self, trait_id: TraitId) -> Arc<TraitDatum> { | 45 | fn trait_datum(&self, trait_id: TraitId) -> Arc<TraitDatum> { |
46 | self.db.trait_datum(self.krate, trait_id) | 46 | self.db.trait_datum(self.krate, trait_id) |
47 | } | 47 | } |
48 | fn adt_datum(&self, struct_id: StructId) -> Arc<StructDatum> { | 48 | fn adt_datum(&self, struct_id: AdtId) -> Arc<StructDatum> { |
49 | self.db.struct_datum(self.krate, struct_id) | 49 | self.db.struct_datum(self.krate, struct_id) |
50 | } | 50 | } |
51 | fn impl_datum(&self, impl_id: ImplId) -> Arc<ImplDatum> { | 51 | fn impl_datum(&self, impl_id: ImplId) -> Arc<ImplDatum> { |
@@ -94,7 +94,7 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
94 | debug!("impls_for_trait returned {} impls", result.len()); | 94 | debug!("impls_for_trait returned {} impls", result.len()); |
95 | result | 95 | result |
96 | } | 96 | } |
97 | fn impl_provided_for(&self, auto_trait_id: TraitId, struct_id: StructId) -> bool { | 97 | fn impl_provided_for(&self, auto_trait_id: TraitId, struct_id: AdtId) -> bool { |
98 | debug!("impl_provided_for {:?}, {:?}", auto_trait_id, struct_id); | 98 | debug!("impl_provided_for {:?}, {:?}", auto_trait_id, struct_id); |
99 | false // FIXME | 99 | false // FIXME |
100 | } | 100 | } |
@@ -257,7 +257,7 @@ fn lang_attr_from_well_known_trait(attr: WellKnownTrait) -> &'static str { | |||
257 | pub(crate) fn struct_datum_query( | 257 | pub(crate) fn struct_datum_query( |
258 | db: &dyn HirDatabase, | 258 | db: &dyn HirDatabase, |
259 | krate: CrateId, | 259 | krate: CrateId, |
260 | struct_id: StructId, | 260 | struct_id: AdtId, |
261 | ) -> Arc<StructDatum> { | 261 | ) -> Arc<StructDatum> { |
262 | debug!("struct_datum {:?}", struct_id); | 262 | debug!("struct_datum {:?}", struct_id); |
263 | let type_ctor: TypeCtor = from_chalk(db, TypeName::Adt(struct_id)); | 263 | let type_ctor: TypeCtor = from_chalk(db, TypeName::Adt(struct_id)); |
@@ -405,15 +405,15 @@ fn type_alias_associated_ty_value( | |||
405 | Arc::new(value) | 405 | Arc::new(value) |
406 | } | 406 | } |
407 | 407 | ||
408 | impl From<StructId> for crate::TypeCtorId { | 408 | impl From<AdtId> for crate::TypeCtorId { |
409 | fn from(struct_id: StructId) -> Self { | 409 | fn from(struct_id: AdtId) -> Self { |
410 | InternKey::from_intern_id(struct_id.0) | 410 | struct_id.0 |
411 | } | 411 | } |
412 | } | 412 | } |
413 | 413 | ||
414 | impl From<crate::TypeCtorId> for StructId { | 414 | impl From<crate::TypeCtorId> for AdtId { |
415 | fn from(type_ctor_id: crate::TypeCtorId) -> Self { | 415 | fn from(type_ctor_id: crate::TypeCtorId) -> Self { |
416 | chalk_ir::AdtId(type_ctor_id.as_intern_id()) | 416 | chalk_ir::AdtId(type_ctor_id) |
417 | } | 417 | } |
418 | } | 418 | } |
419 | 419 | ||
diff --git a/crates/ra_hir_ty/src/traits/chalk/interner.rs b/crates/ra_hir_ty/src/traits/chalk/interner.rs index 032deca75..d98e5cb2d 100644 --- a/crates/ra_hir_ty/src/traits/chalk/interner.rs +++ b/crates/ra_hir_ty/src/traits/chalk/interner.rs | |||
@@ -14,7 +14,7 @@ pub type AssocTypeId = chalk_ir::AssocTypeId<Interner>; | |||
14 | pub type AssociatedTyDatum = chalk_rust_ir::AssociatedTyDatum<Interner>; | 14 | pub type AssociatedTyDatum = chalk_rust_ir::AssociatedTyDatum<Interner>; |
15 | pub type TraitId = chalk_ir::TraitId<Interner>; | 15 | pub type TraitId = chalk_ir::TraitId<Interner>; |
16 | pub type TraitDatum = chalk_rust_ir::TraitDatum<Interner>; | 16 | pub type TraitDatum = chalk_rust_ir::TraitDatum<Interner>; |
17 | pub type StructId = chalk_ir::AdtId<Interner>; | 17 | pub type AdtId = chalk_ir::AdtId<Interner>; |
18 | pub type StructDatum = chalk_rust_ir::AdtDatum<Interner>; | 18 | pub type StructDatum = chalk_rust_ir::AdtDatum<Interner>; |
19 | pub type ImplId = chalk_ir::ImplId<Interner>; | 19 | pub type ImplId = chalk_ir::ImplId<Interner>; |
20 | pub type ImplDatum = chalk_rust_ir::ImplDatum<Interner>; | 20 | pub type ImplDatum = chalk_rust_ir::ImplDatum<Interner>; |
@@ -36,10 +36,10 @@ impl chalk_ir::interner::Interner for Interner { | |||
36 | type InternedVariableKinds = Vec<chalk_ir::VariableKind<Self>>; | 36 | type InternedVariableKinds = Vec<chalk_ir::VariableKind<Self>>; |
37 | type InternedCanonicalVarKinds = Vec<chalk_ir::CanonicalVarKind<Self>>; | 37 | type InternedCanonicalVarKinds = Vec<chalk_ir::CanonicalVarKind<Self>>; |
38 | type DefId = InternId; | 38 | type DefId = InternId; |
39 | type InternedAdtId = InternId; | 39 | type InternedAdtId = crate::TypeCtorId; |
40 | type Identifier = TypeAliasId; | 40 | type Identifier = TypeAliasId; |
41 | 41 | ||
42 | fn debug_adt_id(type_kind_id: StructId, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { | 42 | fn debug_adt_id(type_kind_id: AdtId, fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { |
43 | tls::with_current_program(|prog| Some(prog?.debug_struct_id(type_kind_id, fmt))) | 43 | tls::with_current_program(|prog| Some(prog?.debug_struct_id(type_kind_id, fmt))) |
44 | } | 44 | } |
45 | 45 | ||
diff --git a/crates/ra_hir_ty/src/traits/chalk/tls.rs b/crates/ra_hir_ty/src/traits/chalk/tls.rs index b7eb49d7b..5dfd8e3ec 100644 --- a/crates/ra_hir_ty/src/traits/chalk/tls.rs +++ b/crates/ra_hir_ty/src/traits/chalk/tls.rs | |||
@@ -15,7 +15,7 @@ pub struct DebugContext<'a>(&'a (dyn HirDatabase + 'a)); | |||
15 | impl DebugContext<'_> { | 15 | impl DebugContext<'_> { |
16 | pub fn debug_struct_id( | 16 | pub fn debug_struct_id( |
17 | &self, | 17 | &self, |
18 | id: super::StructId, | 18 | id: super::AdtId, |
19 | f: &mut fmt::Formatter<'_>, | 19 | f: &mut fmt::Formatter<'_>, |
20 | ) -> Result<(), fmt::Error> { | 20 | ) -> Result<(), fmt::Error> { |
21 | let type_ctor: TypeCtor = from_chalk(self.0, TypeName::Adt(id)); | 21 | let type_ctor: TypeCtor = from_chalk(self.0, TypeName::Adt(id)); |