Skip to content

AliasTerm refactor#155392

Merged
rust-bors[bot] merged 9 commits intorust-lang:mainfrom
WaffleLapkin:alias-termmm
Apr 22, 2026
Merged

AliasTerm refactor#155392
rust-bors[bot] merged 9 commits intorust-lang:mainfrom
WaffleLapkin:alias-termmm

Conversation

@WaffleLapkin
Copy link
Copy Markdown
Member

@WaffleLapkin WaffleLapkin commented Apr 16, 2026

View all comments

follow up to #154758
tracking issue: #154941

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 16, 2026

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

changes to the core type system

cc @lcnr

HIR ty lowering was modified

cc @fmease

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

changes to the core type system

cc @lcnr

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a, @makai410

Some changes occurred in compiler/rustc_sanitizers

cc @rcvalle

@rustbot rustbot added PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Apr 16, 2026
@BoxyUwU
Copy link
Copy Markdown
Member

BoxyUwU commented Apr 17, 2026

r? BoxyUwU

@rustbot rustbot assigned BoxyUwU and unassigned lcnr Apr 17, 2026
@Kivooeo
Copy link
Copy Markdown
Member

Kivooeo commented Apr 18, 2026

a bit concerned about PredicateKind size increase, let's do a perf to make sure it's fine

@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 Apr 18, 2026
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 18, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 18, 2026

☀️ Try build successful (CI)
Build commit: 8206b39 (8206b39ff9d255d5785bd8d5ad84a4a3d9ef510c, parent: 2f201bccb3a7fb5a85b0fcfcc0a020a946d6d58a)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (8206b39): 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.3% [0.2%, 0.5%] 6
Regressions ❌
(secondary)
0.3% [0.1%, 0.5%] 5
Improvements ✅
(primary)
-0.3% [-0.5%, -0.2%] 22
Improvements ✅
(secondary)
-0.3% [-0.5%, -0.2%] 10
All ❌✅ (primary) -0.2% [-0.5%, 0.5%] 28

Max RSS (memory usage)

