-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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: return early when has tainted in mir-lint #115643
Conversation
(rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri |
@@ -0,0 +1,11 @@ | |||
// compile-flags: --emit link |
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 am unsure about how to label this test header. Only run-fail
can reproduce the ice of #115203, but it also requires the case to build successfully. Consequently, I have resorted to using --emit link
.
Ugh, I thought we stopped running ConstProp on code that is tainted by type errors? Cc @oli-obk |
Only if it actually gets tainted 😆 |
@bvanjoi if you can find out where the error is emitted in typeck, you can use https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxt.html#method.set_tainted_by_errors, which should also fix the issue |
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
A taint already exists, which was appended by the buffer_error. Therefore, we only need to return early if a taint is present at the start of the |
@@ -63,6 +63,10 @@ impl<'tcx> MirLint<'tcx> for ConstProp { | |||
return; | |||
} | |||
|
|||
if body.tainted_by_errors.is_some() { |
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 should probably be checked at the top of the function, no need to do the check so late.
Now I wonder if this means we can get rid of some of the other ConstPropNonsense throws...
r? @RalfJung |
This LGTM, but oli understands this tainting business much better than I do... |
@bors r=RalfJung,oli-obk We should probably skip all analyses after a body has been tainted. That may allow us to remove a bunch of delay span bugs in mir opts and the analysis passes and transforms, but that's for a separate PR |
…llaumeGomez Rollup of 6 pull requests Successful merges: - rust-lang#104299 (Clarify stability guarantee for lifetimes in enum discriminants) - rust-lang#115088 (Fix Step Skipping Caused by Using the `--exclude` Option) - rust-lang#115201 (rustdoc: list matching impls on type aliases) - rust-lang#115633 (Lint node for `PRIVATE_BOUNDS`/`PRIVATE_INTERFACES` is the item which names the private type) - rust-lang#115638 (`-Cllvm-args` usability improvement) - rust-lang#115643 (fix: return early when has tainted in mir-lint) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#115643 - bvanjoi:fix-115203, r=RalfJung,oli-obk fix: return early when has tainted in mir-lint Fixes rust-lang#115203 `a[..]` is of indeterminate size, it had been reported error during borrow check, therefore we skip the mir lint process.
fix: return early when has tainted in mir pass Fixes rust-lang#115809 As in rust-lang#115643, `run_pass` is skipped if the body has tainted errors. r? `@oli-obk`
Rollup merge of rust-lang#115815 - bvanjoi:fix-115809, r=oli-obk fix: return early when has tainted in mir pass Fixes rust-lang#115809 As in rust-lang#115643, `run_pass` is skipped if the body has tainted errors. r? `@oli-obk`
Fixes #115203
a[..]
is of indeterminate size, it had been reported error during borrow check, therefore we skip the mir lint process.