about summary refs log tree commit diff
path: root/tests/ui/union/union-inherent-method.rs
blob: a3f962fb87211688b48041cbd0985292b4feca4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//@ run-pass

union U {
    a: u8,
}

impl U {
    fn method(&self) -> u8 { unsafe { self.a } }
}

fn main() {
    let u = U { a: 10 };
    assert_eq!(u.method(), 10);
}