|
| 1 | +error[E0521]: borrowed data escapes outside of function |
| 2 | + --> $DIR/fn-item-check-type-params.rs:31:5 |
| 3 | + | |
| 4 | +LL | pub fn test_call<'a>(val: &'a str) { |
| 5 | + | -- --- `val` is a reference that is only valid in the function body |
| 6 | + | | |
| 7 | + | lifetime `'a` defined here |
| 8 | +LL | extend_lt(val); |
| 9 | + | ^^^^^^^^^^^^^^ |
| 10 | + | | |
| 11 | + | `val` escapes the function body here |
| 12 | + | argument requires that `'a` must outlive `'static` |
| 13 | + |
| 14 | +error: lifetime may not live long enough |
| 15 | + --> $DIR/fn-item-check-type-params.rs:39:12 |
| 16 | + | |
| 17 | +LL | pub fn test_coercion<'a>() { |
| 18 | + | -- lifetime `'a` defined here |
| 19 | +LL | let _: fn(&'a str) -> _ = extend_lt; |
| 20 | + | ^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` |
| 21 | + |
| 22 | +error[E0716]: temporary value dropped while borrowed |
| 23 | + --> $DIR/fn-item-check-type-params.rs:48:11 |
| 24 | + | |
| 25 | +LL | want(&String::new(), extend_lt); |
| 26 | + | ------^^^^^^^^^^^^^------------- temporary value is freed at the end of this statement |
| 27 | + | | | |
| 28 | + | | creates a temporary which is freed while still in use |
| 29 | + | argument requires that borrow lasts for `'static` |
| 30 | + |
| 31 | +error[E0716]: temporary value dropped while borrowed |
| 32 | + --> $DIR/fn-item-check-type-params.rs:54:26 |
| 33 | + | |
| 34 | +LL | let val = extend_lt(&String::from("blah blah blah")); |
| 35 | + | -----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-- temporary value is freed at the end of this statement |
| 36 | + | | | |
| 37 | + | | creates a temporary which is freed while still in use |
| 38 | + | argument requires that borrow lasts for `'static` |
| 39 | + |
| 40 | +error: aborting due to 4 previous errors |
| 41 | + |
| 42 | +Some errors have detailed explanations: E0521, E0716. |
| 43 | +For more information about an error, try `rustc --explain E0521`. |
0 commit comments