Skip to content

fix(thir): Include NoneWithError in Enum Struct Tail Assertion#153394

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
TKanX:bugfix/153390-ice-enum-struct-syntax-error
Mar 5, 2026
Merged

fix(thir): Include NoneWithError in Enum Struct Tail Assertion#153394
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
TKanX:bugfix/153390-ice-enum-struct-syntax-error

Conversation

@TKanX
Copy link
Contributor

@TKanX TKanX commented Mar 4, 2026

Summary:

Fixes the ICE triggered when a syntax error appears inside an enum variant struct literal.

PR #153227 added StructTailExpr::NoneWithError and updated the match base arm in the AdtKind::Enum branch of thir/cx/expr.rs, but overlooked the assert!(matches!(...)) guard preceding it, which still only listed None | DefaultFields(_).

Closes #153390

r? @dingxiangfei2009
cc @matthiaskrgr

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 4, 2026
@TKanX
Copy link
Contributor Author

TKanX commented Mar 4, 2026

@rustbot label T-compiler C-bug regression-from-stable-to-nightly

@rustbot rustbot added C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 4, 2026
@rust-log-analyzer

This comment has been minimized.

@TKanX TKanX marked this pull request as draft March 4, 2026 09:43
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 4, 2026
@lqd lqd removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. C-bug Category: This is a bug. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 4, 2026
@TKanX TKanX marked this pull request as ready for review March 4, 2026 09:51
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 4, 2026
@TKanX
Copy link
Contributor Author

TKanX commented Mar 4, 2026

@bors retry

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 4, 2026

@TKanX: 🔑 Insufficient privileges: not in review users

@TKanX
Copy link
Contributor Author

TKanX commented Mar 4, 2026

CI crashed, I can't rerun. I need to rebase and recommit.

@TKanX TKanX force-pushed the bugfix/153390-ice-enum-struct-syntax-error branch from de785a4 to 20768d8 Compare March 4, 2026 10:11
@dingxiangfei2009
Copy link
Contributor

Thank you for your contribution @TKanX !

I have also checked through the code. Seemingly this is only place that the matches! is not exhaustive.

@bors r+ rollup=always

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 4, 2026

📌 Commit 20768d8 has been approved by dingxiangfei2009

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 4, 2026
@TKanX
Copy link
Contributor Author

TKanX commented Mar 5, 2026

@dingxiangfei2009 Thanks!! You're always so fast

rust-bors bot pushed a commit that referenced this pull request Mar 5, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #153361 (enable `PassMode::Indirect { on_stack: true, .. }` tail call arguments)
 - #153369 (library/test: always enable unstable features for miri)
 - #152283 (Properly pass offload sizes to kernel args)
 - #153323 (Remove `impl QueryVTable`)
 - #153385 (Fix comment on `is_horizontal_whitespace`)
 - #153394 (fix(thir): Include `NoneWithError` in Enum Struct Tail Assertion)
 - #153419 (rustc_llvm: add missing `-` to flag-comparison logic)
 - #153423 (Update dispatch2 to v0.3.1)
@rust-bors rust-bors bot merged commit fed3c49 into rust-lang:main Mar 5, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Mar 5, 2026
rust-timer added a commit that referenced this pull request Mar 5, 2026
Rollup merge of #153394 - TKanX:bugfix/153390-ice-enum-struct-syntax-error, r=dingxiangfei2009

fix(thir): Include `NoneWithError` in Enum Struct Tail Assertion

### Summary:

Fixes the ICE triggered when a syntax error appears inside an enum variant struct literal.

PR #153227 added `StructTailExpr::NoneWithError` and updated the `match base` arm in the `AdtKind::Enum` branch of `thir/cx/expr.rs`, but overlooked the `assert!(matches!(...))` guard preceding it, which still only listed `None | DefaultFields(_)`.

Closes #153390

r? @dingxiangfei2009
cc @matthiaskrgr
@TKanX TKanX deleted the bugfix/153390-ice-enum-struct-syntax-error branch March 5, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: assertion failed: matches!(base, hir::StructTailExpr::None | hir::StructTailExpr::DefaultFields(_))

5 participants