From 9db34eec209c740ed919afb288f75daa755cd268 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 7 Sep 2019 16:30:37 +0200 Subject: 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. --- crates/ra_hir/src/ty/tests.rs | 4 ++-- crates/ra_hir/src/ty/traits/chalk.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'crates') 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(x: T, y: U) { [188; 189) 'y': U [194; 223) '{ ...o(); }': () [200; 201) 'x': T - [200; 207) 'x.foo()': {unknown} + [200; 207) 'x.foo()': u32 [213; 214) 'y': U - [213; 220) 'y.foo()': {unknown} + [213; 220) 'y.foo()': u32 "### ); } 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 { // for env, we just ignore errors continue; } - clauses.push(pred.clone().to_chalk(db).cast()); + let program_clause: chalk_ir::ProgramClause = pred.clone().to_chalk(db).cast(); + clauses.push(program_clause.into_from_env_clause()); } chalk_ir::Environment::new().add_clauses(clauses) } -- cgit v1.2.3