rust/src/test/ui/regions/regions-creating-enums.stderr

34 lines
1.4 KiB
Plaintext
Raw Normal View History

2018-08-08 07:28:26 -05:00
error[E0597]: borrowed value does not live long enough
2018-12-25 09:56:47 -06:00
--> $DIR/regions-creating-enums.rs:23:17
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | return &Ast::Num((*f)(x));
2018-08-08 07:28:26 -05:00
| ^^^^^^^^^^^^^^^^^- temporary value only lives until here
| |
| temporary value does not live long enough
|
2018-12-25 09:56:47 -06:00
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 20:13...
--> $DIR/regions-creating-enums.rs:20:13
2018-08-08 07:28:26 -05:00
|
LL | fn map_nums<'a,'b, F>(x: &Ast, f: &mut F) -> &'a Ast<'b> where F: FnMut(usize) -> usize {
2018-08-08 07:28:26 -05:00
| ^^
= note: consider using a `let` binding to increase its lifetime
error[E0597]: borrowed value does not live long enough
2018-12-25 09:56:47 -06:00
--> $DIR/regions-creating-enums.rs:28:17
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | return &Ast::Add(m_x, m_y);
2018-08-08 07:28:26 -05:00
| ^^^^^^^^^^^^^^^^^^- temporary value only lives until here
| |
| temporary value does not live long enough
|
2018-12-25 09:56:47 -06:00
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 20:13...
--> $DIR/regions-creating-enums.rs:20:13
2018-08-08 07:28:26 -05:00
|
LL | fn map_nums<'a,'b, F>(x: &Ast, f: &mut F) -> &'a Ast<'b> where F: FnMut(usize) -> usize {
2018-08-08 07:28:26 -05:00
| ^^
= note: consider using a `let` binding to increase its lifetime
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0597`.