-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deeply normalize type trace in type error reporting
- Loading branch information
1 parent
1920c66
commit 4217b87
Showing
3 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
tests/ui/traits/next-solver/diagnostics/deeply-normalize-type-expectation.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/ui/traits/next-solver/diagnostics/deeply-normalize-type-expectation.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |