Access individual fields of tuples, closures and generators on drop.
This commit is contained in:
parent
3c43aa5677
commit
902bc0fb1a
5 changed files with 102 additions and 40 deletions
|
|
@ -6,20 +6,6 @@ LL | for p in &x { //~ ERROR
|
|||
LL | yield();
|
||||
| ------- possible yield occurs here
|
||||
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/yield-while-iterating.rs:50:17
|
||||
|
|
||||
LL | let mut b = || {
|
||||
| _________________^
|
||||
LL | | for p in &mut x {
|
||||
LL | | yield p;
|
||||
LL | | }
|
||||
LL | | };
|
||||
| | ^
|
||||
| | |
|
||||
| |_____temporary value only lives until here
|
||||
| temporary value does not live long enough
|
||||
|
||||
error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
|
||||
--> $DIR/yield-while-iterating.rs:67:20
|
||||
|
|
||||
|
|
@ -35,21 +21,7 @@ LL | println!("{}", x[0]); //~ ERROR
|
|||
LL | b.resume();
|
||||
| - borrow later used here
|
||||
|
||||
error[E0597]: borrowed value does not live long enough
|
||||
--> $DIR/yield-while-iterating.rs:62:17
|
||||
|
|
||||
LL | let mut b = || {
|
||||
| _________________^
|
||||
LL | | for p in &mut x {
|
||||
LL | | yield p;
|
||||
LL | | }
|
||||
LL | | };
|
||||
| | ^
|
||||
| | |
|
||||
| |_____temporary value only lives until here
|
||||
| temporary value does not live long enough
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
Some errors occurred: E0502, E0597, E0626.
|
||||
Some errors occurred: E0502, E0626.
|
||||
For more information about an error, try `rustc --explain E0502`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue