-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Show enum discriminant if a compatible repr is used #116600
Show enum discriminant if a compatible repr is used #116600
Conversation
let ty = cx.tcx().type_of(it.def_id().unwrap()).instantiate_identity(); | ||
let enum_def_id = ty.ty_adt_id().unwrap(); |
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.
I wish we didn't need to do this and could just store the DefId
of the inner item inside TypeAliasInnerType
and obtain it directly via adt.did()
in clean_ty_alias_inner_type
but that would increase the size of the type ... so your code is fine.
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.
Unfortunately yes. We could maybe add a helper method later on if we need to do it once again though.
r=me with nits addressed unless you'd like to fcp this (which I don't think is strictly necessary since we've briefly talked about it in the meeting). |
ff7612c
to
00c3de9
Compare
It was confirmed in the meeting with the rest so I think it's fine to go along. It should have been part of the previous PR, just completely forgot about it... |
@bors r+ rollup |
…nt, r=fmease Show enum discriminant if a compatible repr is used Follow-up of rust-lang#116142. It was mentioned in the [team meeting](https://rust-lang.zulipchat.com/#narrow/stream/393423-t-rustdoc.2Fmeetings/topic/meeting.2002-10-2023/near/394504024) that an enum with a `repr` should also get its discriminants displayed. Forgot to implement it in rust-lang#116142... It also allowed to uncover a bug: i was not providing the correct `DefId` in case it was a type alias to `render_enum_fields`. It's also fixed in this PR. r? `@fmease`
The job Click to see the possible cause of the failure (guessed by this bot)
|
💔 Test failed - checks-actions |
@bors retry |
☀️ Test successful - checks-actions |
Finished benchmarking commit (3ff244b): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 626.317s -> 627.587s (0.20%) |
50: Automated pull from upstream `master` r=Dajamante a=github-actions[bot] This PR pulls the following changes from the upstream repository: * rust-lang/rust#116619 * rust-lang/rust#115964 * rust-lang/rust#116391 * rust-lang/rust#116510 * rust-lang/rust#116671 * rust-lang/rust#116669 * rust-lang/rust#116654 * rust-lang/rust#116642 * rust-lang/rust#116625 * rust-lang/rust#116593 * rust-lang/rust#116649 * rust-lang/rust#116600 * rust-lang/rust#116628 Co-authored-by: Nadrieril <[email protected]> Co-authored-by: Scott McMurray <[email protected]> Co-authored-by: bjorn3 <[email protected]> Co-authored-by: Nicholas Nethercote <[email protected]> Co-authored-by: Trevor Gross <[email protected]> Co-authored-by: Georg Semmler <[email protected]> Co-authored-by: Guillaume Gomez <[email protected]> Co-authored-by: Gurinder Singh <[email protected]> Co-authored-by: bors <[email protected]>
Follow-up of #116142.
It was mentioned in the team meeting that an enum with a
repr
should also get its discriminants displayed. Forgot to implement it in #116142...It also allowed to uncover a bug: i was not providing the correct
DefId
in case it was a type alias torender_enum_fields
. It's also fixed in this PR.r? @fmease