Skip to content

Stabilize repr128 - #138285

Merged
bors merged 1 commit into
rust-lang:masterfrom
beetrees:repr128-stable
May 29, 2025
Merged

Stabilize repr128#138285
bors merged 1 commit into
rust-lang:masterfrom
beetrees:repr128-stable

Conversation

@beetrees

@beetreesbeetrees commented Mar 9, 2025

Copy link
Copy Markdown
Contributor

Stabilisation report

The repr128 feature (tracking issue) allows the use of #[repr(u128)] and #[repr(i128)] on enums in the same way that other primitive representations such as #[repr(u64)] can be used. For example:

#[repr(u128)]enumFoo{One = 1,Two,Big = u128::MAX,}#[repr(i128)]enumBar{HasThing(u16) = 42,HasSomethingElse(i64) = u64::MAXasi128 + 1,HasNothing,}

This is the final part of adding 128-bit integers to Rust (RFC 1504); all other parts of 128-bit integer support were stabilised in #49101 back in 2018.

From a design perspective, #[repr(u128)]/#[repr(i128)] function like #[repr(u64)]/#[repr(i64)] but for 128-bit integers instead of 64-bit integers. The only differences are:

  • FFI safety: as u128/i128 are not currently considered FFI safe, neither are #[repr(u128)]/#[repr(i128)] enums (I discovered this wasn't the case while drafting this stabilisation report, so I have submitted Add #[repr(u128)]/#[repr(i128)] enums to improper_ctypes_definitions #138282 to fix this).
  • Debug info: while none of the major debuggers currently support 128-bit integers, as of LLVM 20 rustc will emit valid debuginfo for both DWARF and PDB (PDB makes use of the same natvis that is also used for all enums with fields, whereas DWARF has native support).

Tests for #[repr(u128)]/#[repr(i128)] enums include:

Stabilising this feature does not require any changes to the Rust Reference as the documentation on primitive representations already includes u128 and i128.

Closes#56071
Closesrust-lang/reference#1368

r? lang

@rustbot label +I-lang-nominated +T-lang

@rustbotrustbot added A-run-make Area: port run-make Makefiles to rmake.rs A-rustdoc-json Area: Rustdoc JSON backend A-rustdoc-search Area: Rustdoc's search feature A-tidy Area: The tidy tool S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Mar 9, 2025
@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred in tests/rustdoc-json

cc @aDotInTheVoid

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

This PR modifies run-make tests.

cc @jieyouxu

@rustbotrustbot added T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. I-lang-nominated Nominated for discussion during a lang team meeting. labels Mar 9, 2025
@rustbotrustbot added the T-lang Relevant to the language team label Mar 9, 2025
@aDotInTheVoidaDotInTheVoid removed A-rustdoc-search Area: Rustdoc's search feature T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Mar 9, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 9, 2025
…3, r=compiler-errors
triagebot.toml: Don't label `test/rustdoc-json` as A-rustdoc-search (…
Followup to rust-lang#137958. I managed to miss a place, as shown by the questionable labeling of rust-lang#138285.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 10, 2025
…3, r=compiler-errors
triagebot.toml: Don't label `test/rustdoc-json` as A-rustdoc-search (…
Followup to rust-lang#137958. I managed to miss a place, as shown by the questionable labeling of rust-lang#138285.
@jieyouxujieyouxu self-assigned this Mar 10, 2025
@traviscrosstraviscross removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Mar 10, 2025
@traviscross

Copy link
Copy Markdown
Contributor

@rfcbot fcp merge

Clearly, I think, we want this if we're sure it's ready (if nothing else from the perspective of consistency and minimizing caveats in our language specification). Let's start FCP, ping people, and file a concern to order this with respect to #137306.

@rfcbot

rfcbot commented Mar 10, 2025

Copy link
Copy Markdown

Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members:

Concerns:

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rfcbotrfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Mar 10, 2025
@traviscross

traviscross commented Mar 10, 2025

Copy link
Copy Markdown
Contributor

cc @rust-lang/opsem @rust-lang/wg-llvm @wesleywiser@workingjubilee@chorman0773@RalfJung@bjorn3@ehuss

@rustbotrustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label May 28, 2025
@beetrees

Copy link
Copy Markdown
ContributorAuthor

Fixed with a rebase.

@rustbot ready

@rustbotrustbot 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 May 28, 2025
@bjorn3

Copy link
Copy Markdown
Member

@bors r=traviscross,bjorn3

@bors

bors commented May 28, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 467eeab has been approved by traviscross,bjorn3

It is now in the queue for this repository.

@borsbors 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 May 28, 2025
@tgross35tgross35 mentioned this pull request May 28, 2025
@tgross35tgross35 mentioned this pull request May 28, 2025
@jhprattjhpratt mentioned this pull request May 29, 2025
@bors
bors merged commit 8951c74 into rust-lang:masterMay 29, 2025
@rustbotrustbot added this to the 1.89.0 milestone May 29, 2025
@beetrees
beetrees deleted the repr128-stable branch May 29, 2025 12:05
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-run-makeArea: port run-make Makefiles to rmake.rsA-rustdoc-jsonArea: Rustdoc JSON backendA-tidyArea: The tidy tooldisposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.relnotesMarks issues that should be documented in the release notes of the next release.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-langRelevant to the language team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Primitive representations don't allow 128-bit types Tracking issue for feature(repr128); enums with 128-bit discriminants

13 participants

@beetrees@rustbot@traviscross@rfcbot@scottmcm@tmandry@RalfJung@bjorn3@bors@jieyouxu@apiraino@tgross35@aDotInTheVoid