diff options
author | Laurențiu Nicola <[email protected]> | 2020-03-02 22:01:16 +0000 |
---|---|---|
committer | Laurențiu Nicola <[email protected]> | 2020-03-02 22:02:19 +0000 |
commit | f60cf882a858e0d9f6df07f661021814d7872690 (patch) | |
tree | d6b195957696a8a4be9727d33f3ef3adc03ed8a8 | |
parent | 807a56bebfecf6f655c48c3490c296180045c44b (diff) |
Update chalk for Ty interners
-rw-r--r-- | Cargo.lock | 12 | ||||
-rw-r--r-- | crates/ra_hir_ty/Cargo.toml | 6 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk.rs | 19 |
3 files changed, 20 insertions, 17 deletions
diff --git a/Cargo.lock b/Cargo.lock index 5a28f7d7d..cab28ad49 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -129,7 +129,7 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" | |||
129 | [[package]] | 129 | [[package]] |
130 | name = "chalk-derive" | 130 | name = "chalk-derive" |
131 | version = "0.1.0" | 131 | version = "0.1.0" |
132 | source = "git+https://github.com/rust-lang/chalk.git?rev=ea1725e6bcf1881ad6c8304941e2282f33d32d1d#ea1725e6bcf1881ad6c8304941e2282f33d32d1d" | 132 | source = "git+https://github.com/rust-lang/chalk.git?rev=177d71340acc7a7204a33115fc63075d86452179#177d71340acc7a7204a33115fc63075d86452179" |
133 | dependencies = [ | 133 | dependencies = [ |
134 | "proc-macro2", | 134 | "proc-macro2", |
135 | "quote", | 135 | "quote", |
@@ -139,7 +139,7 @@ dependencies = [ | |||
139 | [[package]] | 139 | [[package]] |
140 | name = "chalk-engine" | 140 | name = "chalk-engine" |
141 | version = "0.9.0" | 141 | version = "0.9.0" |
142 | source = "git+https://github.com/rust-lang/chalk.git?rev=ea1725e6bcf1881ad6c8304941e2282f33d32d1d#ea1725e6bcf1881ad6c8304941e2282f33d32d1d" | 142 | source = "git+https://github.com/rust-lang/chalk.git?rev=177d71340acc7a7204a33115fc63075d86452179#177d71340acc7a7204a33115fc63075d86452179" |
143 | dependencies = [ | 143 | dependencies = [ |
144 | "chalk-macros", | 144 | "chalk-macros", |
145 | "rustc-hash", | 145 | "rustc-hash", |
@@ -148,7 +148,7 @@ dependencies = [ | |||
148 | [[package]] | 148 | [[package]] |
149 | name = "chalk-ir" | 149 | name = "chalk-ir" |
150 | version = "0.1.0" | 150 | version = "0.1.0" |
151 | source = "git+https://github.com/rust-lang/chalk.git?rev=ea1725e6bcf1881ad6c8304941e2282f33d32d1d#ea1725e6bcf1881ad6c8304941e2282f33d32d1d" | 151 | source = "git+https://github.com/rust-lang/chalk.git?rev=177d71340acc7a7204a33115fc63075d86452179#177d71340acc7a7204a33115fc63075d86452179" |
152 | dependencies = [ | 152 | dependencies = [ |
153 | "chalk-derive", | 153 | "chalk-derive", |
154 | "chalk-engine", | 154 | "chalk-engine", |
@@ -158,7 +158,7 @@ dependencies = [ | |||
158 | [[package]] | 158 | [[package]] |
159 | name = "chalk-macros" | 159 | name = "chalk-macros" |
160 | version = "0.1.1" | 160 | version = "0.1.1" |
161 | source = "git+https://github.com/rust-lang/chalk.git?rev=ea1725e6bcf1881ad6c8304941e2282f33d32d1d#ea1725e6bcf1881ad6c8304941e2282f33d32d1d" | 161 | source = "git+https://github.com/rust-lang/chalk.git?rev=177d71340acc7a7204a33115fc63075d86452179#177d71340acc7a7204a33115fc63075d86452179" |
162 | dependencies = [ | 162 | dependencies = [ |
163 | "lazy_static", | 163 | "lazy_static", |
164 | ] | 164 | ] |
@@ -166,7 +166,7 @@ dependencies = [ | |||
166 | [[package]] | 166 | [[package]] |
167 | name = "chalk-rust-ir" | 167 | name = "chalk-rust-ir" |
168 | version = "0.1.0" | 168 | version = "0.1.0" |
169 | source = "git+https://github.com/rust-lang/chalk.git?rev=ea1725e6bcf1881ad6c8304941e2282f33d32d1d#ea1725e6bcf1881ad6c8304941e2282f33d32d1d" | 169 | source = "git+https://github.com/rust-lang/chalk.git?rev=177d71340acc7a7204a33115fc63075d86452179#177d71340acc7a7204a33115fc63075d86452179" |
170 | dependencies = [ | 170 | dependencies = [ |
171 | "chalk-derive", | 171 | "chalk-derive", |
172 | "chalk-engine", | 172 | "chalk-engine", |
@@ -177,7 +177,7 @@ dependencies = [ | |||
177 | [[package]] | 177 | [[package]] |
178 | name = "chalk-solve" | 178 | name = "chalk-solve" |
179 | version = "0.1.0" | 179 | version = "0.1.0" |
180 | source = "git+https://github.com/rust-lang/chalk.git?rev=ea1725e6bcf1881ad6c8304941e2282f33d32d1d#ea1725e6bcf1881ad6c8304941e2282f33d32d1d" | 180 | source = "git+https://github.com/rust-lang/chalk.git?rev=177d71340acc7a7204a33115fc63075d86452179#177d71340acc7a7204a33115fc63075d86452179" |
181 | dependencies = [ | 181 | dependencies = [ |
182 | "chalk-derive", | 182 | "chalk-derive", |
183 | "chalk-engine", | 183 | "chalk-engine", |
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" } | |||
21 | ra_syntax = { path = "../ra_syntax" } | 21 | ra_syntax = { path = "../ra_syntax" } |
22 | test_utils = { path = "../test_utils" } | 22 | test_utils = { path = "../test_utils" } |
23 | 23 | ||
24 | chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "ea1725e6bcf1881ad6c8304941e2282f33d32d1d" } | 24 | chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "177d71340acc7a7204a33115fc63075d86452179" } |
25 | chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "ea1725e6bcf1881ad6c8304941e2282f33d32d1d" } | 25 | chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "177d71340acc7a7204a33115fc63075d86452179" } |
26 | chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "ea1725e6bcf1881ad6c8304941e2282f33d32d1d" } | 26 | chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "177d71340acc7a7204a33115fc63075d86452179" } |
27 | 27 | ||
28 | lalrpop-intern = "0.15.1" | 28 | lalrpop-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)] |
21 | pub struct Interner {} | 21 | pub struct Interner; |
22 | 22 | ||
23 | impl chalk_ir::interner::Interner for Interner { | 23 | impl 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 | ||
617 | pub(crate) fn associated_ty_data_query( | 620 | pub(crate) fn associated_ty_data_query( |