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

Make broken MIR a proper lint. #119260

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

cjgillot
Copy link
Contributor

This allows to use expect(rustc::broken_mir) when we actually expect it to fire.

cc @tmiasko

@matthiaskrgr this should address #119077 (comment)

@rustbot
Copy link
Collaborator

rustbot commented Dec 23, 2023

r? @TaKO8Ki

(rustbot has picked a reviewer for you, use r? to override)

@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 Dec 23, 2023
@rustbot
Copy link
Collaborator

rustbot commented Dec 23, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

/// The `broken_mir` statically detects undefined behaviour in the MIR optimization pipeline.
/// This is an internal lint, and not intended to be used directly.
pub rustc::BROKEN_MIR,
Deny,
Copy link
Member

Choose a reason for hiding this comment

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

Forbid maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One use case is to use expect. And you cannot expect a forbidden lint.

Comment on lines +3959 to +3943
crate::declare_tool_lint! {
/// The `broken_mir` statically detects undefined behaviour in the MIR optimization pipeline.
/// This is an internal lint, and not intended to be used directly.
pub rustc::BROKEN_MIR,
Deny,
"broken MIR",
report_in_external_macro: true
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Bike-shedding: The term broken MIR is already used when validation fails. It also overstates the severity of what is being reported. Maybe unusual MIR?

Copy link
Member

Choose a reason for hiding this comment

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

I do believe broken is the right term here

Copy link
Contributor

Choose a reason for hiding this comment

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

In what sense is this MIR broken?

The motivation behind moving those checks out of validator was the fact that there is nothing inherently wrong about violating them. Those reports should NOT be treated as bugs. It doesn't even mean that the user provided program has an undefined behaviour, since we don't know whether those instructions are ever executed.

@bors
Copy link
Contributor

bors commented Dec 30, 2023

☔ The latest upstream changes (presumably #119377) made this pull request unmergeable. Please resolve the merge conflicts.

@cjgillot cjgillot force-pushed the mir-lint branch 2 times, most recently from 1176c87 to 0cbefd5 Compare January 1, 2024 02:43
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jan 5, 2024

☔ The latest upstream changes (presumably #119621) made this pull request unmergeable. Please resolve the merge conflicts.

@compiler-errors
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 5, 2024
@Dylan-DPC
Copy link
Member

@cjgillot any updates on this? thanks

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-17 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
------
 > importing cache manifest from ghcr.io/rust-lang/rust-ci-cache:3aacb9c90579defe09351ac5e8ee504359f8054da6326ff19038f1b7c90e3cb2aafe33685c6d9b76ee8d2ccbd187ca80c46ab5380485abdd8c0ce7d69cd8d8fd:
------
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-17]
---
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-17', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-17/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---
##[group]Testing stage2 compiletest suite=crashes mode=crashes (x86_64-unknown-linux-gnu)

running 216 tests
........................................................................................  88/216
..........................2024-08-03T16:38:43.393835Z ERROR compiletest::runtest: fatal error, panic: "crashtest no longer crashes/triggers ICE, horray! Please give it a meaningful name, add a doc-comment to the start of the test explaining why it exists and move it to tests/ui or wherever you see fit. Adding 'Fixes #<issueNr>' to your PR description ensures that the corresponding ticket is auto-closed upon merge."
[crashes] tests/crashes/123810.rs ... F
............................................................. 176/216
........................................


failures:

---- [crashes] tests/crashes/123810.rs stdout ----

error: crashtest no longer crashes/triggers ICE, horray! Please give it a meaningful name, add a doc-comment to the start of the test explaining why it exists and move it to tests/ui or wherever you see fit. Adding 'Fixes #<issueNr>' to your PR description ensures that the corresponding ticket is auto-closed upon merge.
thread '[crashes] tests/crashes/123810.rs' panicked at src/tools/compiletest/src/runtest.rs:368:18:
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:

@bors
Copy link
Contributor

bors commented Aug 19, 2024

☔ The latest upstream changes (presumably #129261) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

8 participants