about summary refs log tree commit diff
path: root/tests/ui/sanitizer/cfi/drop-in-place.rs
blob: fe59d546312482c89692438ef1835bdc790fbfb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Verifies that drops can be called on arbitrary trait objects.
//
// FIXME(#122848): Remove only-linux when fixed.
//@ only-linux
//@ ignore-backends: gcc
//@ needs-sanitizer-cfi
//@ compile-flags: -Clto -Copt-level=0 -Cprefer-dynamic=off -Ctarget-feature=-crt-static -Zsanitizer=cfi
//@ compile-flags: -C unsafe-allow-abi-mismatch=sanitizer
//@ run-pass

struct EmptyDrop;

struct NonEmptyDrop;

impl Drop for NonEmptyDrop {
    fn drop(&mut self) {}
}

fn main() {
    let _ = Box::new(EmptyDrop) as Box<dyn Send>;
    let _ = Box::new(NonEmptyDrop) as Box<dyn Send>;
}