-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CFI: Erase regions when projecting ADT to its transparent non-1zst field
- Loading branch information
1 parent
a73bc4a
commit c8ae02f
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//@ needs-sanitizer-cfi | ||
//@ compile-flags: -Ccodegen-units=1 -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi | ||
//@ no-prefer-dynamic | ||
//@ only-x86_64-unknown-linux-gnu | ||
//@ build-pass | ||
|
||
pub trait Trait {} | ||
|
||
impl Trait for i32 {} | ||
|
||
#[repr(transparent)] | ||
struct BoxedTrait(Box<dyn Trait + 'static>); | ||
|
||
fn hello(x: BoxedTrait) {} | ||
|
||
fn main() { | ||
hello(BoxedTrait(Box::new(1))); | ||
} |