aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r--crates/ra_hir_ty/Cargo.toml6
-rw-r--r--crates/ra_hir_ty/src/traits/chalk.rs19
2 files changed, 14 insertions, 11 deletions
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/ra_hir_ty/Cargo.toml
index 498706168..202eca507 100644
--- a/crates/ra_hir_ty/Cargo.toml
+++ b/crates/ra_hir_ty/Cargo.toml
@@ -21,9 +21,9 @@ ra_prof = { path = "../ra_prof" }
21ra_syntax = { path = "../ra_syntax" } 21ra_syntax = { path = "../ra_syntax" }
22test_utils = { path = "../test_utils" } 22test_utils = { path = "../test_utils" }
23 23
24chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "ea1725e6bcf1881ad6c8304941e2282f33d32d1d" } 24chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "177d71340acc7a7204a33115fc63075d86452179" }
25chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "ea1725e6bcf1881ad6c8304941e2282f33d32d1d" } 25chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "177d71340acc7a7204a33115fc63075d86452179" }
26chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "ea1725e6bcf1881ad6c8304941e2282f33d32d1d" } 26chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "177d71340acc7a7204a33115fc63075d86452179" }
27 27
28lalrpop-intern = "0.15.1" 28lalrpop-intern = "0.15.1"
29 29
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs
index 7a0f99dec..7f7fe93b7 100644
--- a/crates/ra_hir_ty/src/traits/chalk.rs
+++ b/crates/ra_hir_ty/src/traits/chalk.rs
@@ -18,7 +18,7 @@ use crate::{
18}; 18};
19 19
20#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)] 20#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
21pub struct Interner {} 21pub struct Interner;
22 22
23impl chalk_ir::interner::Interner for Interner { 23impl chalk_ir::interner::Interner for Interner {
24 type InternedType = Box<chalk_ir::TyData<Self>>; 24 type InternedType = Box<chalk_ir::TyData<Self>>;
@@ -59,7 +59,7 @@ impl chalk_ir::interner::Interner for Interner {
59 None 59 None
60 } 60 }
61 61
62 fn intern_ty(ty: chalk_ir::TyData<Self>) -> Box<chalk_ir::TyData<Self>> { 62 fn intern_ty(&self, ty: chalk_ir::TyData<Self>) -> Box<chalk_ir::TyData<Self>> {
63 Box::new(ty) 63 Box::new(ty)
64 } 64 }
65 65
@@ -145,12 +145,12 @@ impl ToChalk for Ty {
145 Ty::Apply(apply_ty) => { 145 Ty::Apply(apply_ty) => {
146 let name = apply_ty.ctor.to_chalk(db); 146 let name = apply_ty.ctor.to_chalk(db);
147 let substitution = apply_ty.parameters.to_chalk(db); 147 let substitution = apply_ty.parameters.to_chalk(db);
148 chalk_ir::ApplicationTy { name, substitution }.cast().intern() 148 chalk_ir::ApplicationTy { name, substitution }.cast().intern(&Interner)
149 } 149 }
150 Ty::Projection(proj_ty) => { 150 Ty::Projection(proj_ty) => {
151 let associated_ty_id = proj_ty.associated_ty.to_chalk(db); 151 let associated_ty_id = proj_ty.associated_ty.to_chalk(db);
152 let substitution = proj_ty.parameters.to_chalk(db); 152 let substitution = proj_ty.parameters.to_chalk(db);
153 chalk_ir::AliasTy { associated_ty_id, substitution }.cast().intern() 153 chalk_ir::AliasTy { associated_ty_id, substitution }.cast().intern(&Interner)
154 } 154 }
155 Ty::Placeholder(id) => { 155 Ty::Placeholder(id) => {
156 let interned_id = db.intern_type_param_id(id); 156 let interned_id = db.intern_type_param_id(id);
@@ -158,9 +158,9 @@ impl ToChalk for Ty {
158 ui: UniverseIndex::ROOT, 158 ui: UniverseIndex::ROOT,
159 idx: interned_id.as_intern_id().as_usize(), 159 idx: interned_id.as_intern_id().as_usize(),
160 } 160 }
161 .to_ty::<Interner>() 161 .to_ty::<Interner>(&Interner)
162 } 162 }
163 Ty::Bound(idx) => chalk_ir::TyData::BoundVar(idx as usize).intern(), 163 Ty::Bound(idx) => chalk_ir::TyData::BoundVar(idx as usize).intern(&Interner),
164 Ty::Infer(_infer_ty) => panic!("uncanonicalized infer ty"), 164 Ty::Infer(_infer_ty) => panic!("uncanonicalized infer ty"),
165 Ty::Dyn(predicates) => { 165 Ty::Dyn(predicates) => {
166 let where_clauses = predicates 166 let where_clauses = predicates
@@ -170,12 +170,12 @@ impl ToChalk for Ty {
170 .map(|p| p.to_chalk(db)) 170 .map(|p| p.to_chalk(db))
171 .collect(); 171 .collect();
172 let bounded_ty = chalk_ir::DynTy { bounds: make_binders(where_clauses, 1) }; 172 let bounded_ty = chalk_ir::DynTy { bounds: make_binders(where_clauses, 1) };
173 chalk_ir::TyData::Dyn(bounded_ty).intern() 173 chalk_ir::TyData::Dyn(bounded_ty).intern(&Interner)
174 } 174 }
175 Ty::Opaque(_) | Ty::Unknown => { 175 Ty::Opaque(_) | Ty::Unknown => {
176 let substitution = chalk_ir::Substitution::empty(); 176 let substitution = chalk_ir::Substitution::empty();
177 let name = TypeName::Error; 177 let name = TypeName::Error;
178 chalk_ir::ApplicationTy { name, substitution }.cast().intern() 178 chalk_ir::ApplicationTy { name, substitution }.cast().intern(&Interner)
179 } 179 }
180 } 180 }
181 } 181 }
@@ -612,6 +612,9 @@ where
612 _ => None, 612 _ => None,
613 } 613 }
614 } 614 }
615 fn interner(&self) -> &Interner {
616 &Interner
617 }
615} 618}
616 619
617pub(crate) fn associated_ty_data_query( 620pub(crate) fn associated_ty_data_query(