|
| 1 | +error[E0597]: `a` does not live long enough |
| 2 | + --> $DIR/location-insensitive-scopes-issue-117146.rs:10:18 |
| 3 | + | |
| 4 | +LL | let b = |_| &a; |
| 5 | + | --- -^ |
| 6 | + | | || |
| 7 | + | | |borrowed value does not live long enough |
| 8 | + | | returning this value requires that `a` is borrowed for `'static` |
| 9 | + | value captured here |
| 10 | +... |
| 11 | +LL | } |
| 12 | + | - `a` dropped here while still borrowed |
| 13 | + | |
| 14 | +note: due to current limitations in the borrow checker, this implies a `'static` lifetime |
| 15 | + --> $DIR/location-insensitive-scopes-issue-117146.rs:20:22 |
| 16 | + | |
| 17 | +LL | fn bad<F: Fn(&()) -> &()>(_: F) {} |
| 18 | + | ^^^ |
| 19 | + |
| 20 | +error: implementation of `Fn` is not general enough |
| 21 | + --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5 |
| 22 | + | |
| 23 | +LL | bad(&b); |
| 24 | + | ^^^^^^^ implementation of `Fn` is not general enough |
| 25 | + | |
| 26 | + = note: closure with signature `fn(&'2 ()) -> &()` must implement `Fn<(&'1 (),)>`, for any lifetime `'1`... |
| 27 | + = note: ...but it actually implements `Fn<(&'2 (),)>`, for some specific lifetime `'2` |
| 28 | + |
| 29 | +error: implementation of `FnOnce` is not general enough |
| 30 | + --> $DIR/location-insensitive-scopes-issue-117146.rs:13:5 |
| 31 | + | |
| 32 | +LL | bad(&b); |
| 33 | + | ^^^^^^^ implementation of `FnOnce` is not general enough |
| 34 | + | |
| 35 | + = note: closure with signature `fn(&'2 ()) -> &()` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... |
| 36 | + = note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` |
| 37 | + |
| 38 | +error: aborting due to 3 previous errors |
| 39 | + |
| 40 | +For more information about this error, try `rustc --explain E0597`. |
0 commit comments