-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Tracking issue for feature(repr128); enums with 128-bit discriminants #56071
Comments
I actually double checked the RFC text and I didn't see mentions of |
It’s a generic feature tied to integers in the language. It is not mentioned in the RFC because it would’ve implemented along with the integers themselves lest the roadblocks didn’t show up. |
… r=jonas-schievink Mark `repr128` as `incomplete_features` As mentioned in rust-lang#56071 and noticed in rust-lang#77457, `repr(u128)` and `repr(i128)` do not work properly due to lack of LLVM support. We should thus warn users trying to use the feature that they may encounter ICEs when using it. Closes rust-lang#77457.
… r=jonas-schievink Mark `repr128` as `incomplete_features` As mentioned in rust-lang#56071 and noticed in rust-lang#77457, `repr(u128)` and `repr(i128)` do not work properly due to lack of LLVM support. We should thus warn users trying to use the feature that they may encounter ICEs when using it. Closes rust-lang#77457.
… r=jonas-schievink Mark `repr128` as `incomplete_features` As mentioned in rust-lang#56071 and noticed in rust-lang#77457, `repr(u128)` and `repr(i128)` do not work properly due to lack of LLVM support. We should thus warn users trying to use the feature that they may encounter ICEs when using it. Closes rust-lang#77457.
… r=jonas-schievink Mark `repr128` as `incomplete_features` As mentioned in rust-lang#56071 and noticed in rust-lang#77457, `repr(u128)` and `repr(i128)` do not work properly due to lack of LLVM support. We should thus warn users trying to use the feature that they may encounter ICEs when using it. Closes rust-lang#77457.
Is there any progress on this? My use-case is that I often use I don't know if that's enough of a convincing use-case but that would be really handy to have this working in stable. Is there any path forward that I could help with? Is LLVM debuginfo API still a blocker? |
I believe there hasn't been any progress on this since the original comment. |
I have a use-case also, using an enum to represent fixed amount denominations for a cryptocurrency in development. u128 is necessary/desirable to have enough divisibility. presently I am working around by defining the variants as a list (without integer values) and then using giant match statements to convert to/from. works, but is ugly. |
I mean, u64 allows up to 10^19, so I'm not sure what kinds of quantities you need to include. If we translate that into metric prefixes, that'd be all the way to exa (10^18). |
yes, well in fact we may use u64 in the end, but there has been discussion/debate around using u128 for greater divisibility, so our prototype code can build either way via a type alias. Unfortunately trying to use repr(u128) fails to compile, hence the workaround. There are other ways we could represent this. We don't have to use an enum at all. It is simply the data structure that seems most suited to the task, so I was (a bit) surprised to find that u128 doesn't work the same as other integer types. Symmetry is beautiful, and this lacks symmetry. |
…r=nagisa Pass 128-bit C-style enum enumerator values to LLVM Pass the full 128 bits of C-style enum enumerators through to LLVM. This means that debuginfo for C-style repr128 enums is now emitted correctly for DWARF platforms (as compared to not being correctly emitted on any platform). Tracking issue: rust-lang#56071
…r=nagisa Pass 128-bit C-style enum enumerator values to LLVM Pass the full 128 bits of C-style enum enumerators through to LLVM. This means that debuginfo for C-style repr128 enums is now emitted correctly for DWARF platforms (as compared to not being correctly emitted on any platform). Tracking issue: rust-lang#56071
… r=michaelwoerister Use the `enum2$` Natvis visualiser for repr128 C-style enums Use the preexisting `enum2$` Natvis visualiser to allow PDB debuggers to display fieldless `#[repr(u128)]]`/`#[repr(i128)]]` enums correctly. Tracking issue: rust-lang#56071 try-job: x86_64-msvc
As I find myself wanting to use this, I'm curious what the specific limitations of the current implementation are. Since the feature exists in the compiler, it would be nice to properly document what exactly doesn't work and what's blocked on LLVM's side, so that folks know what the main blockers to this feature are. |
AFAIK, the only issue remaining is that, in DWARF debuginfo for enums with fields (aka not C-style), LLVM truncates the discriminants to 64-bit integers (or triggers an LLVM assertion if they are enabled and the discriminant doesn't fit in a 64-bit integer). I couldn't find an upstream LLVM issue tracking this, so I've opened one at llvm/llvm-project#119655. Apart from that debuginfo issue I think this is ready to be stabilised. |
Would it be possible to temporarily disable debug info for DWARF in this case, stabilise the feature, and then re-enable debug info at a later time if/when the LLVM issue has been resolved? If I understand correctly that this is entirely due to debug info. |
It would definitely be possible to just omit discriminant values on the AFAIK, it's up to the lang team whether it would be acceptable to stabilise the feature without full debuginfo emission support or not. |
If you can already encounter this bug on stable with |
Since this nomination was made, the debuginfo issue with DWARF debuginfo generation for non-C-like
Original nomination statement below: @rustbot label +I-lang-nominated
The only known issue is with DWARF debuginfo generation for non-C-like enums, as the LLVM DWARF debuginfo backend currently truncates variant discriminant values to 64 bits (LLVM issue llvm/llvm-project#119655, this causes an LLVM assertion if LLVM assertions are enabled and the value doesn't fit in 64 bits). As a tempoarary workaround, |
The final LLVM debuginfo issue has been fixed by llvm/llvm-project#125578 🎉. I've requested a backport to LLVM 20. |
(I've updated the lang nomination statement to account for the debuginfo issue being fixed in LLVM 20.) |
So long as the observable behaviour of this works as expected, let's stabilize it. I don't think we need to block on things like perfect debuginfo or perfect code coverage or whatever, so long as compiler folks are fine with treating it as a QoI issue. |
…t, r=jieyouxu Add DWARF test case for non-C-like `repr128` enums LLVM 20 fixes DWARF debuginfo for non-C-like 128-bit enums: this PR adds a test case to the `repr128-dwarf` test to ensure that LLVM doesn't regress in the future. Tracking issue: rust-lang#56071
…t, r=jieyouxu Add DWARF test case for non-C-like `repr128` enums LLVM 20 fixes DWARF debuginfo for non-C-like 128-bit enums: this PR adds a test case to the `repr128-dwarf` test to ensure that LLVM doesn't regress in the future. Tracking issue: rust-lang#56071
…t, r=jieyouxu Add DWARF test case for non-C-like `repr128` enums LLVM 20 fixes DWARF debuginfo for non-C-like 128-bit enums: this PR adds a test case to the `repr128-dwarf` test to ensure that LLVM doesn't regress in the future. Tracking issue: rust-lang#56071
…t, r=jieyouxu Add DWARF test case for non-C-like `repr128` enums LLVM 20 fixes DWARF debuginfo for non-C-like 128-bit enums: this PR adds a test case to the `repr128-dwarf` test to ensure that LLVM doesn't regress in the future. Tracking issue: rust-lang#56071
…t, r=jieyouxu Add DWARF test case for non-C-like `repr128` enums LLVM 20 fixes DWARF debuginfo for non-C-like 128-bit enums: this PR adds a test case to the `repr128-dwarf` test to ensure that LLVM doesn't regress in the future. Tracking issue: rust-lang#56071
…t, r=jieyouxu Add DWARF test case for non-C-like `repr128` enums LLVM 20 fixes DWARF debuginfo for non-C-like 128-bit enums: this PR adds a test case to the `repr128-dwarf` test to ensure that LLVM doesn't regress in the future. Tracking issue: rust-lang#56071
…t, r=jieyouxu Add DWARF test case for non-C-like `repr128` enums LLVM 20 fixes DWARF debuginfo for non-C-like 128-bit enums: this PR adds a test case to the `repr128-dwarf` test to ensure that LLVM doesn't regress in the future. Tracking issue: rust-lang#56071
…t, r=jieyouxu Add DWARF test case for non-C-like `repr128` enums LLVM 20 fixes DWARF debuginfo for non-C-like 128-bit enums: this PR adds a test case to the `repr128-dwarf` test to ensure that LLVM doesn't regress in the future. Tracking issue: rust-lang#56071
…t, r=jieyouxu Add DWARF test case for non-C-like `repr128` enums LLVM 20 fixes DWARF debuginfo for non-C-like 128-bit enums: this PR adds a test case to the `repr128-dwarf` test to ensure that LLVM doesn't regress in the future. Tracking issue: rust-lang#56071
…t, r=jieyouxu Add DWARF test case for non-C-like `repr128` enums LLVM 20 fixes DWARF debuginfo for non-C-like 128-bit enums: this PR adds a test case to the `repr128-dwarf` test to ensure that LLVM doesn't regress in the future. Tracking issue: rust-lang#56071
Rollup merge of rust-lang#137643 - beetrees:repr128-dwarf-variant-test, r=jieyouxu Add DWARF test case for non-C-like `repr128` enums LLVM 20 fixes DWARF debuginfo for non-C-like 128-bit enums: this PR adds a test case to the `repr128-dwarf` test to ensure that LLVM doesn't regress in the future. Tracking issue: rust-lang#56071
Stabilisation report now available at #138285. |
This issue tracks
repr128
, i.e. "enums with 128-bit discriminant" as per rust-lang/rfcs#1504.Originally this was tracked in #35118.
- @nagisa
The text was updated successfully, but these errors were encountered: