fork/rust

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

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
2.2 KiB49 linesraw
1error[E0261]: use of undeclared lifetime name `'a`
2  --> $DIR/fn-missing-lifetime-in-item.rs:1:33
3   |
4LL | struct S1<F: Fn(&i32, &i32) -> &'a i32>(F);
5   |                                 ^^ undeclared lifetime
6   |
7   = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
8help: consider introducing lifetime `'a` here
9   |
10LL | struct S1<'a, F: Fn(&i32, &i32) -> &'a i32>(F);
11   |           ^^^
12help: consider making the bound lifetime-generic with a new `'a` lifetime
13   |
14LL | struct S1<F: for<'a> Fn(&i32, &i32) -> &'a i32>(F);
15   |              ^^^^^^^
16
17error[E0106]: missing lifetime specifier
18  --> $DIR/fn-missing-lifetime-in-item.rs:2:32
19   |
20LL | struct S2<F: Fn(&i32, &i32) -> &i32>(F);
21   |                 ----  ----     ^ expected named lifetime parameter
22   |
23   = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2
24   = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
25help: consider making the bound lifetime-generic with a new `'a` lifetime
26   |
27LL | struct S2<F: for<'a> Fn(&'a i32, &'a i32) -> &'a i32>(F);
28   |              ^^^^^^^    ^^^^^^^  ^^^^^^^     ^^^
29help: consider introducing a named lifetime parameter
30   |
31LL | struct S2<'a, F: Fn(&'a i32, &'a i32) -> &'a i32>(F);
32   |           ^^^       ^^^^^^^  ^^^^^^^     ^^^
33
34error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
35  --> $DIR/fn-missing-lifetime-in-item.rs:3:40
36   |
37LL | struct S3<F: for<'a> Fn(&i32, &i32) -> &'a i32>(F);
38   |                                        ^^^^^^^
39
40error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
41  --> $DIR/fn-missing-lifetime-in-item.rs:6:55
42   |
43LL | const C: Option<Box<dyn for<'a> Fn(&usize, &usize) -> &'a usize>> = None;
44   |                                                       ^^^^^^^^^
45
46error: aborting due to 4 previous errors
47
48Some errors have detailed explanations: E0106, E0261, E0582.
49For more information about an error, try `rustc --explain E0106`.