Adjust anonymous-higher-ranked-lifetime.rs

- Document `anonymous-higher-ranked-lifetime.rs`
- Move `anonymous-higher-ranked-lifetime.rs` to `tests/ui/higher-ranked`
This commit is contained in:
Jieyou Xu 2024-12-05 08:21:41 +00:00 committed by 许杰友 Jieyou Xu (Joe)
parent b5c7a55250
commit d734d22bd8
2 changed files with 28 additions and 22 deletions

View File

@ -1,3 +1,9 @@
//! Diagnostics test to check that higher-ranked lifetimes are properly named when being pretty
//! printed in diagnostics.
//!
//! Issue: <https://github.com/rust-lang/rust/issues/44887>
//! PR: <https://github.com/rust-lang/rust/pull/44888>
fn main() {
f1(|_: (), _: ()| {}); //~ ERROR type mismatch
f2(|_: (), _: ()| {}); //~ ERROR type mismatch

View File

@ -1,5 +1,5 @@
error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:2:5
--> $DIR/anonymous-higher-ranked-lifetime.rs:8:5
|
LL | f1(|_: (), _: ()| {});
| ^^^--------------^^^^
@ -10,7 +10,7 @@ LL | f1(|_: (), _: ()| {});
= note: expected closure signature `for<'a, 'b> fn(&'a (), &'b ()) -> _`
found closure signature `fn((), ()) -> _`
note: required by a bound in `f1`
--> $DIR/anonymous-higher-ranked-lifetime.rs:16:25
--> $DIR/anonymous-higher-ranked-lifetime.rs:22:25
|
LL | fn f1<F>(_: F) where F: Fn(&(), &()) {}
| ^^^^^^^^^^^^ required by this bound in `f1`
@ -20,7 +20,7 @@ LL | f1(|_: &(), _: &()| {});
| + +
error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:3:5
--> $DIR/anonymous-higher-ranked-lifetime.rs:9:5
|
LL | f2(|_: (), _: ()| {});
| ^^^--------------^^^^
@ -31,7 +31,7 @@ LL | f2(|_: (), _: ()| {});
= note: expected closure signature `for<'a, 'b> fn(&'a (), &'b ()) -> _`
found closure signature `fn((), ()) -> _`
note: required by a bound in `f2`
--> $DIR/anonymous-higher-ranked-lifetime.rs:17:25
--> $DIR/anonymous-higher-ranked-lifetime.rs:23:25
|
LL | fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f2`
@ -41,7 +41,7 @@ LL | f2(|_: &(), _: &()| {});
| + +
error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:4:5
--> $DIR/anonymous-higher-ranked-lifetime.rs:10:5
|
LL | f3(|_: (), _: ()| {});
| ^^^--------------^^^^
@ -52,7 +52,7 @@ LL | f3(|_: (), _: ()| {});
= note: expected closure signature `for<'a> fn(&(), &'a ()) -> _`
found closure signature `fn((), ()) -> _`
note: required by a bound in `f3`
--> $DIR/anonymous-higher-ranked-lifetime.rs:18:29
--> $DIR/anonymous-higher-ranked-lifetime.rs:24:29
|
LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {}
| ^^^^^^^^^^^^^^^ required by this bound in `f3`
@ -62,7 +62,7 @@ LL | f3(|_: &(), _: &()| {});
| + +
error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:5:5
--> $DIR/anonymous-higher-ranked-lifetime.rs:11:5
|
LL | f4(|_: (), _: ()| {});
| ^^^--------------^^^^
@ -73,7 +73,7 @@ LL | f4(|_: (), _: ()| {});
= note: expected closure signature `for<'a, 'r> fn(&'a (), &'r ()) -> _`
found closure signature `fn((), ()) -> _`
note: required by a bound in `f4`
--> $DIR/anonymous-higher-ranked-lifetime.rs:19:25
--> $DIR/anonymous-higher-ranked-lifetime.rs:25:25
|
LL | fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f4`
@ -83,7 +83,7 @@ LL | f4(|_: &(), _: &()| {});
| + +
error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:6:5
--> $DIR/anonymous-higher-ranked-lifetime.rs:12:5
|
LL | f5(|_: (), _: ()| {});
| ^^^--------------^^^^
@ -94,7 +94,7 @@ LL | f5(|_: (), _: ()| {});
= note: expected closure signature `for<'r> fn(&'r (), &'r ()) -> _`
found closure signature `fn((), ()) -> _`
note: required by a bound in `f5`
--> $DIR/anonymous-higher-ranked-lifetime.rs:20:25
--> $DIR/anonymous-higher-ranked-lifetime.rs:26:25
|
LL | fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f5`
@ -104,7 +104,7 @@ LL | f5(|_: &(), _: &()| {});
| + +
error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:7:5
--> $DIR/anonymous-higher-ranked-lifetime.rs:13:5
|
LL | g1(|_: (), _: ()| {});
| ^^^--------------^^^^
@ -115,7 +115,7 @@ LL | g1(|_: (), _: ()| {});
= note: expected closure signature `for<'a> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>) -> _`
found closure signature `fn((), ()) -> _`
note: required by a bound in `g1`
--> $DIR/anonymous-higher-ranked-lifetime.rs:23:25
--> $DIR/anonymous-higher-ranked-lifetime.rs:29:25
|
LL | fn g1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g1`
@ -125,7 +125,7 @@ LL | g1(|_: &(), _: ()| {});
| +
error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:8:5
--> $DIR/anonymous-higher-ranked-lifetime.rs:14:5
|
LL | g2(|_: (), _: ()| {});
| ^^^--------------^^^^
@ -136,7 +136,7 @@ LL | g2(|_: (), _: ()| {});
= note: expected closure signature `for<'a> fn(&'a (), for<'a> fn(&'a ())) -> _`
found closure signature `fn((), ()) -> _`
note: required by a bound in `g2`
--> $DIR/anonymous-higher-ranked-lifetime.rs:24:25
--> $DIR/anonymous-higher-ranked-lifetime.rs:30:25
|
LL | fn g2<F>(_: F) where F: Fn(&(), fn(&())) {}
| ^^^^^^^^^^^^^^^^ required by this bound in `g2`
@ -146,7 +146,7 @@ LL | g2(|_: &(), _: ()| {});
| +
error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:9:5
--> $DIR/anonymous-higher-ranked-lifetime.rs:15:5
|
LL | g3(|_: (), _: ()| {});
| ^^^--------------^^^^
@ -157,7 +157,7 @@ LL | g3(|_: (), _: ()| {});
= note: expected closure signature `for<'s> fn(&'s (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>) -> _`
found closure signature `fn((), ()) -> _`
note: required by a bound in `g3`
--> $DIR/anonymous-higher-ranked-lifetime.rs:25:25
--> $DIR/anonymous-higher-ranked-lifetime.rs:31:25
|
LL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<dyn Fn(&())>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g3`
@ -167,7 +167,7 @@ LL | g3(|_: &(), _: ()| {});
| +
error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:10:5
--> $DIR/anonymous-higher-ranked-lifetime.rs:16:5
|
LL | g4(|_: (), _: ()| {});
| ^^^--------------^^^^
@ -178,7 +178,7 @@ LL | g4(|_: (), _: ()| {});
= note: expected closure signature `for<'a> fn(&'a (), for<'r> fn(&'r ())) -> _`
found closure signature `fn((), ()) -> _`
note: required by a bound in `g4`
--> $DIR/anonymous-higher-ranked-lifetime.rs:26:25
--> $DIR/anonymous-higher-ranked-lifetime.rs:32:25
|
LL | fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g4`
@ -188,7 +188,7 @@ LL | g4(|_: &(), _: ()| {});
| +
error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:11:5
--> $DIR/anonymous-higher-ranked-lifetime.rs:17:5
|
LL | h1(|_: (), _: (), _: (), _: ()| {});
| ^^^----------------------------^^^^
@ -199,7 +199,7 @@ LL | h1(|_: (), _: (), _: (), _: ()| {});
= note: expected closure signature `for<'a, 'b> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'b (), for<'a, 'b> fn(&'a (), &'b ())) -> _`
found closure signature `fn((), (), (), ()) -> _`
note: required by a bound in `h1`
--> $DIR/anonymous-higher-ranked-lifetime.rs:29:25
--> $DIR/anonymous-higher-ranked-lifetime.rs:35:25
|
LL | fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h1`
@ -209,7 +209,7 @@ LL | h1(|_: &(), _: (), _: &(), _: ()| {});
| + +
error[E0631]: type mismatch in closure arguments
--> $DIR/anonymous-higher-ranked-lifetime.rs:12:5
--> $DIR/anonymous-higher-ranked-lifetime.rs:18:5
|
LL | h2(|_: (), _: (), _: (), _: ()| {});
| ^^^----------------------------^^^^
@ -220,7 +220,7 @@ LL | h2(|_: (), _: (), _: (), _: ()| {});
= note: expected closure signature `for<'a, 't0> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ())) -> _`
found closure signature `fn((), (), (), ()) -> _`
note: required by a bound in `h2`
--> $DIR/anonymous-higher-ranked-lifetime.rs:30:25
--> $DIR/anonymous-higher-ranked-lifetime.rs:36:25
|
LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(), &())) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h2`