Skip to content

Commit

Permalink
Add tests for overlapping explicitly dropped locals in generators
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Jul 16, 2019
1 parent 4b65a86 commit 156173f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/run-pass/generator/size-moved-locals.rs
Expand Up @@ -55,8 +55,20 @@ fn overlap_move_points() -> impl Generator<Yield = (), Return = ()> {
}
}

fn overlap_x_and_y() -> impl Generator<Yield = (), Return = ()>{
static || {
let x = [0u8; 1024];
yield;
drop(x);
let y = [0u8;1024];
yield;
drop(y);
}
}

fn main() {
assert_eq!(1028, std::mem::size_of_val(&move_before_yield()));
assert_eq!(1032, std::mem::size_of_val(&move_before_yield_with_noop()));
assert_eq!(2056, std::mem::size_of_val(&overlap_move_points()));
assert_eq!(2052, std::mem::size_of_val(&overlap_x_and_y()));
}

0 comments on commit 156173f

Please sign in to comment.