fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[E0597]: `y` does not live long enough 2 --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:10:5 3 | 4LL | let y = x; 5 | - binding `y` declared here 6LL | y.borrow().clone() 7 | ^--------- 8 | | 9 | borrowed value does not live long enough 10 | a temporary with access to the borrow is created here ... 11LL | } 12 | - 13 | | 14 | `y` dropped here while still borrowed 15 | ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `Ref<'_, String>` 16 | 17 = note: the temporary is part of an expression at the end of a block; 18 consider forcing this temporary to be dropped sooner, before the block's local variables are dropped 19help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block 20 | 21LL | let x = y.borrow().clone(); x 22 | +++++++ +++ 23 24error[E0597]: `y` does not live long enough 25 --> $DIR/issue-23338-locals-die-before-temps-of-body.rs:17:9 26 | 27LL | let y = x; 28 | - binding `y` declared here 29LL | y.borrow().clone() 30 | ^--------- 31 | | 32 | borrowed value does not live long enough 33 | a temporary with access to the borrow is created here ... 34LL | }; 35 | -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for type `Ref<'_, String>` 36 | | 37 | `y` dropped here while still borrowed 38 | 39 = note: the temporary is part of an expression at the end of a block; 40 consider forcing this temporary to be dropped sooner, before the block's local variables are dropped 41help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block 42 | 43LL | let x = y.borrow().clone(); x 44 | +++++++ +++ 45 46error: aborting due to 2 previous errors 47 48For more information about this error, try `rustc --explain E0597`.