Skip to content

Commit 156173f

Browse files
committed
Add tests for overlapping explicitly dropped locals in generators
1 parent 4b65a86 commit 156173f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/test/run-pass/generator/size-moved-locals.rs

+12
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,20 @@ fn overlap_move_points() -> impl Generator<Yield = (), Return = ()> {
5555
}
5656
}
5757

58+
fn overlap_x_and_y() -> impl Generator<Yield = (), Return = ()>{
59+
static || {
60+
let x = [0u8; 1024];
61+
yield;
62+
drop(x);
63+
let y = [0u8;1024];
64+
yield;
65+
drop(y);
66+
}
67+
}
68+
5869
fn main() {
5970
assert_eq!(1028, std::mem::size_of_val(&move_before_yield()));
6071
assert_eq!(1032, std::mem::size_of_val(&move_before_yield_with_noop()));
6172
assert_eq!(2056, std::mem::size_of_val(&overlap_move_points()));
73+
assert_eq!(2052, std::mem::size_of_val(&overlap_x_and_y()));
6274
}

0 commit comments

Comments
 (0)