fork/rust

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

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

1.42.0
1.0 KiB24 linesraw
1error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the data it references
2  --> $DIR/regions-free-region-ordering-callee-4.rs:5:1
3   |
4LL | / fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) {
5LL | |
6LL | |     // Do not infer ordering from closure argument types.
7LL | |     let z: Option<&'a &'b usize> = None;
8LL | | }
9   | |_^
10   |
11note: the pointer is valid for the lifetime `'a` as defined on the function body at 5:14
12  --> $DIR/regions-free-region-ordering-callee-4.rs:5:14
13   |
14LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) {
15   |              ^^
16note: but the referenced data is only valid for the lifetime `'b` as defined on the function body at 5:18
17  --> $DIR/regions-free-region-ordering-callee-4.rs:5:18
18   |
19LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) {
20   |                  ^^
21
22error: aborting due to previous error
23
24For more information about this error, try `rustc --explain E0491`.