Skip to content

Supertraits returns Unnormalized - #165538

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
bit-aloo:2026-11-06-supertraits-unnormalized
Nov 24, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
bit-aloo:2026-11-06-supertraits-unnormalized

Conversation

@bit-aloo

@bit-aloo bit-aloo commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

View all comments

part of #155345.

It gets thorny pretty quickly. I kept the changes minimal to make them easier to review, but it'll take some time to streamline everything.

r? @ShoyuVanilla

@rustbot

rustbot commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

HIR ty lowering was modified

cc @fmease

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-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 Nov 6, 2026
@rustbot

rustbot commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

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

@ShoyuVanilla ShoyuVanilla left a comment •

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.

Hmm, I'm a bit puzzled 🤔 I guess the big picture is that elaboration may return unnormalized trait bounds so let's mark them withUnnormalized wrapper and that feels correct to me. But this adds skip_normalization in some places while it adds skip_norm_wip in some other places. Could you explain me a bit?

View changes since this review

@bit-aloo

Copy link
Copy Markdown
Member Author

Hmm, I'm a bit puzzled 🤔 I guess the big picture is that elaboration may return unnormalized trait bounds so let's mark them withUnnormalized wrapper and that feels correct to me. But this adds skip_normalization in some places while it adds skip_norm_wip in some other places. Could you explain me a bit?

View changes since this review

The way I understand it, skip_normalization should be used when we're pretty sure the value will never need to be normalized. On the other hand, skip_norm_wip is for cases where we do intend to normalize the value eventually, just not right now. The long term plan is to get rid of skip_norm_wip across the codebase and instead use the unnormalized wrapper to pass these values around. So, while the goal is to remove most uses of skip_norm_wip, this pr actually introduces a few more 😛 . That's mainly because it's an intermediate step, and we will clean these up in subsequent prs.

@ShoyuVanilla ShoyuVanilla left a comment •

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.

Yeah, I'm aware what are those Unnormalized::*_wip methods for. What I was curious was the specific reason for the usages of Unnormalized::skip_normalization in each place in this PR 😅

But thinking again, I feel a bit more inclined to using skip_norm_wip instead because the current way we handle Unnormalized is pretty unprincipled and we already have skip_norm_wip in that module, though most them have been written in the adwin's initial work

View changes since this review

@ShoyuVanilla

ShoyuVanilla commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

BTW, I'd like to check the perf. Though this wouldn't affect the perf, I'd like to make it sure since next-solver is very close to the stabilization

@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 Nov 23, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 23, 2026
… r=<try>

Supertraits returns Unnormalized
@rust-bors

rust-bors Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: c92b081 (c92b081b28c7b2129940426f43587280631464e6)
Base parent: 5debe6a (5debe6a1244452beced762385f88a51857a915fc)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (c92b081): comparison URL.

Overall result: ❌ regressions - please read:

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

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=iffy rustc-perf
@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)
0.3% [0.0%, 0.5%] 11
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -0.7%, secondary 1.1%)

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

mean range count
Regressions ❌
(primary)
1.4% [1.4%, 1.4%] 1
Regressions ❌
(secondary)
2.4% [0.4%, 6.5%] 9
Improvements ✅
(primary)
-2.8% [-2.8%, -2.8%] 1
Improvements ✅
(secondary)
-1.4% [-2.4%, -0.6%] 5
All ❌✅ (primary) -0.7% [-2.8%, 1.4%] 2

