Skip to content

fatal error if both -Znext-solver and GCE are enabled#158738

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
Dnreikronos:next_trait_solver/gce_expr_recovery
Jul 22, 2026
Merged

fatal error if both -Znext-solver and GCE are enabled#158738
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
Dnreikronos:next_trait_solver/gce_expr_recovery

Conversation

@Dnreikronos

@Dnreikronos Dnreikronos commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

fixes #158428

the next solver already rejects generic_const_exprs with -Znext-solver=globally, but we can still walk into ConstKind::Expr while compiling after that error and crash anyway.

imo this should stay as a recovery fix, not a gce implementation. ambiguity still lgtm to me here: idk that we want to say the expr is solved when the feature combo is already invalid, we just need to not ice after the real error.

long-term, proper ConstKind::Expr support would be a much bigger thing. the next solver would need to type-check, normalize, compare, and evaluate or prove these exprs structurally, including nested binops, unops, casts, calls, and the result type for ConstArgHasType. that's out of scope for this pr.

this teaches both const evaluatable and const arg has type paths to recover on ConstKind::Expr, then adds the union repro as a ui test.

@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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jul 3, 2026
@rustbot

rustbot commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

r? @mejrs

rustbot has assigned @mejrs.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 21 candidates

@mejrs

mejrs commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

r? @BoxyUwU

@rustbot rustbot assigned BoxyUwU and unassigned mejrs Jul 3, 2026
@rustbot

rustbot commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

BoxyUwU is currently at their maximum review capacity.
They may take a while to respond.

@BoxyUwU

BoxyUwU commented Jul 8, 2026

Copy link
Copy Markdown
Member

I don't think we want to complicate the new solver with logic for supporting GCE stuff. In the short term generic_const_args and min_generic_const_args should obviate this feature 🤔 can you instead make the error about new solver and GCE being mutually incompatible be fatal so that compilation just ends rather than trucking on

@BoxyUwU

BoxyUwU commented Jul 8, 2026

Copy link
Copy Markdown
Member

@rustbot author

@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 Jul 8, 2026
@rustbot

rustbot commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@Dnreikronos
Dnreikronos force-pushed the next_trait_solver/gce_expr_recovery branch from 027341c to 7645fac Compare July 8, 2026 19:57
@rustbot

rustbot commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Dnreikronos

Copy link
Copy Markdown
Contributor Author

@BoxyUwU updated this based on your feedback.

the -znext-solver=globally + generic_const_exprs incompatibility is fatal now, so we stop during feature gating before gce can lower into constkind::expr and reach the new solver. i also removed the solver-side ambiguity recovery. imo that is cleaner, since that path was basically handling a state we already know is unsupported.

i renamed the regression test from recovery to incompatibility, and changed the const-trait known-bug test to use -znext-solver=coherence so it keeps testing the const-trait diagnostics instead of getting swallowed by this fatal gate.

also rebased on latest origin/main and resolved the conflict in tests/ui/traits/const-traits/unsatisfied-const-trait-bound.stderr.

ltm if you want anything adjusted. idk if there is a better place for the test, but this felt like the least noisy split to me.

@rustbot ready

@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 Jul 8, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Dnreikronos
Dnreikronos force-pushed the next_trait_solver/gce_expr_recovery branch from 779ef3e to 6e45dd2 Compare July 9, 2026 18:11
Comment thread tests/ui/traits/const-traits/unsatisfied-const-trait-bound.rs Outdated
@BoxyUwU

BoxyUwU commented Jul 22, 2026

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a5a918c has been approved by BoxyUwU

It is now in the queue for this repository.

@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 Jul 22, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 22, 2026
…expr_recovery, r=BoxyUwU

next_trait_solver: Recover from GCE const exprs

fixes rust-lang#158428

the next solver already rejects `generic_const_exprs` with `-Znext-solver=globally`, but we can still walk into `ConstKind::Expr` while compiling after that error and crash anyway.

imo this should stay as a recovery fix, not a gce implementation. ambiguity still lgtm to me here: idk that we want to say the expr is solved when the feature combo is already invalid, we just need to not ice after the real error.

long-term, proper `ConstKind::Expr` support would be a much bigger thing. the next solver would need to type-check, normalize, compare, and evaluate or prove these exprs structurally, including nested binops, unops, casts, calls, and the result type for `ConstArgHasType`. that's out of scope for this pr.

this teaches both const evaluatable and const arg has type paths to recover on `ConstKind::Expr`, then adds the union repro as a ui test.
rust-bors Bot pushed a commit that referenced this pull request Jul 22, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #159712 (Subtree sync for rustc_codegen_cranelift)
 - #155697 (Stabilize c-variadic function definitions)
 - #159285 (Simplify `apply_effects_in_range`)
 - #159596 (unify the AST repr of type const and const RHS)
 - #159607 (test: update riscv32e-registers.rs for LLVM 24 MC diagnostic changes)
 - #159659 (Move `Limit` out of `rustc_hir`)
 - #159707 (fix error when a dangling ref in a ManuallyDrop is used in a pattern)
 - #158479 (Reject static item as direct const generic arg)
 - #158738 (next_trait_solver: Recover from GCE const exprs)
 - #159451 (Remove config cloning in compiletest)
 - #159646 (Increase depth for float infer var fallback hack)
 - #159705 (bootstrap: Prefer `cfg!(not(test))` when skipping code paths during unit tests)
