-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ICE: typeck: no index for a field
#126744
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
Comments
wtf. why does that wrong comma cause the struct to be different from a struct with no fields |
minimized struct X {,}
fn main() {
|| {
if let X { x: 1,} = (X {}) {}
};
} |
An extra rust/compiler/rustc_hir_typeck/src/pat.rs Line 1533 in 382148d
so we didn't emit the error like an empty struct: rust/compiler/rustc_hir_typeck/src/pat.rs Line 1610 in 382148d
error[E0026]: struct `X` does not have a field named `x`
--> src/main.rs:5:20
|
5 | if let X { x: 1,} = (X {}) {}
| ^ struct `X` does not have this field
So the compiler continues until the ICE point. I think a trivial fix will be ok here? |
Hmm... I'd look into reporting that error even for recovered structs and figuring out how to avoid it just for the cases that this skip was intended to avoid |
Oh... we can probably just replace the |
Since we cannot encode an |
…ice, r=<try> Avoid no field error and ice no recovered struct variant Fixes rust-lang#126744 Fixes rust-lang#126344, a more general fix compared with rust-lang#127426 r? `@oli-obk` From `@compiler-errors` 's comment rust-lang#127502 (comment) Seems most of the ADTs don't have taint, so maybe it's not proper to change `TyCtxt::type_of` query.
snippet:
Version information
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
The text was updated successfully, but these errors were encountered: