-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Stabilize repr128
#138285
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
base: master
Are you sure you want to change the base?
Stabilize repr128
#138285
Conversation
Some changes occurred in tests/rustdoc-json Some changes occurred in src/tools/clippy cc @rust-lang/clippy This PR modifies cc @jieyouxu |
…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.
…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.
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. |
cc @rust-lang/opsem @rust-lang/wg-llvm @wesleywiser @workingjubilee @chorman0773 @RalfJung @bjorn3 @ehuss |
@@ -612,8 +612,6 @@ declare_features! ( | |||
(incomplete, ref_pat_eat_one_layer_2024_structural, "1.81.0", Some(123076)), | |||
/// Allows using the `#[register_tool]` attribute. | |||
(unstable, register_tool, "1.41.0", Some(66079)), | |||
/// Allows the `#[repr(i128)]` attribute for enums. | |||
(incomplete, repr128, "1.16.0", Some(56071)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this have been marked as non-incomplete feature first when it got fully fixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably. I did have a PR open to do so at #137592, but it didn't get reviewed before this PR was ready so I closed it in favour of this PR.
In any case, based on reading the tracking issue, I do believe all blockers are resolved. @bors r=traviscross,bjorn3 |
…ross,bjorn3 Stabilize `repr128` ## Stabilisation report The `repr128` feature ([tracking issue](rust-lang#56071)) 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: ```rust #[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](https://rust-lang.github.io/rfcs/1504-int128.html)); all other parts of 128-bit integer support were stabilised in rust-lang#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 rust-lang#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: - [ui/enum-discriminant/repr128.rs](https://github.com/rust-lang/rust/blob/385970f0c1fd0c09bac426b02f38300c0b1ba9a2/tests/ui/enum-discriminant/repr128.rs): checks that 128-bit enum discriminants have the correct values. - [debuginfo/msvc-pretty-enums.rs](https://github.com/rust-lang/rust/blob/385970f0c1fd0c09bac426b02f38300c0b1ba9a2/tests/debuginfo/msvc-pretty-enums.rs): checks the PDB debuginfo is correct. - [run-make/repr128-dwarf](https://github.com/rust-lang/rust/blob/385970f0c1fd0c09bac426b02f38300c0b1ba9a2/tests/run-make/repr128-dwarf/rmake.rs): checks the DWARF debuginfo is correct. Stabilising this feature does not require any changes to the Rust Reference as [the documentation on primitive representations](https://doc.rust-lang.org/nightly/reference/type-layout.html#r-layout.repr.primitive.intro) already includes `u128` and `i128`. Closes rust-lang#56071 Closes rust-lang/reference#1368 r? lang `@rustbot` label +I-lang-nominated +T-lang
I think you missed a feature gate in
Rollup failure: #141688 (comment) @bors r- |
This comment was marked as resolved.
This comment was marked as resolved.
Fixed with a rebase. @rustbot ready |
@bors r=traviscross,bjorn3 |
…ross,bjorn3 Stabilize `repr128` ## Stabilisation report The `repr128` feature ([tracking issue](rust-lang#56071)) 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: ```rust #[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](https://rust-lang.github.io/rfcs/1504-int128.html)); all other parts of 128-bit integer support were stabilised in rust-lang#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 rust-lang#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: - [ui/enum-discriminant/repr128.rs](https://github.com/rust-lang/rust/blob/385970f0c1fd0c09bac426b02f38300c0b1ba9a2/tests/ui/enum-discriminant/repr128.rs): checks that 128-bit enum discriminants have the correct values. - [debuginfo/msvc-pretty-enums.rs](https://github.com/rust-lang/rust/blob/385970f0c1fd0c09bac426b02f38300c0b1ba9a2/tests/debuginfo/msvc-pretty-enums.rs): checks the PDB debuginfo is correct. - [run-make/repr128-dwarf](https://github.com/rust-lang/rust/blob/385970f0c1fd0c09bac426b02f38300c0b1ba9a2/tests/run-make/repr128-dwarf/rmake.rs): checks the DWARF debuginfo is correct. Stabilising this feature does not require any changes to the Rust Reference as [the documentation on primitive representations](https://doc.rust-lang.org/nightly/reference/type-layout.html#r-layout.repr.primitive.intro) already includes `u128` and `i128`. Closes rust-lang#56071 Closes rust-lang/reference#1368 r? lang `@rustbot` label +I-lang-nominated +T-lang
Rollup of 7 pull requests Successful merges: - #125087 (Optimize `Seek::stream_len` impl for `File`) - #133823 (Use `cfg_attr_trace` in AST with a placeholder attribute for accurate suggestion) - #138285 (Stabilize `repr128`) - #139994 (add `CStr::display`) - #141477 (Path::with_extension: show that it adds an extension where one did no…) - #141533 (clean up old rintf leftovers) - #141693 (Subtree update of `rust-analyzer`) r? `@ghost` `@rustbot` modify labels: rollup
…ross,bjorn3 Stabilize `repr128` ## Stabilisation report The `repr128` feature ([tracking issue](rust-lang#56071)) 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: ```rust #[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](https://rust-lang.github.io/rfcs/1504-int128.html)); all other parts of 128-bit integer support were stabilised in rust-lang#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 rust-lang#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: - [ui/enum-discriminant/repr128.rs](https://github.com/rust-lang/rust/blob/385970f0c1fd0c09bac426b02f38300c0b1ba9a2/tests/ui/enum-discriminant/repr128.rs): checks that 128-bit enum discriminants have the correct values. - [debuginfo/msvc-pretty-enums.rs](https://github.com/rust-lang/rust/blob/385970f0c1fd0c09bac426b02f38300c0b1ba9a2/tests/debuginfo/msvc-pretty-enums.rs): checks the PDB debuginfo is correct. - [run-make/repr128-dwarf](https://github.com/rust-lang/rust/blob/385970f0c1fd0c09bac426b02f38300c0b1ba9a2/tests/run-make/repr128-dwarf/rmake.rs): checks the DWARF debuginfo is correct. Stabilising this feature does not require any changes to the Rust Reference as [the documentation on primitive representations](https://doc.rust-lang.org/nightly/reference/type-layout.html#r-layout.repr.primitive.intro) already includes `u128` and `i128`. Closes rust-lang#56071 Closes rust-lang/reference#1368 r? lang ``@rustbot`` label +I-lang-nominated +T-lang
Rollup of 8 pull requests Successful merges: - #125087 (Optimize `Seek::stream_len` impl for `File`) - #138285 (Stabilize `repr128`) - #139994 (add `CStr::display`) - #141477 (Path::with_extension: show that it adds an extension where one did no…) - #141533 (clean up old rintf leftovers) - #141690 (Add `rustc_diagnostic_item` to `sys::Mutex` methods) - #141693 (Subtree update of `rust-analyzer`) - #141702 (Add eholk to compiler reviewer rotation) r? `@ghost` `@rustbot` modify labels: rollup
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: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: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 toimproper_ctypes_definitions
#138282 to fix this).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
andi128
.Closes #56071
Closes rust-lang/reference#1368
r? lang
@rustbot label +I-lang-nominated +T-lang