Skip to content

Prefer T::SIZE over size_of::<T>() in core#159922

Draft
Lars-Schumann wants to merge 1 commit into
rust-lang:mainfrom
Lars-Schumann:sized-type-properties-size-core
Draft

Prefer T::SIZE over size_of::<T>() in core#159922
Lars-Schumann wants to merge 1 commit into
rust-lang:mainfrom
Lars-Schumann:sized-type-properties-size-core

Conversation

@Lars-Schumann

@Lars-Schumann Lars-Schumann commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Some context: #t-libs > Make more use of `SizedTypeProperties`

This only touches core and only changes size_of::<_>() -> _::SIZE to keep the scope manageable.

The motivation is mainly possible compile time wins and it's slightly more readable.

Since these were done mostly programmatically I will go over all changes again to make sure they are semantic no-ops and that no public docs were affected.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 25, 2026
@hanna-kruppe

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

Copy link
Copy Markdown
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 25, 2026
@rust-bors

This comment has been minimized.

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

Prefer `T::SIZE` over `size_of::<T>()` in `core`
@rust-bors

rust-bors Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 6261a9a (6261a9af143fa3d0be4e3bec0d53bb7fceb13bc6)
Base parent: da86f4d (da86f4d0726be475afbbffe40cb2f65741c51ad3)

@rust-timer

Copy link
Copy Markdown
Collaborator

Queued 6261a9a with parent da86f4d, future comparison URL.
There are currently 0 preceding artifacts in the queue.
It will probably take at least ~1.0 hours until the benchmark run finishes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-perf Status: Waiting on a perf run to be completed. 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.

4 participants