fork/rust

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

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

master
2.1 KiB48 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 making the bound lifetime-generic with a new `'a` lifetime
9   |
10LL | struct S1<F: for<'a> Fn(&i32, &i32) -> &'a i32>(F);
11   |              +++++++
12help: consider introducing lifetime `'a` here
13   |
14LL | struct S1<'a, F: 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
24help: consider making the bound lifetime-generic with a new `'a` lifetime
25   |
26LL | struct S2<F: for<'a> Fn(&'a i32, &'a i32) -> &'a i32>(F);
27   |              +++++++     ++       ++          ++
28help: consider introducing a named lifetime parameter
29   |
30LL | struct S2<'a, F: Fn(&'a i32, &'a i32) -> &'a i32>(F);
31   |           +++        ++       ++          ++
32
33error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
34  --> $DIR/fn-missing-lifetime-in-item.rs:3:40
35   |
36LL | struct S3<F: for<'a> Fn(&i32, &i32) -> &'a i32>(F);
37   |                                        ^^^^^^^
38
39error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
40  --> $DIR/fn-missing-lifetime-in-item.rs:6:55
41   |
42LL | const C: Option<Box<dyn for<'a> Fn(&usize, &usize) -> &'a usize>> = None;
43   |                                                       ^^^^^^^^^
44
45error: aborting due to 4 previous errors
46
47Some errors have detailed explanations: E0106, E0261, E0582.
48For more information about an error, try `rustc --explain E0106`.