rust/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr
Aaron Hill fdd8a0dde5
Don't suggest replacing region with 'static in NLL
Fixes #73159

This is similar to #69350 - if the user didn't initially
write out a 'static lifetime, adding 'static in response to
a lifetime error is usually the wrong thing to do.
2021-10-03 21:53:48 -05:00

11 lines
383 B
Plaintext

error: lifetime may not live long enough
--> $DIR/regions-infer-invariance-due-to-mutability-4.rs:10:5
|
LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
| -- lifetime `'r` defined here
LL | b_isize
| ^^^^^^^ returning this value requires that `'r` must outlive `'static`
error: aborting due to previous error