Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: ices on virtual-function-elimination about principal trait #130734

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

Luv-Ray
Copy link
Contributor

@Luv-Ray Luv-Ray commented Sep 23, 2024

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

@rustbot
Copy link
Collaborator

rustbot commented Sep 23, 2024

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 23, 2024
//@ build-pass
//@ compile-flags: -Zvirtual-function-elimination=true -Clto=true
//@ only-x86_64
//@ no-prefer-dynamic
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this argument needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./x test needs this argument to perform LTO.
Below is the error message without no-prefer-dynamic:

running 1 tests

[ui] tests/ui/codegen/virtual-function-elimination.rs ... F


failures:

---- [ui] tests/ui/codegen/virtual-function-elimination.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/home/ray/Desktop/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/home/ray/Desktop/rust/tests/ui/codegen/virtual-function-elimination.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/home/ray/.cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/home/ray/Desktop/rust/vendor" "--sysroot" "/home/ray/Desktop/rust/build/x86_64-unknown-linux-gnu/stage1" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "--out-dir" "/home/ray/Desktop/rust/build/x86_64-unknown-linux-gnu/test/ui/codegen/virtual-function-elimination" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/home/ray/Desktop/rust/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/home/ray/Desktop/rust/build/x86_64-unknown-linux-gnu/test/ui/codegen/virtual-function-elimination/auxiliary" "-Zvirtual-function-elimination=true" "-Clto=true"
stdout: none
--- stderr -------------------------------
error: cannot prefer dynamic linking when performing LTO
   |
   = note: only 'staticlib', 'bin', and 'cdylib' outputs are supported with LTO

error: aborting due to 1 previous error
------------------------------------------

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me after review comment

@lcnr
Copy link
Contributor

lcnr commented Sep 25, 2024

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 25, 2024

📌 Commit 16093fa has been approved by lcnr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 25, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 25, 2024
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#130549 (Add RISC-V vxworks targets)
 - rust-lang#130595 (Initial std library support for NuttX)
 - rust-lang#130734 (Fix: ices on virtual-function-elimination about principal trait)
 - rust-lang#130787 (Ban combination of GCE and new solver)
 - rust-lang#130809 (Update llvm triple for OpenHarmony targets)
 - rust-lang#130810 (Don't trap into the debugger on panics under Linux)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0e43909 into rust-lang:master Sep 25, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Sep 25, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Sep 25, 2024
Rollup merge of rust-lang#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 rust-lang#123955
Fixes rust-lang#124092
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE: expected principal trait object ICE: virtual-function-elimination
4 participants