Skip to content

norm nested aliases before evaluating the parent goal #140236

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

Merged
merged 1 commit into from
Apr 25, 2025

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Apr 24, 2025

see the explanation of the underlying issue in tests/ui/traits/next-solver/normalize/eager-norm-pre-normalizes-to.rs.

This is also the cause of rust-lang/trait-system-refactor-initiative#184, fixing the overflow errors with the new solver. I did not add any tests based on it directly as relying on that behavior to cause recursion limit shenanigans feels fragile. Thanks @Nadrieril for minimizing the issue on zulip.

r? @compiler-errors

@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 Apr 24, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 24, 2025

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@rust-cloud-vms rust-cloud-vms bot force-pushed the normalizes-to-goals branch from af161c3 to ba259b9 Compare April 24, 2025 02:39
@@ -137,6 +136,7 @@ impl<'tcx> Predicate<'tcx> {
| PredicateKind::Coerce(_)
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(_))
| PredicateKind::ConstEquate(_, _)
| PredicateKind::NormalizesTo(..)
| PredicateKind::Ambiguous => true,
Copy link
Contributor Author

@lcnr lcnr Apr 24, 2025

Choose a reason for hiding this comment

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

we're actually free to normalize NormalizesTo goals. The alias we're normalizing is already an AliasTerm so we only ever normalize the arguments, not the alias itself.

We actually already did this before this PR because we directly folded a Goal<I, NormalizesTo<I>> for NormalizesTo goals.

We could in theory also normalize the arguments of aliases in AliasRelate. However, setting allow_normalization to true for this would cause us to also attempt to normalize the aliases we're actually relating. Given that we use AliasRelate to do so, that would result in a trivial cycle.

@rust-cloud-vms rust-cloud-vms bot force-pushed the normalizes-to-goals branch from ba259b9 to 02e3491 Compare April 24, 2025 02:49
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 24, 2025
[DO NOT MERGE] bootstrap with `-Znext-solver=globally`

A revival of rust-lang#124812.

Current status:

~~`./x.py b --stage 2` passes 🎉~~

`try` builds succeed 🎉 🎉 🎉

~~[top 100 most downloaded crates on crates.io compile](rust-lang#133502 (comment)

[top 1000 most downloaded crates on crates.io compile](rust-lang#133502 (comment))

[first perf run](rust-lang#133502 (comment)) 👻

### in-flight changes

- rust-lang#124852, unsure whether I actually want to land this PR for now
- rust-lang#140236
- rust-lang#139587
- https://github.com/lcnr/rust/tree/opaque-type-method-call
- normalize when checking whether param env candidates are global
- double the available recursion depth in the new solver ☠️

r? `@ghost`
@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 24, 2025

📌 Commit 02e3491 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors 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 Apr 24, 2025
@compiler-errors
Copy link
Member

@bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 24, 2025
@rust-cloud-vms rust-cloud-vms bot force-pushed the normalizes-to-goals branch from 02e3491 to e5e3a95 Compare April 24, 2025 18:41
@lcnr
Copy link
Contributor Author

lcnr commented Apr 24, 2025

@bors r=compiler-errors rollup

@bors
Copy link
Collaborator

bors commented Apr 24, 2025

📌 Commit e5e3a95 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 24, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 25, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#137653 (Deprecate the unstable `concat_idents!`)
 - rust-lang#138957 (Update the index of Option to make the summary more comprehensive)
 - rust-lang#140006 (ensure compiler existance of tools on the dist step)
 - rust-lang#140143 (Move `sys::pal::os::Env` into `sys::env`)
 - rust-lang#140202 (Make #![feature(let_chains)] bootstrap conditional in compiler/)
 - rust-lang#140236 (norm nested aliases before evaluating the parent goal)
 - rust-lang#140257 (Some drive-by housecleaning in `rustc_borrowck`)
 - rust-lang#140278 (Don't use item name to look up associated item from trait item)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9eb0078 into rust-lang:master Apr 25, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 25, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 25, 2025
Rollup merge of rust-lang#140236 - lcnr:normalizes-to-goals, r=compiler-errors

norm nested aliases before evaluating the parent goal

see the explanation of the underlying issue in tests/ui/traits/next-solver/normalize/eager-norm-pre-normalizes-to.rs.

This is also the cause of rust-lang/trait-system-refactor-initiative#184, fixing the overflow errors with the new solver. I did not add any tests based on it directly as relying on that behavior to cause recursion limit shenanigans feels fragile. Thanks `@Nadrieril` for minimizing the issue [on zulip](https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/typenum.20.602.20.2F.201.60.20overflow.20error/with/513993621).

r? `@compiler-errors`
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.

4 participants