Skip to content

Also simplify size/align_of_val<T: Sized> to size/align_of<T> instead#152681

Closed
scottmcm wants to merge 4 commits intorust-lang:mainfrom
scottmcm:also-simplify-of-sized-val
Closed

Also simplify size/align_of_val<T: Sized> to size/align_of<T> instead#152681
scottmcm wants to merge 4 commits intorust-lang:mainfrom
scottmcm:also-simplify-of-sized-val

Conversation

@scottmcm
Copy link
Member

@scottmcm scottmcm commented Feb 15, 2026

Follow-up to #152641

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.

@rustbot rustbot added A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` 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 Feb 15, 2026
_5 = std::intrinsics::align_of_val::<[u8; 1024]>(move _3) -> [return: bb2, unwind unreachable];
}

bb2: {
Copy link
Member Author

Choose a reason for hiding this comment

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

Conveniently, these extra blocks just disappear once the intrinsics are placed with constants.

@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
Also 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: c0dc515 (c0dc515acf5ddad0df0c3ff3ba7f87438f6f9c84, parent: 873b4beb0cc726493b94c8ef21f68795c04fbbc1)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c0dc515): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

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.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@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)
4.4% [0.2%, 16.1%] 4
Regressions ❌
(secondary)
0.4% [0.1%, 0.8%] 6
Improvements ✅
(primary)
-0.5% [-1.1%, -0.2%] 4
Improvements ✅
(secondary)
-1.1% [-3.2%, -0.2%] 17
All ❌✅ (primary) 2.0% [-1.1%, 16.1%] 8

Max RSS (memory usage)

Results (primary -1.3%)

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

mean range count
Regressions ❌
(primary)
2.4% [2.3%, 2.5%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.1% [-3.9%, -1.4%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -1.3% [-3.9%, 2.5%] 6

Cycles

Results (primary 12.2%, secondary -3.2%)

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

mean range count
Regressions ❌
(primary)
12.2% [12.2%, 12.2%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.2% [-3.9%, -2.6%] 3
All ❌✅ (primary) 12.2% [12.2%, 12.2%] 1

Binary size

Results (primary 0.3%, 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.6% [0.0%, 1.4%] 14
Regressions ❌
(secondary)
0.2% [0.0%, 0.4%] 8
Improvements ✅
(primary)
-0.4% [-0.8%, -0.0%] 5
Improvements ✅
(secondary)
-1.4% [-2.2%, -0.6%] 16
All ❌✅ (primary) 0.3% [-0.8%, 1.4%] 19

Bootstrap: 481.904s -> 482.488s (0.12%)
Artifact size: 397.95 MiB -> 396.01 MiB (-0.49%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Feb 16, 2026
@scottmcm
Copy link
Member Author

Closing in favour of #152689

@scottmcm scottmcm closed this Feb 16, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` perf-regression Performance regression. 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.

3 participants