Fix #151880: avoid ICE when CTFE evaluates static with unknown layout#154553
Fix #151880: avoid ICE when CTFE evaluates static with unknown layout#154553Pinguimmar wants to merge 1 commit intorust-lang:mainfrom
Conversation
|
r? @fmease rustbot has assigned @fmease. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
This ICE occurred during const-eval when evaluating a static whose type has an unknown layout due to earlier type errors. In this situation the interpreter attempted to access the layout of the referenced static, triggering an assertion that assumed the layout was sized. Add a check when evaluating statics to detect unsized or unknown layouts and report a layout error instead of panicking. Signed-off-by: Miguel Marques <miguel.m.marques@tecnico.ulisboa.pt>
ae9db6b to
b22338c
Compare
|
I'm afraid this is the wrong fix. The interpreter should never be invoked on invalid code in the first place. |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
I'm guessing it should have been noticed in type checking then. I will investigate a bit more before submitting a new commit. |
|
You can check where the other errors are emitted and why they don't taint. I expect some of them to be from check_well_formed, which would make things hard,but maybe one of the errors is from typeck? |
This ICE occurred during const-eval when evaluating a static whose type has an unknown layout due to earlier type errors. In this situation the interpreter attempted to access the layout of the referenced static, triggering an assertion that assumed the layout was sized.
Adds a check when evaluating statics to detect unsized or unknown layouts and report a layout error instead of panicking.
closes #151880