-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
assertion failure with src/test/ui/pattern/const-pat-ice.rs #59996
Comments
I haven't looked into this yet, but it could be related to #53708. |
Reproduces all the way back to 1.26.0 at least (tested with godbolt). |
triage: P-high since its an ICE. Leaving nominated because I want someone to talk me out of downgrading to P-medium based on it being an ancient bug. |
retriage: P-medium. Assigning to self so that I do not lose track of it. |
Bug is still present as of bbf1372 |
Bug is still present with |
cc @Nadrieril |
First I've reduced a bit more: const FOO: &&&() = &&&();
fn main() {
match &&&() {
FOO => {},
&&&() => {},
}
} I think I see where the problem comes from, but I don't know how to fix it. rust/src/librustc_mir_build/hair/pattern/_match.rs Lines 341 to 352 in dd155df
we essentially say "if we have a constant pattern and the constant is a reference to something, then we convert it to being a pattern of the form &CONST . Not that this is not done recursively.From the stack trace, the crash happens when trying to check if the second pattern is useful wrt the first. What would usually happen in a case like: match &&&&0 {
&&&&0 => {},
&&&&1 => {},
} is that we remove one layer of Now what that surprises me most here is that I expected the crash to come from that line: rust/src/librustc_mir_build/hair/pattern/_match.rs Lines 319 to 320 in dd155df
|
Basically I never got around to implementing actual dereferencing of constants. It requires reading from a constant just like |
Fixed by #70743 |
When checking with "cargo check", rustc hits an assertion failure:
cc rust-lang/rust-clippy#3142
The text was updated successfully, but these errors were encountered: