Skip to content

Supertraits returns Unnormalized - #165538

Open
bit-aloo wants to merge 2 commits into
rust-lang:mainfrom
bit-aloo:2026-11-06-supertraits-unnormalized
Open

bit-aloo wants to merge 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

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
Collaborator

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

This branch has not been deployed

No deployments
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.

4 participants