Description
Attempt to use destructuring on incorrectly defined struct produces ICE.
Code:
struct Bug {
incorrect_field: 0,
}
struct Empty {}
fn main() {
let Bug {
any_field: Empty {},
} = Bug {};
}
Output:
error: expected type, found `0`
--> src/main.rs:2:22
|
2 | incorrect_field: 0,
| ^ expected type
thread 'rustc' panicked at 'no index for a field', src/libcore/option.rs:1190:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.39.0 (4560ea788 2019-11-04) running on x86_64-unknown-linux-gnu
note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin
note: some of the compiler flags provided by cargo are hidden
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.