]> git.lizzy.rs Git - rust.git/blob - src/test/ui/in-band-lifetimes/mismatched.nll.stderr
Rollup merge of #53110 - Xanewok:save-analysis-remap-path, r=nrc
[rust.git] / src / test / ui / in-band-lifetimes / mismatched.nll.stderr
1 warning: not reporting region error due to nll
2   --> $DIR/mismatched.rs:14:42
3    |
4 LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required
5    |                                          ^
6
7 warning: not reporting region error due to nll
8   --> $DIR/mismatched.rs:16:46
9    |
10 LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch
11    |                                              ^
12
13 error[E0621]: explicit lifetime required in the type of `y`
14   --> $DIR/mismatched.rs:14:42
15    |
16 LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required
17    |                       ----               ^ lifetime `'a` required
18    |                       |
19    |                       help: add explicit lifetime `'a` to the type of `y`: `&'a u32`
20
21 error: unsatisfied lifetime constraints
22   --> $DIR/mismatched.rs:16:46
23    |
24 LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch
25    |             --          --                   ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
26    |             |           |
27    |             |           lifetime `'b` defined here
28    |             lifetime `'a` defined here
29
30 error: aborting due to 2 previous errors
31
32 For more information about this error, try `rustc --explain E0621`.