diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-09-25 10:09:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-25 10:09:23 +0200 |
| commit | 0e439090cbb17d19b985e9557d1ae23b68eb9624 (patch) | |
| tree | d03a32e5fb9fd623b5c72874c7f82fa7213de796 /tests | |
| parent | 5b727870fa72146a465dcfd9407596b7205b83d2 (diff) | |
| parent | 16093faea8a004832053146f2299b4aed6990fa0 (diff) | |
| download | rust-0e439090cbb17d19b985e9557d1ae23b68eb9624.tar.gz rust-0e439090cbb17d19b985e9557d1ae23b68eb9624.zip | |
Rollup merge of #130734 - Luv-Ray:fix_vfe, r=lcnr
Fix: ices on virtual-function-elimination about principal trait Extract `load_vtable` function to ensure the `virtual_function_elimination` option is always checked. It's okay not to use `llvm.type.checked.load` to load the vtable if there is no principal trait. Fixes #123955 Fixes #124092
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/crashes/123955.rs | 6 | ||||
| -rw-r--r-- | tests/crashes/124092.rs | 7 | ||||
| -rw-r--r-- | tests/ui/codegen/virtual-function-elimination.rs | 17 |
3 files changed, 17 insertions, 13 deletions
diff --git a/tests/crashes/123955.rs b/tests/crashes/123955.rs deleted file mode 100644 index fdd58c84794..00000000000 --- a/tests/crashes/123955.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ known-bug: #123955 -//@ compile-flags: -Clto -Zvirtual-function-elimination -//@ only-x86_64 -pub fn main() { - _ = Box::new(()) as Box<dyn Send>; -} diff --git a/tests/crashes/124092.rs b/tests/crashes/124092.rs deleted file mode 100644 index c03db384e76..00000000000 --- a/tests/crashes/124092.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ known-bug: #124092 -//@ compile-flags: -Zvirtual-function-elimination=true -Clto=true -//@ only-x86_64 -const X: for<'b> fn(&'b ()) = |&()| (); -fn main() { - let dyn_debug = Box::new(X) as Box<fn(&'static ())> as Box<dyn Send>; -} diff --git a/tests/ui/codegen/virtual-function-elimination.rs b/tests/ui/codegen/virtual-function-elimination.rs new file mode 100644 index 00000000000..3cbeb1293e5 --- /dev/null +++ b/tests/ui/codegen/virtual-function-elimination.rs @@ -0,0 +1,17 @@ +//@ build-pass +//@ compile-flags: -Zvirtual-function-elimination=true -Clto=true +//@ only-x86_64 +//@ no-prefer-dynamic + +// issue #123955 +pub fn test0() { + _ = Box::new(()) as Box<dyn Send>; +} + +// issue #124092 +const X: for<'b> fn(&'b ()) = |&()| (); +pub fn test1() { + let _dyn_debug = Box::new(X) as Box<fn(&'static ())> as Box<dyn Send>; +} + +fn main() {} |
