Fix pretty printing of placeholder types

This commit is contained in:
Michael Goulet 2025-06-25 17:07:18 +00:00
parent 74570e526e
commit d79b669b09
8 changed files with 41 additions and 36 deletions

View file

@ -7,19 +7,19 @@ LL | #![feature(non_lifetime_binders)]
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0310]: the placeholder type `!1_"T"` may not live long enough
error[E0310]: the placeholder type `T` may not live long enough
--> $DIR/placeholders-dont-outlive-static.rs:13:5
|
LL | foo();
| ^^^^^
| |
| the placeholder type `!1_"T"` must be valid for the static lifetime...
| the placeholder type `T` must be valid for the static lifetime...
| ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
LL | fn bad() where !1_"T": 'static {
| +++++++++++++++++++++
LL | fn bad() where T: 'static {
| ++++++++++++++++
error: aborting due to 1 previous error; 1 warning emitted

View file

@ -7,19 +7,19 @@ LL | #![feature(non_lifetime_binders)]
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0310]: the placeholder type `!1_"T"` may not live long enough
error[E0310]: the placeholder type `T` may not live long enough
--> $DIR/placeholders-dont-outlive-static.rs:19:5
|
LL | foo();
| ^^^^^
| |
| the placeholder type `!1_"T"` must be valid for the static lifetime...
| the placeholder type `T` must be valid for the static lifetime...
| ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
LL | fn good() where for<T> T: 'static, !1_"T": 'static {
| +++++++++++++++++
LL | fn good() where for<T> T: 'static, T: 'static {
| ++++++++++++
error: aborting due to 1 previous error; 1 warning emitted

View file

@ -11,7 +11,7 @@ fn foo() where for<T> T: 'static {}
#[cfg(bad)]
fn bad() {
foo();
//[bad]~^ ERROR the placeholder type `!1_"T"` may not live long enough
//[bad]~^ ERROR the placeholder type `T` may not live long enough
}
#[cfg(good)]

View file

@ -7,11 +7,11 @@ LL | #![feature(non_lifetime_binders)]
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0309]: the placeholder type `!1_"F"` may not live long enough
error[E0309]: the placeholder type `F` may not live long enough
--> $DIR/type-match-with-late-bound.rs:8:1
|
LL | async fn walk2<'a, T: 'a>(_: T)
| ^ -- the placeholder type `!1_"F"` must be valid for the lifetime `'a` as defined here...
| ^ -- the placeholder type `F` must be valid for the lifetime `'a` as defined here...
| _|
| |
LL | | where
@ -25,36 +25,37 @@ LL | for<F> F: 'a,
| ^^
help: consider adding an explicit lifetime bound
|
LL | for<F> F: 'a, !1_"F": 'a
| ++++++++++
LL | for<F> F: 'a, F: 'a
| +++++
error[E0309]: the placeholder type `!1_"F"` may not live long enough
error[E0309]: the placeholder type `F` may not live long enough
--> $DIR/type-match-with-late-bound.rs:11:1
|
LL | async fn walk2<'a, T: 'a>(_: T)
| -- the placeholder type `!1_"F"` must be valid for the lifetime `'a` as defined here...
| -- the placeholder type `F` must be valid for the lifetime `'a` as defined here...
...
LL | {}
| ^^ ...so that the type `F` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
LL | for<F> F: 'a, !1_"F": 'a
| ++++++++++
LL | for<F> F: 'a, F: 'a
| +++++
error[E0309]: the placeholder type `!2_"F"` may not live long enough
error[E0309]: the placeholder type `F` may not live long enough
--> $DIR/type-match-with-late-bound.rs:11:1
|
LL | async fn walk2<'a, T: 'a>(_: T)
| -- the placeholder type `!2_"F"` must be valid for the lifetime `'a` as defined here...
| -- the placeholder type `F` must be valid for the lifetime `'a` as defined here...
...
LL | {}
| ^^ ...so that the type `F` will meet its required lifetime bounds
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider adding an explicit lifetime bound
|
LL | for<F> F: 'a, !2_"F": 'a
| ++++++++++
LL | for<F> F: 'a, F: 'a
| +++++
error: aborting due to 3 previous errors; 1 warning emitted