aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir_ty/src/db.rs2
-rw-r--r--crates/ra_hir_ty/src/lib.rs2
-rw-r--r--crates/ra_hir_ty/src/traits/chalk.rs16
-rw-r--r--crates/ra_hir_ty/src/traits/chalk/interner.rs6
-rw-r--r--crates/ra_hir_ty/src/traits/chalk/tls.rs2
5 files changed, 14 insertions, 14 deletions
diff --git a/crates/ra_hir_ty/src/db.rs b/crates/ra_hir_ty/src/db.rs
index fdb49560b..dfc6c7dd6 100644
--- a/crates/ra_hir_ty/src/db.rs
+++ b/crates/ra_hir_ty/src/db.rs
@@ -89,7 +89,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
89 fn trait_datum(&self, krate: CrateId, trait_id: chalk::TraitId) -> Arc<chalk::TraitDatum>; 89 fn trait_datum(&self, krate: CrateId, trait_id: chalk::TraitId) -> Arc<chalk::TraitDatum>;
90 90
91 #[salsa::invoke(chalk::struct_datum_query)] 91 #[salsa::invoke(chalk::struct_datum_query)]
92 fn struct_datum(&self, krate: CrateId, struct_id: chalk::StructId) -> Arc<chalk::StructDatum>; 92 fn struct_datum(&self, krate: CrateId, struct_id: chalk::AdtId) -> Arc<chalk::StructDatum>;
93 93
94 #[salsa::invoke(crate::traits::chalk::impl_datum_query)] 94 #[salsa::invoke(crate::traits::chalk::impl_datum_query)]
95 fn impl_datum(&self, krate: CrateId, impl_id: chalk::ImplId) -> Arc<chalk::ImplDatum>; 95 fn impl_datum(&self, krate: CrateId, impl_id: chalk::ImplId) -> Arc<chalk::ImplDatum>;
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs
index c87ee06ce..e91c9be04 100644
--- a/crates/ra_hir_ty/src/lib.rs
+++ b/crates/ra_hir_ty/src/lib.rs
@@ -155,7 +155,7 @@ pub enum TypeCtor {
155/// This exists just for Chalk, because Chalk just has a single `StructId` where 155/// This exists just for Chalk, because Chalk just has a single `StructId` where
156/// we have different kinds of ADTs, primitive types and special type 156/// we have different kinds of ADTs, primitive types and special type
157/// constructors like tuples and function pointers. 157/// constructors like tuples and function pointers.
158#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 158#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd)]
159pub struct TypeCtorId(salsa::InternId); 159pub struct TypeCtorId(salsa::InternId);
160impl_intern_key!(TypeCtorId); 160impl_intern_key!(TypeCtorId);
161 161
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 {
257pub(crate) fn struct_datum_query( 257pub(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
408impl From<StructId> for crate::TypeCtorId { 408impl 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
414impl From<crate::TypeCtorId> for StructId { 414impl 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>;
14pub type AssociatedTyDatum = chalk_rust_ir::AssociatedTyDatum<Interner>; 14pub type AssociatedTyDatum = chalk_rust_ir::AssociatedTyDatum<Interner>;
15pub type TraitId = chalk_ir::TraitId<Interner>; 15pub type TraitId = chalk_ir::TraitId<Interner>;
16pub type TraitDatum = chalk_rust_ir::TraitDatum<Interner>; 16pub type TraitDatum = chalk_rust_ir::TraitDatum<Interner>;
17pub type StructId = chalk_ir::AdtId<Interner>; 17pub type AdtId = chalk_ir::AdtId<Interner>;
18pub type StructDatum = chalk_rust_ir::AdtDatum<Interner>; 18pub type StructDatum = chalk_rust_ir::AdtDatum<Interner>;
19pub type ImplId = chalk_ir::ImplId<Interner>; 19pub type ImplId = chalk_ir::ImplId<Interner>;
20pub type ImplDatum = chalk_rust_ir::ImplDatum<Interner>; 20pub 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));
15impl DebugContext<'_> { 15impl 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));