mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
0b860818e6
Fix drop and drop_in_place by transforming self of drop and drop_in_place methods into Drop trait objects.
21 lines
491 B
Rust
21 lines
491 B
Rust
// Verifies that drops can be called on arbitrary trait objects.
|
|
//
|
|
// FIXME(#122848): Remove only-linux when fixed.
|
|
//@ only-linux
|
|
//@ needs-sanitizer-cfi
|
|
//@ compile-flags: -Clto -Copt-level=0 -Cprefer-dynamic=off -Ctarget-feature=-crt-static -Zsanitizer=cfi
|
|
//@ 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>;
|
|
}
|