Skip to content

Simplify size/align_of_val<T: Sized> to size/align_of<T> instead#152689

Open
scottmcm wants to merge 2 commits intorust-lang:mainfrom
scottmcm:also-simplify-of-sized-val-alt
Open

Simplify size/align_of_val<T: Sized> to size/align_of<T> instead#152689
scottmcm wants to merge 2 commits intorust-lang:mainfrom
scottmcm:also-simplify-of-sized-val-alt

Conversation

@scottmcm
Copy link
Member

@scottmcm scottmcm commented Feb 16, 2026

This is relevant to things like Box<[u8; 1024]> where the drop looks at the size_of_val (since obviously it might be DST in general) but where we don't actually need to do that since it's always that same value for the Sized type.

(Equivalent to #152681, but flipped in the rebase so it can land before #152641 instead of depending on it.)

@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. labels Feb 16, 2026
@scottmcm
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 16, 2026
rust-bors bot pushed a commit that referenced this pull request Feb 16, 2026
Simplify `size/align_of_val<T: Sized>` to `size/align_of<T>` instead
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 16, 2026

☀️ Try build successful (CI)
Build commit: 85c1367 (85c13679ed60d98f876a8f50c0b7505fb1ea3260, parent: 139651428df86cf88443295542c12ea617cbb587)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (85c1367): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 1
Improvements ✅
(secondary)
-0.5% [-0.5%, -0.5%] 2
All ❌✅ (primary) -0.4% [-0.4%, -0.4%] 1

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (primary -2.4%, secondary 2.7%)

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

Binary size

Results (primary -0.3%)

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

Bootstrap: 482.657s -> 485.908s (0.67%)
Artifact size: 397.96 MiB -> 397.86 MiB (-0.03%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 16, 2026
@scottmcm
Copy link
Member Author

r? @cjgillot

@scottmcm scottmcm marked this pull request as ready for review February 16, 2026 06:29
@rustbot
Copy link
Collaborator

rustbot commented Feb 16, 2026

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 Feb 16, 2026
@cjgillot
Copy link
Contributor

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 17, 2026

📌 Commit 649e027 has been approved by cjgillot

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 Feb 17, 2026
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants