about summary refs log tree commit diff
path: root/tests/ui/cast/unsized-union-ice.rs
blob: 11aefe57f1dfbc6929d5b6ac771e71841342420f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Regression test for https://github.com/rust-lang/rust/issues/122581
// This used to ICE, because the union was unsized and the pointer casting code
// assumed that non-struct ADTs must be sized.

union Union {
    val: std::mem::ManuallyDrop<[u8]>,
    //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
}

fn cast(ptr: *const ()) -> *const Union {
    ptr as _
}

fn main() {}