Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize repr128 #138285

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Stabilize repr128 #138285

wants to merge 1 commit into from

Conversation

beetrees
Copy link
Contributor

@beetrees beetrees commented Mar 9, 2025

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)]
enum Foo {
    One = 1,
    Two,
    Big = u128::MAX,
}

#[repr(i128)]
enum Bar {
    HasThing(u16) = 42,
    HasSomethingElse(i64) = u64::MAX as i128 + 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

r? lang

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

@rustbot rustbot 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
Collaborator

rustbot commented Mar 9, 2025

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

@rustbot rustbot 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
@rustbot rustbot added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Mar 9, 2025
@aDotInTheVoid aDotInTheVoid 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.
@jieyouxu jieyouxu self-assigned this Mar 10, 2025
@traviscross traviscross 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
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
Copy link

rfcbot commented Mar 10, 2025

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.

@rfcbot rfcbot 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
Copy link
Contributor

traviscross commented Mar 10, 2025

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

@traviscross
Copy link
Contributor

It seems most straightforward if we decide on the details of #137306 first, so let's file a concern to that effect.

@rfcbot concern decide-on-137306

@traviscross traviscross changed the title Stabilise repr128 Stabilize repr128 Mar 10, 2025
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.
@jieyouxu jieyouxu removed their assignment Mar 10, 2025
jieyouxu added a commit to jieyouxu/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.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 11, 2025
Rollup merge of rust-lang#138286 - aDotInTheVoid:aDotInTheVoid-patch-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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs A-rustdoc-json Area: Rustdoc JSON backend A-tidy Area: The tidy tool disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. I-lang-nominated Nominated for discussion during a lang team meeting. proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking issue for feature(repr128); enums with 128-bit discriminants
6 participants