Cycles

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)
1.4% [0.5%, 2.3%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.3% [-2.2%, -0.4%] 2
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 460.778s -> 463.041s (0.49%)
Artifact size: 405.75 MiB -> 405.74 MiB (-0.00%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Nov 23, 2026
@bit-aloo

Copy link
Copy Markdown
Member Author

But thinking again, I feel a bit more inclined to using skip_norm_wip instead because the current way we handle Unnormalized is pretty unprincipled and we already have skip_norm_wip in that module, though most them have been written in the adwin's initial work

Let me write the reasoning on all places where I used skip normalization.

Damn! how can these changes cause regression. 🫨

@ShoyuVanilla

ShoyuVanilla commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Yeah, that's surprising 🤔 I guess adding inline attribute on each Unnormalized method may improve them, though I don't think the perf regression here must be avoided

@rust-cloud-vms
rust-cloud-vms Bot force-pushed the 2026-11-06-supertraits-unnormalized branch from 50bdffe to 27aae54 Compare November 24, 2026 06:15
@bit-aloo

Copy link
Copy Markdown
Member Author

But thinking again, I feel a bit more inclined to using skip_norm_wip instead because the current way we handle Unnormalized is pretty unprincipled and we already have skip_norm_wip in that module, though most them have been written in the adwin's initial work

I replaced all usages of skip_normalization with skip_norm_wip. I think it's better to make this distinction once we've properly consolidated the unnormalized APIs, since they're pretty fragmented right now. Once this PR and my other related PR land, I can start consolidating things and hopefully remove at least a few usages of skip_norm_wip here and elsewhere.

@ShoyuVanilla ShoyuVanilla left a comment •

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.

r=me when CI is green

View changes since this review

@bit-aloo

Copy link
Copy Markdown
Member Author

@bors r= @ShoyuVanilla

@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Unknown value for argument "r". Run @bors help or go to https://bors.rust-lang.org/help to see available commands.

@bit-aloo

Copy link
Copy Markdown
Member Author

@bors r = @ShoyuVanilla

@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Unknown value for argument "". Run @bors help or go to https://bors.rust-lang.org/help to see available commands.

@bit-aloo

Copy link
Copy Markdown
Member Author

@bors r=ShoyuVanilla

@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 27aae54 has been approved by ShoyuVanilla

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 Nov 24, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 24, 2026
…normalized, r=ShoyuVanilla

Supertraits returns Unnormalized

part of rust-lang#155345.

It gets thorny pretty quickly. I kept the changes minimal to make them easier to review, but it'll take some time to streamline everything.

r? @ShoyuVanilla
rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #165538 (Supertraits returns Unnormalized)
 - #166033 (Abby: move span out of leaf region constraint)
 - #166399 (Add safety section for intrinsic volatile operations)
 - #166420 ([rustdoc] Fix search index generation: if crate content didn't change, it should generate the same search index)
@rust-bors

rust-bors Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
… r=ShoyuVanilla

Supertraits returns Unnormalized

part of #155345.

It gets thorny pretty quickly. I kept the changes minimal to make them easier to review, but it'll take some time to streamline everything.

r? @ShoyuVanilla
@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors try jobs=dist-apple-various

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
… r=<try>

Supertraits returns Unnormalized


try-job: dist-apple-various
@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors yield

@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Auto build was cancelled. Cancelled workflows:

The next pull request likely to be tested is #166456.

@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 901b90a (901b90a8e6093623f28f45aad9a8b44ee4858188)
Base parent: 058c701 (058c701055c4b6f60f622d616afc0349911c38c3)

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 24, 2026
…normalized, r=ShoyuVanilla

Supertraits returns Unnormalized

part of rust-lang#155345.

It gets thorny pretty quickly. I kept the changes minimal to make them easier to review, but it'll take some time to streamline everything.

r? @ShoyuVanilla
rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #166340 (Revert "implement const Iterator for Range - #156216")
 - #165345 (Remove the 'eq', 'eq_trace', and 'goals_to_obligations' methods from 'At')
 - #165538 (Supertraits returns Unnormalized)
 - #165794 (`consider_impl_candidate` tweaks)
 - #160752 (Avoid inference constraints from opaque blanket impls)
 - #163187 (add `scalbn` and `ilogb` methods on floats)
 - #164541 (Add regression test for #152415)
 - #164543 (Add regression test for #151316)
 - #165920 (Introduce compute_abi helper and ComputeCallConv trait)
 - #166313 (Move `rustdoc-ui` tests in the right folder)
 - #166420 ([rustdoc] Fix search index generation: if crate content didn't change, it should generate the same search index)
 - #166485 (Allow passing `--exact-match` and `--purge` to `x perf`)
@rust-bors
rust-bors Bot merged commit 4b59bb2 into rust-lang:main Nov 24, 2026
15 of 16 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 24, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
Rollup merge of #165538 - bit-aloo:2026-11-06-supertraits-unnormalized, r=ShoyuVanilla

Supertraits returns Unnormalized

part of #155345.

It gets thorny pretty quickly. I kept the changes minimal to make them easier to review, but it'll take some time to streamline everything.

r? @ShoyuVanilla
@bit-aloo
bit-aloo deleted the 2026-11-06-supertraits-unnormalized branch November 25, 2026 01:55
@ShoyuVanilla

Copy link
Copy Markdown
Member

About the perf regression:
The small but clear perf regressions here is unfortunate. Though this PR doesn't fix either existing bugs or issues, I think supertraits function returning Unnormalized clauses is semantically correct and less confusing so I think we could bear those regressions. And I hope that the regressions could be easily erased by other desirable works such as improving Unnormalized APIs or doing changes similar to this PR on elaborate module so that we can save few times of the fuss that wrapping and unwrapping inputs and outputs with Unnormalized

TDecking pushed a commit to TDecking/miri that referenced this pull request Nov 25, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#166340 (Revert "implement const Iterator for Range - rust-lang/rust#156216")
 - rust-lang/rust#165345 (Remove the 'eq', 'eq_trace', and 'goals_to_obligations' methods from 'At')
 - rust-lang/rust#165538 (Supertraits returns Unnormalized)
 - rust-lang/rust#165794 (`consider_impl_candidate` tweaks)
 - rust-lang/rust#160752 (Avoid inference constraints from opaque blanket impls)
 - rust-lang/rust#163187 (add `scalbn` and `ilogb` methods on floats)
 - rust-lang/rust#164541 (Add regression test for rust-lang/rust#152415)
 - rust-lang/rust#164543 (Add regression test for rust-lang/rust#151316)
 - rust-lang/rust#165920 (Introduce compute_abi helper and ComputeCallConv trait)
 - rust-lang/rust#166313 (Move `rustdoc-ui` tests in the right folder)
 - rust-lang/rust#166420 ([rustdoc] Fix search index generation: if crate content didn't change, it should generate the same search index)
 - rust-lang/rust#166485 (Allow passing `--exact-match` and `--purge` to `x perf`)
mehmettoplu-rs pushed a commit to mehmettoplu-rs/rustc_codegen_gcc that referenced this pull request Nov 27, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#166340 (Revert "implement const Iterator for Range - rust-lang/rust#156216")
 - rust-lang/rust#165345 (Remove the 'eq', 'eq_trace', and 'goals_to_obligations' methods from 'At')
 - rust-lang/rust#165538 (Supertraits returns Unnormalized)
 - rust-lang/rust#165794 (`consider_impl_candidate` tweaks)
 - rust-lang/rust#160752 (Avoid inference constraints from opaque blanket impls)
 - rust-lang/rust#163187 (add `scalbn` and `ilogb` methods on floats)
 - rust-lang/rust#164541 (Add regression test for rust-lang/rust#152415)
 - rust-lang/rust#164543 (Add regression test for rust-lang/rust#151316)
 - rust-lang/rust#165920 (Introduce compute_abi helper and ComputeCallConv trait)
 - rust-lang/rust#166313 (Move `rustdoc-ui` tests in the right folder)
 - rust-lang/rust#166420 ([rustdoc] Fix search index generation: if crate content didn't change, it should generate the same search index)
 - rust-lang/rust#166485 (Allow passing `--exact-match` and `--purge` to `x perf`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. PG-exploit-mitigations Project group: Exploit mitigations 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.

5 participants