aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2019-09-07 15:30:37 +0100
committerFlorian Diebold <[email protected]>2019-09-07 15:30:37 +0100
commit9db34eec209c740ed919afb288f75daa755cd268 (patch)
tree2e1cdeebf32b8493c8447316bbe384095cd69067 /crates
parenta1776b27c7d7c266d751360b80cc573b1520ef65 (diff)
Fix Chalk environments
The clauses need to be wrapped in `FromEnv` clauses for elaboration (i.e. things like inferring `T: Clone` from `T: Copy`) to work correctly.
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/ty/tests.rs4
-rw-r--r--crates/ra_hir/src/ty/traits/chalk.rs3
2 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index 127c69f8a..3f86a5c80 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -3687,9 +3687,9 @@ fn test<T: Trait1, U: Trait2>(x: T, y: U) {
3687 [188; 189) 'y': U 3687 [188; 189) 'y': U
3688 [194; 223) '{ ...o(); }': () 3688 [194; 223) '{ ...o(); }': ()
3689 [200; 201) 'x': T 3689 [200; 201) 'x': T
3690 [200; 207) 'x.foo()': {unknown} 3690 [200; 207) 'x.foo()': u32
3691 [213; 214) 'y': U 3691 [213; 214) 'y': U
3692 [213; 220) 'y.foo()': {unknown} 3692 [213; 220) 'y.foo()': u32
3693 "### 3693 "###
3694 ); 3694 );
3695} 3695}
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs
index cfe0cab16..8a127efa1 100644
--- a/crates/ra_hir/src/ty/traits/chalk.rs
+++ b/crates/ra_hir/src/ty/traits/chalk.rs
@@ -314,7 +314,8 @@ impl ToChalk for Arc<super::TraitEnvironment> {
314 // for env, we just ignore errors 314 // for env, we just ignore errors
315 continue; 315 continue;
316 } 316 }
317 clauses.push(pred.clone().to_chalk(db).cast()); 317 let program_clause: chalk_ir::ProgramClause = pred.clone().to_chalk(db).cast();
318 clauses.push(program_clause.into_from_env_clause());
318 } 319 }
319 chalk_ir::Environment::new().add_clauses(clauses) 320 chalk_ir::Environment::new().add_clauses(clauses)
320 } 321 }