e4dfb7013b
compile-fail does not do validation yet
20 lines
434 B
Rust
20 lines
434 B
Rust
// FIXME validation disabled because ptr::read uses mem::uninitialized
|
|
// compile-flags: -Zmiri-disable-validation
|
|
|
|
struct Bar;
|
|
|
|
static mut DROP_COUNT: usize = 0;
|
|
|
|
impl Drop for Bar {
|
|
fn drop(&mut self) {
|
|
unsafe { DROP_COUNT += 1; }
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let b: Box<[Bar]> = vec![Bar, Bar, Bar, Bar].into_boxed_slice();
|
|
assert_eq!(unsafe { DROP_COUNT }, 0);
|
|
drop(b);
|
|
assert_eq!(unsafe { DROP_COUNT }, 4);
|
|
}
|