rust-bors Bot pushed a commit that referenced this pull request Jul 22, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #159712 (Subtree sync for rustc_codegen_cranelift)
 - #155697 (Stabilize c-variadic function definitions)
 - #159285 (Simplify `apply_effects_in_range`)
 - #159596 (unify the AST repr of type const and const RHS)
 - #159607 (test: update riscv32e-registers.rs for LLVM 24 MC diagnostic changes)
 - #159659 (Move `Limit` out of `rustc_hir`)
 - #159707 (fix error when a dangling ref in a ManuallyDrop is used in a pattern)
 - #158738 (next_trait_solver: Recover from GCE const exprs)
 - #159451 (Remove config cloning in compiletest)
 - #159646 (Increase depth for float infer var fallback hack)
 - #159705 (bootstrap: Prefer `cfg!(not(test))` when skipping code paths during unit tests)
@rust-bors
rust-bors Bot merged commit ac24945 into rust-lang:main Jul 22, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 22, 2026
rust-timer added a commit that referenced this pull request Jul 22, 2026
Rollup merge of #158738 - Dnreikronos:next_trait_solver/gce_expr_recovery, r=BoxyUwU

next_trait_solver: Recover from GCE const exprs

fixes #158428

the next solver already rejects `generic_const_exprs` with `-Znext-solver=globally`, but we can still walk into `ConstKind::Expr` while compiling after that error and crash anyway.

imo this should stay as a recovery fix, not a gce implementation. ambiguity still lgtm to me here: idk that we want to say the expr is solved when the feature combo is already invalid, we just need to not ice after the real error.

long-term, proper `ConstKind::Expr` support would be a much bigger thing. the next solver would need to type-check, normalize, compare, and evaluate or prove these exprs structurally, including nested binops, unops, casts, calls, and the result type for `ConstArgHasType`. that's out of scope for this pr.

this teaches both const evaluatable and const arg has type paths to recover on `ConstKind::Expr`, then adds the union repro as a ui test.
Kobzol pushed a commit to Kobzol/rustc_codegen_cranelift that referenced this pull request Jul 23, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#159712 (Subtree sync for rustc_codegen_cranelift)
 - rust-lang/rust#155697 (Stabilize c-variadic function definitions)
 - rust-lang/rust#159285 (Simplify `apply_effects_in_range`)
 - rust-lang/rust#159596 (unify the AST repr of type const and const RHS)
 - rust-lang/rust#159607 (test: update riscv32e-registers.rs for LLVM 24 MC diagnostic changes)
 - rust-lang/rust#159659 (Move `Limit` out of `rustc_hir`)
 - rust-lang/rust#159707 (fix error when a dangling ref in a ManuallyDrop is used in a pattern)
 - rust-lang/rust#158738 (next_trait_solver: Recover from GCE const exprs)
 - rust-lang/rust#159451 (Remove config cloning in compiletest)
 - rust-lang/rust#159646 (Increase depth for float infer var fallback hack)
 - rust-lang/rust#159705 (bootstrap: Prefer `cfg!(not(test))` when skipping code paths during unit tests)
moabo3li pushed a commit to moabo3li/miri that referenced this pull request Jul 23, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#159712 (Subtree sync for rustc_codegen_cranelift)
 - rust-lang/rust#155697 (Stabilize c-variadic function definitions)
 - rust-lang/rust#159285 (Simplify `apply_effects_in_range`)
 - rust-lang/rust#159596 (unify the AST repr of type const and const RHS)
 - rust-lang/rust#159607 (test: update riscv32e-registers.rs for LLVM 24 MC diagnostic changes)
 - rust-lang/rust#159659 (Move `Limit` out of `rustc_hir`)
 - rust-lang/rust#159707 (fix error when a dangling ref in a ManuallyDrop is used in a pattern)
 - rust-lang/rust#158738 (next_trait_solver: Recover from GCE const exprs)
 - rust-lang/rust#159451 (Remove config cloning in compiletest)
 - rust-lang/rust#159646 (Increase depth for float infer var fallback hack)
 - rust-lang/rust#159705 (bootstrap: Prefer `cfg!(not(test))` when skipping code paths during unit tests)
@lcnr lcnr changed the title next_trait_solver: Recover from GCE const exprs next_trait_solver: fatal error when encountering GCE const exprs Jul 24, 2026
@lcnr lcnr changed the title next_trait_solver: fatal error when encountering GCE const exprs fatal error if both -Znext-solver and GCE are enabled Jul 24, 2026
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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: unexpected const kind

5 participants