summaryrefslogtreecommitdiffstats
path: root/src/test/ui/issues/issue-17302.rs
blob: cf7a2f1b0631a977be19089e4bc5976cd83bf3f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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]);
    }
}