-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Nested slice pattern incorrectly considered irrefutable #26158
Comments
This is very bad: #![feature(slice_patterns)]
fn main() {
let x: &[u32] = &[];
let [[a, b..]..] = x;
println!("{:08x}", a);
for x in b.iter().take(30) {
println!("{:08x}", x);
}
}
|
If I understand correctly this reads unitialized memory? Or rather, not owned memory? |
@TheNeikos yes. Fortunately it depends on a feature marked unstable. |
@bluss Alright |
This is outdated since the slice pattern rewrite. Filed #35077 as a followup. |
Wait, nevermind, this is still a problem; revised testcase:
|
Related miscompile:
MIR ICE:
|
I want to figure out our nested slice pattern story. |
@arielb1 can you clarify what are the thorny cases and where things get confusing? |
Testcase:
This clearly shouldn't type-check, but currently compiles without any error.
The text was updated successfully, but these errors were encountered: