diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/issues/issue-17302.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-17302.rs b/src/test/ui/issues/issue-17302.rs new file mode 100644 index 000000000..cf7a2f1b0 --- /dev/null +++ b/src/test/ui/issues/issue-17302.rs @@ -0,0 +1,26 @@ +// run-pass + +static mut DROPPED: [bool; 2] = [false, false]; + +struct A(usize); +struct Foo { _a: A, _b: isize } + +impl Drop for A { + fn drop(&mut self) { + let A(i) = *self; + unsafe { DROPPED[i] = true; } + } +} + +fn main() { + { + Foo { + _a: A(0), + ..Foo { _a: A(1), _b: 2 } + }; + } + unsafe { + assert!(DROPPED[0]); + assert!(DROPPED[1]); + } +} |