forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#98371 - compiler-errors:better-opaque-print…
…ing, r=oli-obk Fix printing `impl trait` under binders Before, we would render `impl for<'a> Trait<'a>` like `impl Trait<for<'a> 'a>`, lol.
- Loading branch information
Showing
4 changed files
with
166 additions
and
114 deletions.
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
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
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,14 @@ | ||
trait Trait<'a> {} | ||
impl<T> Trait<'_> for T {} | ||
fn whatever() -> impl for<'a> Trait<'a> + for<'b> Trait<'b> {} | ||
|
||
fn whatever2() -> impl for<'c> Fn(&'c ()) { | ||
|_: &()| {} | ||
} | ||
|
||
fn main() { | ||
let x: u32 = whatever(); | ||
//~^ ERROR mismatched types | ||
let x2: u32 = whatever2(); | ||
//~^ ERROR mismatched types | ||
} |
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,31 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/printing-binder.rs:10:18 | ||
| | ||
LL | fn whatever() -> impl for<'a> Trait<'a> + for<'b> Trait<'b> {} | ||
| ------------------------------------------ the found opaque type | ||
... | ||
LL | let x: u32 = whatever(); | ||
| --- ^^^^^^^^^^ expected `u32`, found opaque type | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected type `u32` | ||
found opaque type `impl for<'a> Trait<'a> + for<'b> Trait<'b>` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/printing-binder.rs:12:19 | ||
| | ||
LL | fn whatever2() -> impl for<'c> Fn(&'c ()) { | ||
| ----------------------- the found opaque type | ||
... | ||
LL | let x2: u32 = whatever2(); | ||
| --- ^^^^^^^^^^^ expected `u32`, found opaque type | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected type `u32` | ||
found opaque type `impl for<'c> Fn(&'c ())` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |