-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add speculative const-checking and remove qualify_min_const_fn.rs
#77128
Closed
ecstatic-morse
wants to merge
7
commits into
rust-lang:master
from
ecstatic-morse:remove-qualify-min-const-fn
+127
−555
Closed
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e900f1f
Remove `qualify_min_const_fn.rs`
ecstatic-morse e89e935
Remove `non_const_op` helper
ecstatic-morse 2ca256a
Record drops that would be live without `const_precise_live_drops`
ecstatic-morse 8095303
Expose speculative const-checking for `clippy`
ecstatic-morse 70e70de
Update clippy to use speculative const-checking
ecstatic-morse 34b821f
Run const-checking on optimized MIR in clippy
ecstatic-morse 5b51326
Work around clippy bug in const-checking
ecstatic-morse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoa, how does this work? Couldn't it already have been stolen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clippy tests don't run on PR CI, and I still can't run them locally due to some error about "two copies of the
regex
crate".I don't know if clippy has a mechanism for ordering lints. It's not correct to const-check optimized MIR, since optimizations (especially drop elaboration) could have removed invalid operations. This was true for
qualify_min_const_fn
as well. Can someone from @rust-lang/clippy weigh in here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay,
./x.py clean
seemed to work. Besides being incorrect, running const-checking on optimized MIR causes a bunch of assertions to fire, since we don't reason about promoteds inside const-checking. I guess we'll have to disable the lint until someone tells us how to order the execution of clippy lints.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clippy could override the query that steals
mir_const
and just not steal it. Right now we're doing a hacky thing (rust/src/tools/clippy/src/driver.rs
Line 86 in 87d262a
cc @rust-lang/clippy are you ok with turning off the "this could be const fn" lint until we figure out how to get it to use exactly the same analysis as the one used by rustc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This passes clippy tests locally now that I've commented out a single assertion. It was just the one ICE in every test. I think we could live with it (that assertion was more of a sanity check), but it doesn't feel great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it works like Miri,
test --stage 0
should also work (and be much faster as rustc is built only once).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried started with
stage 0
but got the bug about two rlibs forregex
. Can anyone reproduce? Doing a stage 1 build just to run clippy tests is pretty painful, especially since they don't run on CI.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the regex thing is a longstanding problem with compiletest-rs that we've not really been able to fix. I don't know if https://crates.io/crates/trybuild fares better, maybe we should try it out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Miri also uses compiletest and its stage 0 tests work fine...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in miri we don't use any crates in our unit tests I think