diff options
-rw-r--r-- | Cargo.lock | 35 | ||||
-rw-r--r-- | crates/ra_hir_ty/Cargo.toml | 6 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk.rs | 123 |
4 files changed, 118 insertions, 52 deletions
diff --git a/Cargo.lock b/Cargo.lock index d3ca9684b..c46bf9448 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -114,7 +114,7 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" | |||
114 | [[package]] | 114 | [[package]] |
115 | name = "chalk-derive" | 115 | name = "chalk-derive" |
116 | version = "0.1.0" | 116 | version = "0.1.0" |
117 | source = "git+https://github.com/rust-lang/chalk.git?rev=177d71340acc7a7204a33115fc63075d86452179#177d71340acc7a7204a33115fc63075d86452179" | 117 | source = "git+https://github.com/rust-lang/chalk.git?rev=d383af7333cc6014e9d9e3e77668b5d5b0a5b40e#d383af7333cc6014e9d9e3e77668b5d5b0a5b40e" |
118 | dependencies = [ | 118 | dependencies = [ |
119 | "proc-macro2", | 119 | "proc-macro2", |
120 | "quote", | 120 | "quote", |
@@ -124,7 +124,7 @@ dependencies = [ | |||
124 | [[package]] | 124 | [[package]] |
125 | name = "chalk-engine" | 125 | name = "chalk-engine" |
126 | version = "0.9.0" | 126 | version = "0.9.0" |
127 | source = "git+https://github.com/rust-lang/chalk.git?rev=177d71340acc7a7204a33115fc63075d86452179#177d71340acc7a7204a33115fc63075d86452179" | 127 | source = "git+https://github.com/rust-lang/chalk.git?rev=d383af7333cc6014e9d9e3e77668b5d5b0a5b40e#d383af7333cc6014e9d9e3e77668b5d5b0a5b40e" |
128 | dependencies = [ | 128 | dependencies = [ |
129 | "chalk-macros", | 129 | "chalk-macros", |
130 | "rustc-hash", | 130 | "rustc-hash", |
@@ -133,7 +133,7 @@ dependencies = [ | |||
133 | [[package]] | 133 | [[package]] |
134 | name = "chalk-ir" | 134 | name = "chalk-ir" |
135 | version = "0.1.0" | 135 | version = "0.1.0" |
136 | source = "git+https://github.com/rust-lang/chalk.git?rev=177d71340acc7a7204a33115fc63075d86452179#177d71340acc7a7204a33115fc63075d86452179" | 136 | source = "git+https://github.com/rust-lang/chalk.git?rev=d383af7333cc6014e9d9e3e77668b5d5b0a5b40e#d383af7333cc6014e9d9e3e77668b5d5b0a5b40e" |
137 | dependencies = [ | 137 | dependencies = [ |
138 | "chalk-derive", | 138 | "chalk-derive", |
139 | "chalk-engine", | 139 | "chalk-engine", |
@@ -143,7 +143,7 @@ dependencies = [ | |||
143 | [[package]] | 143 | [[package]] |
144 | name = "chalk-macros" | 144 | name = "chalk-macros" |
145 | version = "0.1.1" | 145 | version = "0.1.1" |
146 | source = "git+https://github.com/rust-lang/chalk.git?rev=177d71340acc7a7204a33115fc63075d86452179#177d71340acc7a7204a33115fc63075d86452179" | 146 | source = "git+https://github.com/rust-lang/chalk.git?rev=d383af7333cc6014e9d9e3e77668b5d5b0a5b40e#d383af7333cc6014e9d9e3e77668b5d5b0a5b40e" |
147 | dependencies = [ | 147 | dependencies = [ |
148 | "lazy_static", | 148 | "lazy_static", |
149 | ] | 149 | ] |
@@ -151,7 +151,7 @@ dependencies = [ | |||
151 | [[package]] | 151 | [[package]] |
152 | name = "chalk-rust-ir" | 152 | name = "chalk-rust-ir" |
153 | version = "0.1.0" | 153 | version = "0.1.0" |
154 | source = "git+https://github.com/rust-lang/chalk.git?rev=177d71340acc7a7204a33115fc63075d86452179#177d71340acc7a7204a33115fc63075d86452179" | 154 | source = "git+https://github.com/rust-lang/chalk.git?rev=d383af7333cc6014e9d9e3e77668b5d5b0a5b40e#d383af7333cc6014e9d9e3e77668b5d5b0a5b40e" |
155 | dependencies = [ | 155 | dependencies = [ |
156 | "chalk-derive", | 156 | "chalk-derive", |
157 | "chalk-engine", | 157 | "chalk-engine", |
@@ -162,7 +162,7 @@ dependencies = [ | |||
162 | [[package]] | 162 | [[package]] |
163 | name = "chalk-solve" | 163 | name = "chalk-solve" |
164 | version = "0.1.0" | 164 | version = "0.1.0" |
165 | source = "git+https://github.com/rust-lang/chalk.git?rev=177d71340acc7a7204a33115fc63075d86452179#177d71340acc7a7204a33115fc63075d86452179" | 165 | source = "git+https://github.com/rust-lang/chalk.git?rev=d383af7333cc6014e9d9e3e77668b5d5b0a5b40e#d383af7333cc6014e9d9e3e77668b5d5b0a5b40e" |
166 | dependencies = [ | 166 | dependencies = [ |
167 | "chalk-derive", | 167 | "chalk-derive", |
168 | "chalk-engine", | 168 | "chalk-engine", |
@@ -170,7 +170,7 @@ dependencies = [ | |||
170 | "chalk-macros", | 170 | "chalk-macros", |
171 | "chalk-rust-ir", | 171 | "chalk-rust-ir", |
172 | "ena", | 172 | "ena", |
173 | "itertools 0.8.2", | 173 | "itertools", |
174 | "petgraph", | 174 | "petgraph", |
175 | "rustc-hash", | 175 | "rustc-hash", |
176 | ] | 176 | ] |
@@ -507,15 +507,6 @@ dependencies = [ | |||
507 | 507 | ||
508 | [[package]] | 508 | [[package]] |
509 | name = "itertools" | 509 | name = "itertools" |
510 | version = "0.8.2" | ||
511 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
512 | checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" | ||
513 | dependencies = [ | ||
514 | "either", | ||
515 | ] | ||
516 | |||
517 | [[package]] | ||
518 | name = "itertools" | ||
519 | version = "0.9.0" | 510 | version = "0.9.0" |
520 | source = "registry+https://github.com/rust-lang/crates.io-index" | 511 | source = "registry+https://github.com/rust-lang/crates.io-index" |
521 | checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" | 512 | checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" |
@@ -873,7 +864,7 @@ name = "ra_assists" | |||
873 | version = "0.1.0" | 864 | version = "0.1.0" |
874 | dependencies = [ | 865 | dependencies = [ |
875 | "either", | 866 | "either", |
876 | "itertools 0.9.0", | 867 | "itertools", |
877 | "ra_db", | 868 | "ra_db", |
878 | "ra_fmt", | 869 | "ra_fmt", |
879 | "ra_hir", | 870 | "ra_hir", |
@@ -927,7 +918,7 @@ dependencies = [ | |||
927 | name = "ra_fmt" | 918 | name = "ra_fmt" |
928 | version = "0.1.0" | 919 | version = "0.1.0" |
929 | dependencies = [ | 920 | dependencies = [ |
930 | "itertools 0.9.0", | 921 | "itertools", |
931 | "ra_syntax", | 922 | "ra_syntax", |
932 | ] | 923 | ] |
933 | 924 | ||
@@ -937,7 +928,7 @@ version = "0.1.0" | |||
937 | dependencies = [ | 928 | dependencies = [ |
938 | "arrayvec", | 929 | "arrayvec", |
939 | "either", | 930 | "either", |
940 | "itertools 0.9.0", | 931 | "itertools", |
941 | "log", | 932 | "log", |
942 | "ra_db", | 933 | "ra_db", |
943 | "ra_hir_def", | 934 | "ra_hir_def", |
@@ -1015,7 +1006,7 @@ dependencies = [ | |||
1015 | "either", | 1006 | "either", |
1016 | "indexmap", | 1007 | "indexmap", |
1017 | "insta", | 1008 | "insta", |
1018 | "itertools 0.9.0", | 1009 | "itertools", |
1019 | "log", | 1010 | "log", |
1020 | "ra_assists", | 1011 | "ra_assists", |
1021 | "ra_cfg", | 1012 | "ra_cfg", |
@@ -1127,7 +1118,7 @@ name = "ra_syntax" | |||
1127 | version = "0.1.0" | 1118 | version = "0.1.0" |
1128 | dependencies = [ | 1119 | dependencies = [ |
1129 | "arrayvec", | 1120 | "arrayvec", |
1130 | "itertools 0.9.0", | 1121 | "itertools", |
1131 | "once_cell", | 1122 | "once_cell", |
1132 | "ra_parser", | 1123 | "ra_parser", |
1133 | "ra_text_edit", | 1124 | "ra_text_edit", |
@@ -1305,7 +1296,7 @@ dependencies = [ | |||
1305 | "crossbeam-channel", | 1296 | "crossbeam-channel", |
1306 | "env_logger", | 1297 | "env_logger", |
1307 | "globset", | 1298 | "globset", |
1308 | "itertools 0.9.0", | 1299 | "itertools", |
1309 | "jod-thread", | 1300 | "jod-thread", |
1310 | "log", | 1301 | "log", |
1311 | "lsp-server", | 1302 | "lsp-server", |
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/ra_hir_ty/Cargo.toml index 5a58d70cf..2cbab800d 100644 --- a/crates/ra_hir_ty/Cargo.toml +++ b/crates/ra_hir_ty/Cargo.toml | |||
@@ -23,9 +23,9 @@ ra_prof = { path = "../ra_prof" } | |||
23 | ra_syntax = { path = "../ra_syntax" } | 23 | ra_syntax = { path = "../ra_syntax" } |
24 | test_utils = { path = "../test_utils" } | 24 | test_utils = { path = "../test_utils" } |
25 | 25 | ||
26 | chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "177d71340acc7a7204a33115fc63075d86452179" } | 26 | chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "d383af7333cc6014e9d9e3e77668b5d5b0a5b40e" } |
27 | chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "177d71340acc7a7204a33115fc63075d86452179" } | 27 | chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "d383af7333cc6014e9d9e3e77668b5d5b0a5b40e" } |
28 | chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "177d71340acc7a7204a33115fc63075d86452179" } | 28 | chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "d383af7333cc6014e9d9e3e77668b5d5b0a5b40e" } |
29 | 29 | ||
30 | [dev-dependencies] | 30 | [dev-dependencies] |
31 | insta = "0.15.0" | 31 | insta = "0.15.0" |
diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs index a1ca33c98..80eae4eca 100644 --- a/crates/ra_hir_ty/src/traits.rs +++ b/crates/ra_hir_ty/src/traits.rs | |||
@@ -153,7 +153,7 @@ pub(crate) fn trait_solve_query( | |||
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | let canonical = goal.to_chalk(db).cast(); | 156 | let canonical = goal.to_chalk(db).cast(&Interner); |
157 | 157 | ||
158 | // We currently don't deal with universes (I think / hope they're not yet | 158 | // We currently don't deal with universes (I think / hope they're not yet |
159 | // relevant for our use cases?) | 159 | // relevant for our use cases?) |
@@ -194,8 +194,8 @@ fn solution_from_chalk( | |||
194 | let convert_subst = |subst: chalk_ir::Canonical<chalk_ir::Substitution<Interner>>| { | 194 | let convert_subst = |subst: chalk_ir::Canonical<chalk_ir::Substitution<Interner>>| { |
195 | let value = subst | 195 | let value = subst |
196 | .value | 196 | .value |
197 | .into_iter() | 197 | .iter(&Interner) |
198 | .map(|p| match p.ty() { | 198 | .map(|p| match p.ty(&Interner) { |
199 | Some(ty) => from_chalk(db, ty.clone()), | 199 | Some(ty) => from_chalk(db, ty.clone()), |
200 | None => unimplemented!(), | 200 | None => unimplemented!(), |
201 | }) | 201 | }) |
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index 943d5f125..ab4cb33b4 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs | |||
@@ -59,53 +59,126 @@ impl chalk_ir::interner::Interner for Interner { | |||
59 | None | 59 | None |
60 | } | 60 | } |
61 | 61 | ||
62 | fn debug_ty(_ty: &chalk_ir::Ty<Self>, _fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { | ||
63 | None | ||
64 | } | ||
65 | |||
66 | fn debug_lifetime( | ||
67 | _lifetime: &chalk_ir::Lifetime<Self>, | ||
68 | _fmt: &mut fmt::Formatter<'_>, | ||
69 | ) -> Option<fmt::Result> { | ||
70 | None | ||
71 | } | ||
72 | |||
73 | fn debug_parameter( | ||
74 | _parameter: &Parameter<Self>, | ||
75 | _fmt: &mut fmt::Formatter<'_>, | ||
76 | ) -> Option<fmt::Result> { | ||
77 | None | ||
78 | } | ||
79 | |||
80 | fn debug_goal(_goal: &Goal<Self>, _fmt: &mut fmt::Formatter<'_>) -> Option<fmt::Result> { | ||
81 | None | ||
82 | } | ||
83 | |||
84 | fn debug_goals( | ||
85 | _goals: &chalk_ir::Goals<Self>, | ||
86 | _fmt: &mut fmt::Formatter<'_>, | ||
87 | ) -> Option<fmt::Result> { | ||
88 | None | ||
89 | } | ||
90 | |||
91 | fn debug_program_clause_implication( | ||
92 | _pci: &chalk_ir::ProgramClauseImplication<Self>, | ||
93 | _fmt: &mut fmt::Formatter<'_>, | ||
94 | ) -> Option<fmt::Result> { | ||
95 | None | ||
96 | } | ||
97 | |||
98 | fn debug_application_ty( | ||
99 | _application_ty: &chalk_ir::ApplicationTy<Self>, | ||
100 | _fmt: &mut fmt::Formatter<'_>, | ||
101 | ) -> Option<fmt::Result> { | ||
102 | None | ||
103 | } | ||
104 | |||
105 | fn debug_substitution( | ||
106 | _substitution: &chalk_ir::Substitution<Self>, | ||
107 | _fmt: &mut fmt::Formatter<'_>, | ||
108 | ) -> Option<fmt::Result> { | ||
109 | None | ||
110 | } | ||
111 | |||
112 | fn debug_separator_trait_ref( | ||
113 | _separator_trait_ref: &chalk_ir::SeparatorTraitRef<Self>, | ||
114 | _fmt: &mut fmt::Formatter<'_>, | ||
115 | ) -> Option<fmt::Result> { | ||
116 | None | ||
117 | } | ||
118 | |||
62 | fn intern_ty(&self, ty: chalk_ir::TyData<Self>) -> Box<chalk_ir::TyData<Self>> { | 119 | fn intern_ty(&self, ty: chalk_ir::TyData<Self>) -> Box<chalk_ir::TyData<Self>> { |
63 | Box::new(ty) | 120 | Box::new(ty) |
64 | } | 121 | } |
65 | 122 | ||
66 | fn ty_data(ty: &Box<chalk_ir::TyData<Self>>) -> &chalk_ir::TyData<Self> { | 123 | fn ty_data<'a>(&self, ty: &'a Box<chalk_ir::TyData<Self>>) -> &'a chalk_ir::TyData<Self> { |
67 | ty | 124 | ty |
68 | } | 125 | } |
69 | 126 | ||
70 | fn intern_lifetime(lifetime: chalk_ir::LifetimeData<Self>) -> chalk_ir::LifetimeData<Self> { | 127 | fn intern_lifetime( |
128 | &self, | ||
129 | lifetime: chalk_ir::LifetimeData<Self>, | ||
130 | ) -> chalk_ir::LifetimeData<Self> { | ||
71 | lifetime | 131 | lifetime |
72 | } | 132 | } |
73 | 133 | ||
74 | fn lifetime_data(lifetime: &chalk_ir::LifetimeData<Self>) -> &chalk_ir::LifetimeData<Self> { | 134 | fn lifetime_data<'a>( |
135 | &self, | ||
136 | lifetime: &'a chalk_ir::LifetimeData<Self>, | ||
137 | ) -> &'a chalk_ir::LifetimeData<Self> { | ||
75 | lifetime | 138 | lifetime |
76 | } | 139 | } |
77 | 140 | ||
78 | fn intern_parameter(parameter: chalk_ir::ParameterData<Self>) -> chalk_ir::ParameterData<Self> { | 141 | fn intern_parameter( |
142 | &self, | ||
143 | parameter: chalk_ir::ParameterData<Self>, | ||
144 | ) -> chalk_ir::ParameterData<Self> { | ||
79 | parameter | 145 | parameter |
80 | } | 146 | } |
81 | 147 | ||
82 | fn parameter_data(parameter: &chalk_ir::ParameterData<Self>) -> &chalk_ir::ParameterData<Self> { | 148 | fn parameter_data<'a>( |
149 | &self, | ||
150 | parameter: &'a chalk_ir::ParameterData<Self>, | ||
151 | ) -> &'a chalk_ir::ParameterData<Self> { | ||
83 | parameter | 152 | parameter |
84 | } | 153 | } |
85 | 154 | ||
86 | fn intern_goal(goal: GoalData<Self>) -> Arc<GoalData<Self>> { | 155 | fn intern_goal(&self, goal: GoalData<Self>) -> Arc<GoalData<Self>> { |
87 | Arc::new(goal) | 156 | Arc::new(goal) |
88 | } | 157 | } |
89 | 158 | ||
90 | fn intern_goals(data: impl IntoIterator<Item = Goal<Self>>) -> Self::InternedGoals { | 159 | fn intern_goals(&self, data: impl IntoIterator<Item = Goal<Self>>) -> Self::InternedGoals { |
91 | data.into_iter().collect() | 160 | data.into_iter().collect() |
92 | } | 161 | } |
93 | 162 | ||
94 | fn goal_data(goal: &Arc<GoalData<Self>>) -> &GoalData<Self> { | 163 | fn goal_data<'a>(&self, goal: &'a Arc<GoalData<Self>>) -> &'a GoalData<Self> { |
95 | goal | 164 | goal |
96 | } | 165 | } |
97 | 166 | ||
98 | fn goals_data(goals: &Vec<Goal<Interner>>) -> &[Goal<Interner>] { | 167 | fn goals_data<'a>(&self, goals: &'a Vec<Goal<Interner>>) -> &'a [Goal<Interner>] { |
99 | goals | 168 | goals |
100 | } | 169 | } |
101 | 170 | ||
102 | fn intern_substitution<E>( | 171 | fn intern_substitution<E>( |
172 | &self, | ||
103 | data: impl IntoIterator<Item = Result<Parameter<Self>, E>>, | 173 | data: impl IntoIterator<Item = Result<Parameter<Self>, E>>, |
104 | ) -> Result<Vec<Parameter<Self>>, E> { | 174 | ) -> Result<Vec<Parameter<Self>>, E> { |
105 | data.into_iter().collect() | 175 | data.into_iter().collect() |
106 | } | 176 | } |
107 | 177 | ||
108 | fn substitution_data(substitution: &Vec<Parameter<Self>>) -> &[Parameter<Self>] { | 178 | fn substitution_data<'a>( |
179 | &self, | ||
180 | substitution: &'a Vec<Parameter<Self>>, | ||
181 | ) -> &'a [Parameter<Self>] { | ||
109 | substitution | 182 | substitution |
110 | } | 183 | } |
111 | } | 184 | } |
@@ -145,12 +218,14 @@ impl ToChalk for Ty { | |||
145 | Ty::Apply(apply_ty) => { | 218 | Ty::Apply(apply_ty) => { |
146 | let name = apply_ty.ctor.to_chalk(db); | 219 | let name = apply_ty.ctor.to_chalk(db); |
147 | let substitution = apply_ty.parameters.to_chalk(db); | 220 | let substitution = apply_ty.parameters.to_chalk(db); |
148 | chalk_ir::ApplicationTy { name, substitution }.cast().intern(&Interner) | 221 | chalk_ir::ApplicationTy { name, substitution }.cast(&Interner).intern(&Interner) |
149 | } | 222 | } |
150 | Ty::Projection(proj_ty) => { | 223 | Ty::Projection(proj_ty) => { |
151 | let associated_ty_id = proj_ty.associated_ty.to_chalk(db); | 224 | let associated_ty_id = proj_ty.associated_ty.to_chalk(db); |
152 | let substitution = proj_ty.parameters.to_chalk(db); | 225 | let substitution = proj_ty.parameters.to_chalk(db); |
153 | chalk_ir::AliasTy { associated_ty_id, substitution }.cast().intern(&Interner) | 226 | chalk_ir::AliasTy { associated_ty_id, substitution } |
227 | .cast(&Interner) | ||
228 | .intern(&Interner) | ||
154 | } | 229 | } |
155 | Ty::Placeholder(id) => { | 230 | Ty::Placeholder(id) => { |
156 | let interned_id = db.intern_type_param_id(id); | 231 | let interned_id = db.intern_type_param_id(id); |
@@ -173,14 +248,14 @@ impl ToChalk for Ty { | |||
173 | chalk_ir::TyData::Dyn(bounded_ty).intern(&Interner) | 248 | chalk_ir::TyData::Dyn(bounded_ty).intern(&Interner) |
174 | } | 249 | } |
175 | Ty::Opaque(_) | Ty::Unknown => { | 250 | Ty::Opaque(_) | Ty::Unknown => { |
176 | let substitution = chalk_ir::Substitution::empty(); | 251 | let substitution = chalk_ir::Substitution::empty(&Interner); |
177 | let name = TypeName::Error; | 252 | let name = TypeName::Error; |
178 | chalk_ir::ApplicationTy { name, substitution }.cast().intern(&Interner) | 253 | chalk_ir::ApplicationTy { name, substitution }.cast(&Interner).intern(&Interner) |
179 | } | 254 | } |
180 | } | 255 | } |
181 | } | 256 | } |
182 | fn from_chalk(db: &dyn HirDatabase, chalk: chalk_ir::Ty<Interner>) -> Self { | 257 | fn from_chalk(db: &dyn HirDatabase, chalk: chalk_ir::Ty<Interner>) -> Self { |
183 | match chalk.data().clone() { | 258 | match chalk.data(&Interner).clone() { |
184 | chalk_ir::TyData::Apply(apply_ty) => match apply_ty.name { | 259 | chalk_ir::TyData::Apply(apply_ty) => match apply_ty.name { |
185 | TypeName::Error => Ty::Unknown, | 260 | TypeName::Error => Ty::Unknown, |
186 | _ => { | 261 | _ => { |
@@ -218,13 +293,13 @@ impl ToChalk for Substs { | |||
218 | type Chalk = chalk_ir::Substitution<Interner>; | 293 | type Chalk = chalk_ir::Substitution<Interner>; |
219 | 294 | ||
220 | fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::Substitution<Interner> { | 295 | fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::Substitution<Interner> { |
221 | chalk_ir::Substitution::from(self.iter().map(|ty| ty.clone().to_chalk(db))) | 296 | chalk_ir::Substitution::from(&Interner, self.iter().map(|ty| ty.clone().to_chalk(db))) |
222 | } | 297 | } |
223 | 298 | ||
224 | fn from_chalk(db: &dyn HirDatabase, parameters: chalk_ir::Substitution<Interner>) -> Substs { | 299 | fn from_chalk(db: &dyn HirDatabase, parameters: chalk_ir::Substitution<Interner>) -> Substs { |
225 | let tys = parameters | 300 | let tys = parameters |
226 | .into_iter() | 301 | .iter(&Interner) |
227 | .map(|p| match p.ty() { | 302 | .map(|p| match p.ty(&Interner) { |
228 | Some(ty) => from_chalk(db, ty.clone()), | 303 | Some(ty) => from_chalk(db, ty.clone()), |
229 | None => unimplemented!(), | 304 | None => unimplemented!(), |
230 | }) | 305 | }) |
@@ -400,8 +475,8 @@ impl ToChalk for Obligation { | |||
400 | 475 | ||
401 | fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::DomainGoal<Interner> { | 476 | fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::DomainGoal<Interner> { |
402 | match self { | 477 | match self { |
403 | Obligation::Trait(tr) => tr.to_chalk(db).cast(), | 478 | Obligation::Trait(tr) => tr.to_chalk(db).cast(&Interner), |
404 | Obligation::Projection(pr) => pr.to_chalk(db).cast(), | 479 | Obligation::Projection(pr) => pr.to_chalk(db).cast(&Interner), |
405 | } | 480 | } |
406 | } | 481 | } |
407 | 482 | ||
@@ -438,8 +513,8 @@ impl ToChalk for Arc<super::TraitEnvironment> { | |||
438 | continue; | 513 | continue; |
439 | } | 514 | } |
440 | let program_clause: chalk_ir::ProgramClause<Interner> = | 515 | let program_clause: chalk_ir::ProgramClause<Interner> = |
441 | pred.clone().to_chalk(db).cast(); | 516 | pred.clone().to_chalk(db).cast(&Interner); |
442 | clauses.push(program_clause.into_from_env_clause()); | 517 | clauses.push(program_clause.into_from_env_clause(&Interner)); |
443 | } | 518 | } |
444 | chalk_ir::Environment::new().add_clauses(clauses) | 519 | chalk_ir::Environment::new().add_clauses(clauses) |
445 | } | 520 | } |
@@ -578,9 +653,9 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
578 | .map(|impl_| impl_.to_chalk(self.db)) | 653 | .map(|impl_| impl_.to_chalk(self.db)) |
579 | .collect(); | 654 | .collect(); |
580 | 655 | ||
581 | let ty: Ty = from_chalk(self.db, parameters[0].assert_ty_ref().clone()); | 656 | let ty: Ty = from_chalk(self.db, parameters[0].assert_ty_ref(&Interner).clone()); |
582 | let arg: Option<Ty> = | 657 | let arg: Option<Ty> = |
583 | parameters.get(1).map(|p| from_chalk(self.db, p.assert_ty_ref().clone())); | 658 | parameters.get(1).map(|p| from_chalk(self.db, p.assert_ty_ref(&Interner).clone())); |
584 | 659 | ||
585 | builtin::get_builtin_impls(self.db, self.krate, &ty, &arg, trait_, |i| { | 660 | builtin::get_builtin_impls(self.db, self.krate, &ty, &arg, trait_, |i| { |
586 | result.push(i.to_chalk(self.db)) | 661 | result.push(i.to_chalk(self.db)) |