Skip to content

Try to mark param env as rigid with the next solver#158643

Open
adwinwhite wants to merge 4 commits into
rust-lang:mainfrom
adwinwhite:rigid-param-env
Open

Try to mark param env as rigid with the next solver#158643
adwinwhite wants to merge 4 commits into
rust-lang:mainfrom
adwinwhite:rigid-param-env

Conversation

@adwinwhite

@adwinwhite adwinwhite commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

View all comments

This PR tries to make normalization of param env behave exactly the same as the old solver.

Notably,

  • we treat the param env used to normalize param env itself as rigid.
  • the normalizes-to term of projection predicate is treated as normalizable rather than rigid.

This fixes some overflow bugs we met in the next solver but unfix some other bugs (existing in the old solver).
See the blessed tests.

r? lcnr

lcnr added 3 commits June 30, 2026 09:30
the old solver doesn't register `TypeOutlives` and `RegionOutlives` goals if `ignoring_regions` is set. The new solver always registers these requirements, so we instead ignore errors caused by these constraints.
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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 1, 2026
@adwinwhite

adwinwhite commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Haven't blessed tests or added comments.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 1, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 1, 2026
Try to mark param env as rigid with the next solver
@rust-log-analyzer

This comment has been minimized.

@adwinwhite

Copy link
Copy Markdown
Contributor Author

@bors try cancel

@rust-bors

rust-bors Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Try build cancelled. Cancelled workflows:

@adwinwhite

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 1, 2026
Try to mark param env as rigid with the next solver
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 0abe2a0 (0abe2a0937c875c08c170438a9afec1fecf7de22)
Base parent: 17aa775 (17aa77551e89d5e80d4b506c9a32fc151264b8e4)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (0abe2a0): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.2% [1.2%, 2.8%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.3% [-2.5%, -0.1%] 8
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary -0.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.8% [2.8%, 2.8%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.8% [-1.9%, -1.7%] 3
All ❌✅ (primary) - - 0

Cycles

Results (secondary -0.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.7% [3.7%, 3.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.1% [-2.2%, -2.0%] 3
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 486.291s -> 497.243s (2.25%)
Artifact size: 393.72 MiB -> 393.24 MiB (-0.12%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 1, 2026
@adwinwhite adwinwhite marked this pull request as ready for review July 1, 2026 12:10
@rustbot

rustbot commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 1, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 1, 2026
@adwinwhite

Copy link
Copy Markdown
Contributor Author

Unsure which minimization is a valid regression test for ml-kem. Part of it should be covered by tachys. Just add my minimization which is very long?

@lcnr

lcnr commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

hmm, good question :3 I think the largest typenum free minimization to make unknown issues easier to detect + all small mimimizations for the separate issues?

might make sense to just have a list of all the minimization and how they cover each other. You want both all smallest and all largest minimizations :3 minimizations should form a poset

@rust-log-analyzer

This comment has been minimized.

p
}
}
}

@lcnr lcnr Jul 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at this, we don't need a type folder here, we can just iterate through the caller_bounds manually and do that :>

View changes since the review

}
}

struct OpaqueToNonRigid<'tcx> {

@lcnr lcnr Jul 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we merge that folder into RigidnessFolder by adding a RigidnessFolderMode or whatever?

View changes since the review

// So the rigidness marker is wrong.
predicates.fold_with(&mut OpaqueToNonRigid { tcx })
} else {
ty::set_aliases_to_non_rigid(tcx, predicates).skip_norm_wip()

@lcnr lcnr Jul 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep a comment for why we need to do this if the hack is disabled

(param_env used in different typingmode)

View changes since the review

//@ check-pass

// Regression test for trait-system-refactor-initiative#246
// Fixed by eager norm and marking param env as rigid.

@lcnr lcnr Jul 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like having both 7 and 8 is a bit too much as 7 isn't actually that much more approachable (both tests are kinda scary) so instead only having 8 as a test, but having its comment point to 246 and state that there are some intermediate minimizations in that issue, is probably better

View changes since the review

Comment thread tests/ui/typeck/issue-116864.rs Outdated
//@ check-pass
//@ edition: 2021

// This was fixed by lazy norm of param env.

@lcnr lcnr Jul 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you link to this PR here so people know what this means?

and can you change this test to use revisions?

View changes since the review

@lcnr

lcnr commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

some nits, I am otherwise happy with these changes, so it's just blocked on my PR :>

@rust-bors

rust-bors Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #158795) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. 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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants