Ensure upvars are dropped when generators have never been resumed
This commit is contained in:
parent
facabcb85e
commit
075fd364d0
3 changed files with 118 additions and 48 deletions
|
|
@ -13,5 +13,5 @@
|
|||
fn main() {
|
||||
let gen = |start| { //~ ERROR generators cannot have explicit arguments
|
||||
yield;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ fn t2() {
|
|||
|
||||
fn t3() {
|
||||
let b = B;
|
||||
let mut foo = || {
|
||||
let foo = || {
|
||||
let _: () = gen arg; // TODO: this line should not be necessary
|
||||
yield;
|
||||
drop(b);
|
||||
|
|
@ -67,7 +67,5 @@ fn t3() {
|
|||
let n = A.load(Ordering::SeqCst);
|
||||
assert_eq!(A.load(Ordering::SeqCst), n);
|
||||
drop(foo);
|
||||
// TODO: we should assert n+1 here, not n
|
||||
// assert_eq!(A.load(Ordering::SeqCst), n + 1);
|
||||
assert_eq!(A.load(Ordering::SeqCst), n);
|
||||
assert_eq!(A.load(Ordering::SeqCst), n + 1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue