-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
ICE: The type checker should prevent reading from a never-written local #69487
Comments
this is a general issue with const eval. Typeck needs to const eval certain constants, for which we may not have invoked typeck yet. This ordering issue has existed since 1.0 afaik. |
A simpler repro and one that works on stable is struct Bug {
A: [(); {
let x: usize;
x
}],
} taken from #72115 |
Original no longer ICEs since #78961 #69487 (comment) still ICEs |
Olis example ICEs since @rustbot modify labels: +regression-from-stable-to-stable |
Assigning |
Looks like rustc emits an error before ICEing. Perhaps we should only ICE if no error has been reported yet? |
yes and no. There are a gazillion similar ICEs hiding in CTFE. It's not meant to be run on code that fails to type check/borrowck. I believe we need to add a flag to mir::Body that marks it as "poisoned due to errors" so that when MIR borrowck runs (which presumably emitted the above error), we know about those errors when doing CTFE and just return an AlreadyErrored silent failure |
Run into this while fuzzing, is this the same issue? Codefn main() {
[9; || [9; []]];
} Error output
Backtrace
|
This may be fixed on master now, can someone check and add a regression test if it is indeed fixed? |
Just checked on commit 9cdefd7: #69487 (comment) is fixed (feel free to add the regression test):
But #69487 (comment) is not fixed:
Also the original example #69487 (comment) is now a different ICE (this doesn't happen in stable but it does happen in beta, feel free to open a new issue if needed):
|
#69487 (comment) errors rather than an ICEs now (#95125)
|
That error is completely bogus. A better fix would be for const eval to run typechk and borrowchk itself if necessary. |
We tried that, it's unclear why it didn't work here yet and requires further analysis. |
I tried this code:
I expected to see this happen: Maybe it should've compiled? Maybe it should've just emitted an error explaining I did something wrong?
Instead, this happened: It crashed!
Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: