|
| 1 | +error[E0716]: temporary value dropped while borrowed |
| 2 | + --> $DIR/let_underscore_temporary.rs:10:14 |
| 3 | + | |
| 4 | +LL | let _ = if let Some(s) = &mut num { |
| 5 | + | _____________- |
| 6 | +LL | | *s += 1; |
| 7 | +LL | | s |
| 8 | +LL | | } else { |
| 9 | +LL | | &mut 0 |
| 10 | + | | ^ creates a temporary value which is freed while still in use |
| 11 | +LL | | |
| 12 | +LL | | }; |
| 13 | + | | - |
| 14 | + | | | |
| 15 | + | |_____temporary value is freed at the end of this statement |
| 16 | + | borrow later used here |
| 17 | + | |
| 18 | + = note: consider using a `let` binding to create a longer lived value |
| 19 | + |
| 20 | +error[E0716]: temporary value dropped while borrowed |
| 21 | + --> $DIR/let_underscore_temporary.rs:24:14 |
| 22 | + | |
| 23 | +LL | let _ = if let Some(ref mut s) = num { |
| 24 | + | _____________- |
| 25 | +LL | | *s += 1; |
| 26 | +LL | | s |
| 27 | +LL | | } else { |
| 28 | +LL | | &mut 0 |
| 29 | + | | ^ creates a temporary value which is freed while still in use |
| 30 | +LL | | |
| 31 | +LL | | }; |
| 32 | + | | - |
| 33 | + | | | |
| 34 | + | |_____temporary value is freed at the end of this statement |
| 35 | + | borrow later used here |
| 36 | + | |
| 37 | + = note: consider using a `let` binding to create a longer lived value |
| 38 | + |
| 39 | +error[E0716]: temporary value dropped while borrowed |
| 40 | + --> $DIR/let_underscore_temporary.rs:36:14 |
| 41 | + | |
| 42 | +LL | let _: _ = if let Some(s) = &mut num { |
| 43 | + | ________________- |
| 44 | +LL | | *s += 1; |
| 45 | +LL | | s |
| 46 | +LL | | } else { |
| 47 | +LL | | &mut 0 |
| 48 | + | | ^ creates a temporary value which is freed while still in use |
| 49 | +LL | | |
| 50 | +LL | | }; |
| 51 | + | | - |
| 52 | + | | | |
| 53 | + | |_____temporary value is freed at the end of this statement |
| 54 | + | borrow later used here |
| 55 | + | |
| 56 | + = note: consider using a `let` binding to create a longer lived value |
| 57 | + |
| 58 | +error[E0716]: temporary value dropped while borrowed |
| 59 | + --> $DIR/let_underscore_temporary.rs:50:14 |
| 60 | + | |
| 61 | +LL | let _: _ = if let Some(ref mut s) = num { |
| 62 | + | ________________- |
| 63 | +LL | | *s += 1; |
| 64 | +LL | | s |
| 65 | +LL | | } else { |
| 66 | +LL | | &mut 0 |
| 67 | + | | ^ creates a temporary value which is freed while still in use |
| 68 | +LL | | |
| 69 | +LL | | }; |
| 70 | + | | - |
| 71 | + | | | |
| 72 | + | |_____temporary value is freed at the end of this statement |
| 73 | + | borrow later used here |
| 74 | + | |
| 75 | + = note: consider using a `let` binding to create a longer lived value |
| 76 | + |
| 77 | +error: aborting due to 4 previous errors |
| 78 | + |
| 79 | +For more information about this error, try `rustc --explain E0716`. |
0 commit comments