fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.1 KiB45 linesraw
1// run-rustfix
2
3#![allow(warnings)]
4
5fn foo<'a>(d: impl Sized + 'a, p: &'a mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `impl Sized` must be valid for the anonymous lifetime defined here...
6//~^ HELP consider adding an explicit lifetime bound
7    (d, p)
8    //~^ ERROR the parameter type `impl Sized` may not live long enough
9    //~| NOTE ...so that the type `impl Sized` will meet its required lifetime bounds
10}
11
12fn foo1<'b>(d: impl Sized + 'b, p: &'b mut ()) -> impl Sized + '_ {
13//~^ HELP consider adding an explicit lifetime bound...
14    (d, p) //~ NOTE ...so that the type `impl Sized` will meet its required lifetime bounds
15    //~^ ERROR the parameter type `impl Sized` may not live long enough
16}
17
18fn foo2<'b, 'a>(d: impl Sized + 'a + 'b, p: &'b mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `impl Sized + 'a` must be valid for the anonymous lifetime defined here...
19//~^ HELP consider adding an explicit lifetime bound
20    (d, p)
21    //~^ ERROR the parameter type `impl Sized + 'a` may not live long enough
22    //~| NOTE ...so that the type `impl Sized + 'a` will meet its required lifetime bounds
23}
24
25fn bar<'a, T : Sized + 'a>(d: T, p: &'a mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here...
26//~^ HELP consider adding an explicit lifetime bound
27    (d, p)
28    //~^ ERROR the parameter type `T` may not live long enough
29    //~| NOTE ...so that the type `T` will meet its required lifetime bounds
30}
31
32fn bar1<'b, T : Sized + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ {
33//~^ HELP consider adding an explicit lifetime bound...
34    (d, p) //~ NOTE ...so that the type `T` will meet its required lifetime bounds
35    //~^ ERROR the parameter type `T` may not live long enough
36}
37
38fn bar2<'b, 'a, T : Sized + 'a + 'b>(d: T, p: &'b mut ()) -> impl Sized + '_ { //~ NOTE the parameter type `T` must be valid for the anonymous lifetime defined here...
39//~^ HELP consider adding an explicit lifetime bound
40    (d, p)
41    //~^ ERROR the parameter type `T` may not live long enough
42    //~| NOTE ...so that the type `T` will meet its required lifetime bounds
43}
44
45fn main() {}