Skip to content

Replace Unique in Box with a (NonNull, PhantomData) wrapper - #162849

Open
maxdexh wants to merge 1 commit into
rust-lang:mainfrom
maxdexh:nuke-unique-in-box
Open

maxdexh wants to merge 1 commit into
rust-lang:mainfrom
maxdexh:nuke-unique-in-box

Conversation

@maxdexh

@maxdexh maxdexh commented Sep 16, 2026

Copy link
Copy Markdown
Member

View all comments

Follow-up to #162804

See zulip.

This is only the first step in actually refactoring Box, and is essentially just a rename.
The layout of Box stays as-is for now, due to #162850.

Needs perf run

@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. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 16, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@maxdexh

This comment was marked as resolved.

@rust-log-analyzer

This comment has been minimized.

@maxdexh
maxdexh marked this pull request as ready for review September 16, 2026 17:22
@rustbot

rustbot commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

miri is developed in its own repository. If the Miri part of this change can be broken out, consider making this change to rust-lang/miri instead. However, if Miri needs adjusting for rustc changes, just ignore this message.

cc @rust-lang/miri

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

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

rustbot commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 76 candidates
  • Random selection from 20 candidates

@maxdexh

maxdexh commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

@hanna-kruppe do you want to take this one too?

r? hanna-kruppe

Reroll libs if not, please (sorry, should have asked before marking the PR as ready)

@maxdexh

maxdexh commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

ignore rustbot, all changes outside libs were to test files ^^

@rustbot rustbot assigned hanna-kruppe and unassigned nnethercote Sep 16, 2026
@rustbot

rustbot commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

hanna-kruppe is currently at their maximum review capacity.
They may take a while to respond.

@hanna-kruppe

Copy link
Copy Markdown
Contributor

@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 Sep 18, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 18, 2026
Replace `Unique` in `Box` with a `(NonNull, PhantomData)` wrapper
@rust-bors

rust-bors Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 5b25bbf (5b25bbfa1be1e911397b56089384cce001a1a9e2)
Base parent: 420ed2a (420ed2a0c3d7225b1744266fd884d431b4d8cfe0)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (5b25bbf): 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 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.4% [0.3%, 0.5%] 3
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.3%] 2
All ❌✅ (primary) 0.4% [0.3%, 0.5%] 3

Max RSS (memory usage)

Results (primary -2.9%, secondary 1.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)
3.1% [2.6%, 3.6%] 2
Improvements ✅
(primary)
-2.9% [-2.9%, -2.9%] 1
Improvements ✅
(secondary)
-1.9% [-1.9%, -1.9%] 1
All ❌✅ (primary) -2.9% [-2.9%, -2.9%] 1

Cycles

Results (secondary 0.9%)

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)
4.3% [4.2%, 4.3%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.5% [-2.8%, -2.2%] 2
All ❌✅ (primary) - - 0

Binary size

Results (primary -0.3%, secondary -0.4%)

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
Improvements ✅
(primary)
-0.3% [-1.5%, -0.1%] 44
Improvements ✅
(secondary)
-0.4% [-0.8%, -0.2%] 14
All ❌✅ (primary) -0.3% [-1.5%, -0.1%] 44

Bootstrap: 498.333s -> 498.695s (0.07%)
Artifact size: 408.93 MiB -> 408.97 MiB (0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Sep 18, 2026
@RalfJung

Copy link
Copy Markdown
Member

@bors delegate try

Now you can do it :)

@rust-bors

rust-bors Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

✌️ @maxdexh, you can now perform try builds on this pull request!

You can now post @bors try to start a try build.

@maxdexh

This comment was marked as outdated.

@rust-bors

rust-bors Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Unknown argument "test-aarch64-apple-1,test-x86_64-msvc-1". Did you mean to use @bors jobs=<jobs>|parent=<parent>? Run @bors help or go to https://bors.rust-lang.org/help to see available commands.

@maxdexh

maxdexh commented Sep 20, 2026

Copy link
Copy Markdown
Member Author

@bors try jobs=test-aarch64-apple-1,test-x86_64-msvc-1

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 20, 2026
Replace `Unique` in `Box` with a `(NonNull, PhantomData)` wrapper


try-job: test-aarch64-apple-1
try-job: test-x86_64-msvc-1
@maxdexh

maxdexh commented Sep 20, 2026

Copy link
Copy Markdown
Member Author

I suspect the few compile time regressions are coming from my rewrite of Box::<str>::default. Hopefully this fixes that. Shouldn't affect the bors run.

@maxdexh

maxdexh commented Sep 20, 2026

Copy link
Copy Markdown
Member Author

Can I do another bors run for perf without cancelling the ongoing one?

@maxdexh

maxdexh commented Sep 20, 2026

Copy link
Copy Markdown
Member Author

yolo
@bors try @rust-timer queue

edit: rip, it cancelled them ^^

@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 Sep 20, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 20, 2026
Replace `Unique` in `Box` with a `(NonNull, PhantomData)` wrapper
@RalfJung

Copy link
Copy Markdown
Member

The answer is no, the 2nd try run cancels the first.

@rust-bors

rust-bors Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: ee81c60 (ee81c60a6e1754205bd38a27d0af4d502a4e1b42)
Base parent: fc7358c (fc7358c9223bbf6b30741438fc8588dad7e4671c)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (ee81c60): 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 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.4% [0.2%, 0.6%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.4%, -0.2%] 9
All ❌✅ (primary) 0.4% [0.2%, 0.6%] 4

Max RSS (memory usage)

Results (primary 0.1%)

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

mean range count
Regressions ❌
(primary)
2.9% [2.6%, 3.1%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.8% [-3.9%, -2.2%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [-3.9%, 3.1%] 6

Cycles

Results (secondary -2.4%)

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

Binary size

Results (primary 0.0%, 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.2% [0.0%, 0.4%] 64
Regressions ❌
(secondary)
0.1% [0.0%, 0.2%] 48
Improvements ✅
(primary)
-0.3% [-1.3%, -0.0%] 23
Improvements ✅
(secondary)
-0.3% [-0.6%, -0.0%] 9
All ❌✅ (primary) 0.0% [-1.3%, 0.4%] 87

Bootstrap: 500.549s -> 509.726s (1.83%)
Artifact size: 408.70 MiB -> 408.81 MiB (0.03%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 20, 2026
@maxdexh

maxdexh commented Sep 20, 2026

Copy link
Copy Markdown
Member Author

I guess that's better? It's not really what I expected to happen but okay

@maxdexh

maxdexh commented Sep 20, 2026

Copy link
Copy Markdown
Member Author

@bors try jobs=test-aarch64-apple-1,test-x86_64-msvc-1

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 20, 2026
Replace `Unique` in `Box` with a `(NonNull, PhantomData)` wrapper


try-job: test-aarch64-apple-1
try-job: test-x86_64-msvc-1
@rust-bors

rust-bors Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 76a8f8a (76a8f8ab565a4f05ad35f3fb67dfca69022a93e6)
Base parent: fc7358c (fc7358c9223bbf6b30741438fc8588dad7e4671c)

@maxdexh

maxdexh commented Sep 20, 2026

Copy link
Copy Markdown
Member Author

Awesome, I think this is ready then ^^

@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

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.

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. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants