forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#123003 - maurer:dyn-empty, r=compiler-errors
CFI: Handle dyn with no principal In user-facing Rust, `dyn` always has at least one predicate following it. Unfortunately, because we filter out marker traits from receivers at callsites and `dyn Sync` is, for example, legal, this results in us having `dyn` types with no predicates on occasion in our alias set encoding. This patch handles cases where there are no predicates in a `dyn` type which are relevant to its alias set. Fixes rust-lang#122998 r? workingjubilee
- Loading branch information
Showing
2 changed files
with
35 additions
and
13 deletions.
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,21 @@ | ||
// Check that dropping a trait object without a principal trait succeeds | ||
|
||
//@ needs-sanitizer-cfi | ||
// FIXME(#122848) Remove only-linux once OSX CFI binaries works | ||
//@ only-linux | ||
//@ compile-flags: --crate-type=bin -Cprefer-dynamic=off -Clto -Zsanitizer=cfi | ||
//@ compile-flags: -C target-feature=-crt-static -C codegen-units=1 -C opt-level=0 | ||
// FIXME(#118761) Should be run-pass once the labels on drop are compatible. | ||
// This test is being landed ahead of that to test that the compiler doesn't ICE while labeling the | ||
// callsite for a drop, but the vtable doesn't have the correct label yet. | ||
//@ build-pass | ||
|
||
struct CustomDrop; | ||
|
||
impl Drop for CustomDrop { | ||
fn drop(&mut self) {} | ||
} | ||
|
||
fn main() { | ||
let _ = Box::new(CustomDrop) as Box<dyn Send>; | ||
} |