library: core: document layout guarantee of TypeId by dakr · Pull Request #148265 · rust-lang/rust (original) (raw)

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

@dakr

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-libs

Relevant to the library team, which will review and decide on the PR/issue.

labels

Oct 29, 2025

@scottmcm scottmcm added the needs-fcp

This change is insta-stable, or significant enough to need a team FCP to proceed.

label

Oct 29, 2025

scottmcm

@scottmcm scottmcm added T-libs-api

Relevant to the library API team, which will review and decide on the PR/issue.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

I-libs-api-nominated

Nominated for discussion during a libs-api team meeting.

I-compiler-nominated

Nominated for discussion during a compiler team meeting.

and removed T-libs

Relevant to the library team, which will review and decide on the PR/issue.

labels

Oct 30, 2025

Noratrieb

Noratrieb

@ojeda ojeda mentioned this pull request

Oct 30, 2025

19 tasks

programmerjake

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Nov 3, 2025

@matthiaskrgr

…uarantees, r=scottmcm

Make explicit that TypeId's layout and size are unstable

Or worded differently, explicitly remark non-stable-guarantee of TypeId layout and size.

This PR makes no additional guarantees or non-guarantees, it only emphasizes that TypeId's size and layout are unstable like any other #[repr(Rust)] types.

This was discussed during #t-compiler/meetings > &rust-lang#91;weekly&rust-lang#93; 2025-10-30 @ 💬, where the compiler team discussed a request rust-lang#148265 to have the standard library (and language) commit to TypeId guaranteeing a size upper bound of 16 bytes. In the meeting, the consensus was:

Given that we have previously broken people who asserted the size of TypeId is 8 bytes, it was also discussed in the meeting that we should explicitly note that the size and layout of TypeId is not a stable guarantee, and is subject to changes between Rust releases, and thus cannot be relied upon -- if breakage in people's code is due to that assumption, it will be considered a won't-fix.

r? @scottmcm (or libs/libs-api/lang)

rust-timer added a commit that referenced this pull request

Nov 3, 2025

@rust-timer

Rollup merge of #148394 - jieyouxu:remark-typeid-no-layout-guarantees, r=scottmcm

Make explicit that TypeId's layout and size are unstable

Or worded differently, explicitly remark non-stable-guarantee of TypeId layout and size.

This PR makes no additional guarantees or non-guarantees, it only emphasizes that TypeId's size and layout are unstable like any other #[repr(Rust)] types.

This was discussed during #t-compiler/meetings > [weekly] 2025-10-30 @ 💬, where the compiler team discussed a request #148265 to have the standard library (and language) commit to TypeId guaranteeing a size upper bound of 16 bytes. In the meeting, the consensus was:

Given that we have previously broken people who asserted the size of TypeId is 8 bytes, it was also discussed in the meeting that we should explicitly note that the size and layout of TypeId is not a stable guarantee, and is subject to changes between Rust releases, and thus cannot be relied upon -- if breakage in people's code is due to that assumption, it will be considered a won't-fix.

r? @scottmcm (or libs/libs-api/lang)

github-actions bot pushed a commit to rust-lang/miri that referenced this pull request

Nov 4, 2025

@matthiaskrgr

…, r=scottmcm

Make explicit that TypeId's layout and size are unstable

Or worded differently, explicitly remark non-stable-guarantee of TypeId layout and size.

This PR makes no additional guarantees or non-guarantees, it only emphasizes that TypeId's size and layout are unstable like any other #[repr(Rust)] types.

This was discussed during #t-compiler/meetings > [weekly] 2025-10-30 @ 💬, where the compiler team discussed a request rust-lang/rust#148265 to have the standard library (and language) commit to TypeId guaranteeing a size upper bound of 16 bytes. In the meeting, the consensus was:

Given that we have previously broken people who asserted the size of TypeId is 8 bytes, it was also discussed in the meeting that we should explicitly note that the size and layout of TypeId is not a stable guarantee, and is subject to changes between Rust releases, and thus cannot be relied upon -- if breakage in people's code is due to that assumption, it will be considered a won't-fix.

r? @scottmcm (or libs/libs-api/lang)

github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request

Nov 30, 2025

@matthiaskrgr

…uarantees, r=scottmcm

Make explicit that TypeId's layout and size are unstable

Or worded differently, explicitly remark non-stable-guarantee of TypeId layout and size.

This PR makes no additional guarantees or non-guarantees, it only emphasizes that TypeId's size and layout are unstable like any other #[repr(Rust)] types.

This was discussed during #t-compiler/meetings > [weekly] 2025-10-30 @ 💬, where the compiler team discussed a request rust-lang#148265 to have the standard library (and language) commit to TypeId guaranteeing a size upper bound of 16 bytes. In the meeting, the consensus was:

Given that we have previously broken people who asserted the size of TypeId is 8 bytes, it was also discussed in the meeting that we should explicitly note that the size and layout of TypeId is not a stable guarantee, and is subject to changes between Rust releases, and thus cannot be relied upon -- if breakage in people's code is due to that assumption, it will be considered a won't-fix.

r? @scottmcm (or libs/libs-api/lang)