Results (primary 0.5%, 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.8% [0.6%, 1.2%] 5
Regressions ❌
(secondary)
0.7% [0.4%, 0.9%] 3
Improvements ✅
(primary)
-0.8% [-0.8%, -0.8%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [-0.8%, 1.2%] 6

Cycles

Results (secondary -0.5%)

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.3% [2.3%, 2.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.3% [-3.3%, -3.3%] 1
All ❌✅ (primary) - - 0

Binary size

Results (secondary 0.0%)

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)
0.0% [0.0%, 0.0%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Bootstrap: 491.618s -> 491.67s (0.01%)
Artifact size: 394.25 MiB -> 394.33 MiB (0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Apr 18, 2026
@rust-bors

This comment has been minimized.

Copy link
Copy Markdown
Member

@BoxyUwU BoxyUwU left a comment

Choose a reason for hiding this comment

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

I feel a bit unsure about the with_args method, i feel like it makes the callsites which are obligation.predicate.with_args much less clear what's going on. but I guess thats a more general issue that projection predicates have really confusingly fields.

this PR needs a rebase and can you link to the tracking issue in the description. thx

View changes since this review

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 21, 2026

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.

@rust-log-analyzer

This comment has been minimized.

I have no idea what caused this change, I don't think other commits
changed anything near these lines?..
@WaffleLapkin
Copy link
Copy Markdown
Member Author

Rebased & added the tracking issue to the PR description.

@BoxyUwU
Copy link
Copy Markdown
Member

BoxyUwU commented Apr 21, 2026

@bors r+ rollup=never p=1 (bitrotty)

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 21, 2026

📌 Commit be8bfb2 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 Apr 21, 2026
@jhpratt
Copy link
Copy Markdown
Member

jhpratt commented Apr 22, 2026

threading between rollups

@bors p=6

@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 22, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 22, 2026

☀️ Test successful - CI
Approved by: BoxyUwU
Duration: 3h 21m 41s
Pushing 1bfcb28 to main...

@rust-bors rust-bors Bot merged commit 1bfcb28 into rust-lang:main Apr 22, 2026
12 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing f9988fe (parent) -> 1bfcb28 (this PR)

Test differences

Show 23 test diffs

23 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 1bfcb284f7a2199ad322daa463e29e708d5bc635 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-x86_64-llvm-mingw: 1h 29m -> 1h 59m (+33.8%)
  2. dist-armv7-linux: 1h 11m -> 1h 32m (+29.1%)
  3. i686-gnu-1: 1h 48m -> 2h 18m (+27.8%)
  4. dist-i686-msvc: 2h 29m -> 1h 53m (-24.2%)
  5. dist-x86_64-netbsd: 1h 27m -> 1h 9m (-20.8%)
  6. i686-gnu-2: 1h 38m -> 1h 18m (-20.7%)
  7. dist-arm-linux-musl: 1h 40m -> 1h 19m (-20.6%)
  8. x86_64-gnu-tools: 1h 2m -> 49m 44s (-20.0%)
  9. pr-check-2: 35m 10s -> 41m 25s (+17.8%)
  10. x86_64-gnu-gcc: 1h 4m -> 1h 12m (+12.3%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (1bfcb28): comparison URL.

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

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

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.5% [0.1%, 0.9%] 19
Regressions ❌
(secondary)
0.3% [0.0%, 0.7%] 19
Improvements ✅
(primary)
-0.3% [-0.4%, -0.2%] 10
Improvements ✅
(secondary)
-0.3% [-0.5%, -0.2%] 9
All ❌✅ (primary) 0.2% [-0.4%, 0.9%] 29

Max RSS (memory usage)

Results (primary 0.8%, secondary -0.1%)

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

mean range count
Regressions ❌
(primary)
0.8% [0.8%, 0.9%] 2
Regressions ❌
(secondary)
1.3% [0.7%, 2.7%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.8% [-4.1%, -1.6%] 2
All ❌✅ (primary) 0.8% [0.8%, 0.9%] 2

Cycles

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

Binary size

Results (secondary 0.0%)

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)
0.0% [0.0%, 0.0%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Bootstrap: 490.294s -> 491.717s (0.29%)
Artifact size: 394.43 MiB -> 394.44 MiB (0.00%)

@WaffleLapkin WaffleLapkin deleted the alias-termmm branch April 22, 2026 07:29
@Mark-Simulacrum
Copy link
Copy Markdown
Member

@WaffleLapkin / @BoxyUwU it looks like there were some concerns over the size increases (#155392 (comment)), it looks like those have born out in both pre-merge and after-merge results. Do we think the refactor here is worth the slight regressions in instruction counts? I think it's reasonable to accept them given the lack of cycle counts.

goal.param_env,
ty::UnevaluatedConst::new(
goal.predicate.alias.def_id.try_into().unwrap(),
goal.predicate.alias.def_id().try_into().unwrap(),
Copy link
Copy Markdown
Contributor

@lcnr lcnr Apr 28, 2026

Choose a reason for hiding this comment

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

we should pass in the DefId from the match where we decide to call normalize_anon_const here? 🤔

View changes since the review

self.add_goals(
GoalSource::Misc,
cx.predicates_of(free_alias.def_id)
cx.predicates_of(free_alias.def_id())
Copy link
Copy Markdown
Contributor

@lcnr lcnr Apr 28, 2026

Choose a reason for hiding this comment

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

cx.type_of(inherent.def_id()).instantiate(cx, inherent_args).skip_norm_wip().into()
} else {
cx.const_of_item(inherent.def_id).instantiate(cx, inherent_args).skip_norm_wip().into()
cx.const_of_item(inherent.def_id())
Copy link
Copy Markdown
Contributor

@lcnr lcnr Apr 28, 2026

Choose a reason for hiding this comment

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

and here, I guess in general, I feel like most calls of AliasXXX::def_id are meh

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i would expect in the long run we just get rid of this method since not everything will have a DefId anymore

@BoxyUwU
Copy link
Copy Markdown
Member

BoxyUwU commented Apr 28, 2026

@Mark-Simulacrum

Do we think the refactor here is worth the slight regressions in instruction counts?

It would probably be good to look into if we can reduce the size of PredicateKind again and see if that helps. If it's not possible to get the perf back I think this is acceptable as this refactor is necessary for supporting inherent_associated_types and also inherent associated consts in const generics (as well as some other important stuff)

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

Labels

merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. PG-exploit-mitigations Project group: Exploit mitigations T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc 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.

9 participants