mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-16 07:03:57 +00:00
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.
This commit is contained in:
parent
a1776b27c7
commit
9db34eec20
2 changed files with 4 additions and 3 deletions
|
@ -3687,9 +3687,9 @@ fn test<T: Trait1, U: Trait2>(x: T, y: U) {
|
||||||
[188; 189) 'y': U
|
[188; 189) 'y': U
|
||||||
[194; 223) '{ ...o(); }': ()
|
[194; 223) '{ ...o(); }': ()
|
||||||
[200; 201) 'x': T
|
[200; 201) 'x': T
|
||||||
[200; 207) 'x.foo()': {unknown}
|
[200; 207) 'x.foo()': u32
|
||||||
[213; 214) 'y': U
|
[213; 214) 'y': U
|
||||||
[213; 220) 'y.foo()': {unknown}
|
[213; 220) 'y.foo()': u32
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -314,7 +314,8 @@ impl ToChalk for Arc<super::TraitEnvironment> {
|
||||||
// for env, we just ignore errors
|
// for env, we just ignore errors
|
||||||
continue;
|
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)
|
chalk_ir::Environment::new().add_clauses(clauses)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue