Deeply normalize type trace in type error reporting
This commit is contained in:
parent
1920c66a8d
commit
4217b8702d
@ -1252,8 +1252,11 @@ enum Mismatch<'a> {
|
||||
}
|
||||
let (expected_found, exp_found, is_simple_error, values) = match values {
|
||||
None => (None, Mismatch::Fixed("type"), false, None),
|
||||
Some(ty::ParamEnvAnd { param_env: _, value: values }) => {
|
||||
Some(ty::ParamEnvAnd { param_env, value: values }) => {
|
||||
let mut values = self.resolve_vars_if_possible(values);
|
||||
if self.next_trait_solver() {
|
||||
values = deeply_normalize_for_diagnostics(self, param_env, values);
|
||||
}
|
||||
let (is_simple_error, exp_found) = match values {
|
||||
ValuePairs::Terms(ExpectedFound { expected, found }) => {
|
||||
match (expected.unpack(), found.unpack()) {
|
||||
|
@ -0,0 +1,17 @@
|
||||
//@ compile-flags: -Znext-solver
|
||||
|
||||
// Make sure we try to mention a deeply normalized type in a type mismatch error.
|
||||
|
||||
trait Mirror {
|
||||
type Assoc;
|
||||
}
|
||||
impl<T> Mirror for T {
|
||||
type Assoc = T;
|
||||
}
|
||||
|
||||
fn needs<T>(_: <T as Mirror>::Assoc) {}
|
||||
|
||||
fn main() {
|
||||
needs::<i32>(());
|
||||
//~^ ERROR mismatched types
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/deeply-normalize-type-expectation.rs:15:18
|
||||
|
|
||||
LL | needs::<i32>(());
|
||||
| ------------ ^^ expected `i32`, found `()`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
note: function defined here
|
||||
--> $DIR/deeply-normalize-type-expectation.rs:12:4
|
||||
|
|
||||
LL | fn needs<T>(_: <T as Mirror>::Assoc) {}
|
||||
| ^^^^^ -----------------------
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
Loading…
Reference in New Issue
Block a user