-
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
Destructuring of incorrectly defined struct produces ICE #66270
Comments
There's no need for struct Bug {
foo: 0,
}
fn main() {
let Bug { foo: 0 } = Bug {};
} rustc 1.40.0-nightly (ac162c6 2019-11-09) running on x86_64-unknown-linux-gnu backtrace
|
@Lonami thank you for corrections! 👍
I wanted to show that correct nested destructuring produces ICE let Bug { any_field: Empty {} } // correct if we define `any_field: Empty` while
let Bug { foo: 0 } // produces `refutable pattern` any way
Field Try following code (Playground): struct Bug {
foo: 0,
}
fn main() {
let bug = Bug { foo: 5 };
bug.foo;
} Spoiler
Exactly, it has name |
cc @matthewjasper since you are working on |
This is fixed by #66246. I'll add a test for this tomorrow. |
@matthewjasper did the test get added? Looks to me that 0de037c7b69c147f5235b7ee1134c78935a39788 got lost to the ether |
Oh. I guess not then. |
…-DPC Add regression tests for fixed ICEs Closes rust-lang#61747 (fixed from 1.41.0-nightly (4007d4e 2019-12-01)) Closes rust-lang#66205 (fixed from 1.41.0-nightly (4007d4e 2019-12-01)) Closes rust-lang#66270 (fixed by rust-lang#66246) Closes rust-lang#66868 (fixed by rust-lang#67071) Closes rust-lang#67424 (fixed by rust-lang#67160) Also picking a minor nit up from rust-lang#67071 with 101dd7b r? @Centril
…-DPC Add regression tests for fixed ICEs Closes rust-lang#61747 (fixed from 1.41.0-nightly (4007d4e 2019-12-01)) Closes rust-lang#66205 (fixed from 1.41.0-nightly (4007d4e 2019-12-01)) Closes rust-lang#66270 (fixed by rust-lang#66246) Closes rust-lang#66868 (fixed by rust-lang#67071) Closes rust-lang#67424 (fixed by rust-lang#67160) Also picking a minor nit up from rust-lang#67071 with 101dd7b r? @Centril
Add regression tests for fixed ICEs Closes rust-lang#61747 (fixed from 1.41.0-nightly (4007d4e 2019-12-01)) Closes rust-lang#66205 (fixed from 1.41.0-nightly (4007d4e 2019-12-01)) Closes rust-lang#66270 (fixed by rust-lang#66246) Closes rust-lang#67424 (fixed by rust-lang#67160) Also picking a minor nit up from rust-lang#67071 with 101dd7b r? @Centril
Attempt to use destructuring on incorrectly defined struct produces ICE.
Code:
Output:
Playground
The text was updated successfully, but these errors were encountered: