-
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
Tracking Issue for const mem::discriminant
#69821
Comments
The intrinsic is already implemented in Miri, you can copy that to rustc if you want. If you do, please also submit a PR to Miri to remove the implementation there. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
make `mem::discriminant` const implements rust-lang#69821, which could be used as a tracking issue for `const_discriminant`. Should this be added to the meta tracking issue rust-lang#57563? @Lokathor
make `mem::discriminant` const implements rust-lang#69821, which could be used as a tracking issue for `const_discriminant`. Should this be added to the meta tracking issue rust-lang#57563? @Lokathor
mem::discriminant
It seems that |
@stephanemagnenat the const part of it is still unstable. rust/library/core/src/mem/mod.rs Lines 1014 to 1018 in d95745e
If you view nightly docs, it is much clearer, showing |
Thank you for the clarification! |
Btw, I saw on the PR (#69825) that people were asking for use cases to decide whether to stabilise this feature. I believe I have such a use case: I am making a parser for a DSL that must match existing data structures, and these can have members of various types. I thus have a custom |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
We reviewed this in today's @rust-lang/lang meeting. It looks like there are mentions of wanting a use case to justify making this available in |
I have another use case (currently I ended up using the |
@rfcbot fcp merge Adds // core::mem
pub const fn discriminant<T>(v: &T) -> Discriminant<T> Example use cases benefiting from const: #69821 (comment), #69821 (comment) |
Team member @dtolnay has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. 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. |
@rustbot labels +I-lang-nominated |
@rfcbot reviewed |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
@rustbot labels -I-lang-nominated |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
Const stabilize mem::discriminant Tracking issue: rust-lang#69821. This PR is a rebase of rust-lang#103893 to resolve conflicts in library/core/src/lib.rs (against rust-lang#102470 and rust-lang#110393).
Const stabilize mem::discriminant Tracking issue: rust-lang#69821. This PR is a rebase of rust-lang#103893 to resolve conflicts in library/core/src/lib.rs (against rust-lang#102470 and rust-lang#110393).
Closing this as it has been stabilised. |
The feature gate for the issue is
#![feature(const_discriminant)]
.History
mem::discriminant
const #69825Unresolved issues
The text was updated successfully, but these errors were encountered: