-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Emit a wrap expr span_bug only if context is not tainted #127409
Conversation
r? @oli-obk Where is the actual error being reported? Can we change something at the error emission site to ensure we don't get here? |
And... is the type actually an enum or is it an error type by any chance? |
ef01d09
to
1c99bf2
Compare
The original error which is this:
is emitted here: rust/compiler/rustc_hir_typeck/src/expr.rs Lines 1878 to 1879 in 9e27377
check_expr_struct_fields .
The code path that ICEs starts later in rust/compiler/rustc_hir_typeck/src/lib.rs Line 191 in 9e27377
The call to Unfortunately, I could not think of a way to cause |
It is an enum i.e. the type returned by this call to
is an enum ADT. |
Fixes an ICE caused when a with expression is not a struct
1c99bf2
to
9da3638
Compare
@bors r+ rollup Thanks for going through all those hoops for a tiny ICE fix |
No worries at all 😄 |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#127179 (Print `TypeId` as hex for debugging) - rust-lang#127189 (LinkedList's Cursor: method to get a ref to the cursor's list) - rust-lang#127236 (doc: update config file path in platform-support/wasm32-wasip1-threads.md) - rust-lang#127297 (Improve std::Path's Hash quality by avoiding prefix collisions) - rust-lang#127308 (Attribute cleanups) - rust-lang#127354 (Describe Sized requirements for mem::offset_of) - rust-lang#127409 (Emit a wrap expr span_bug only if context is not tainted) - rust-lang#127447 (once_lock: make test not take as long in Miri) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#127409 - gurry:127332-ice-with-expr-not-struct, r=oli-obk Emit a wrap expr span_bug only if context is not tainted Fixes rust-lang#127332 The ICE occurs because of this `span_bug`: https://github.com/rust-lang/rust/blob/51917e2e69702e5752bce6a4f3bfd285d0f4ae39/compiler/rustc_hir_typeck/src/expr_use_visitor.rs#L732-L738 which is triggered by the fact that we're trying to use an `enum` in a `with` expression instead of a `struct`. The issue originates in commit rust-lang@814bfe9 from PR rust-lang#127202. As per the title of that commit the ICEing code should not be reachable any more, but looks like it still is. This PR changes the code so that the `span_bug` will be emitted only if the context is not tainted by a previous error.
Fixes #127332
The ICE occurs because of this
span_bug
:rust/compiler/rustc_hir_typeck/src/expr_use_visitor.rs
Lines 732 to 738 in 51917e2
which is triggered by the fact that we're trying to use an
enum
in awith
expression instead of astruct
.The issue originates in commit 814bfe9 from PR #127202. As per the title of that commit the ICEing code should not be reachable any more, but looks like it still is.
This PR changes the code so that the
span_bug
will be emitted only if the context is not tainted by a previous error.