-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
RFC 2008: Variants #52775
RFC 2008: Variants #52775
Conversation
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.
r=me but let's let @petrochenkov review
ty::VariantDef { | ||
did, | ||
name, | ||
discr, | ||
fields, | ||
ctor_kind: CtorKind::from_hir(def), | ||
can_extend_field_list: tcx.has_attr(did, "non_exhaustive"), |
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.
One weird thing -- I'm not sure how this will work -- the did
in the case of a tuple-struct is I think the synthetic def-id creator for the struct constructor? We just need to be sure to test #[non_exhaustive] pub struct Foo(pub u32)
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.
well I guess we have some tests for that already so... seems ok.
Hm, this is not actually an implementation of RFC 2008, it's something else. This PR requires tuple struct patterns to mention This doesn't provide required future-proofing since The original PR didn't implement (Note that |
Thanks @petrochenkov. I'll close this PR for now and a new one can be opened with a proper implementation of RFC 2008 for variants once the preliminary work to support different visibilities of variants and constructors has been completed (I'm happy to work on this and anything blocking it if provided some pointers on what needs changed). |
Part of #44109.
r? @nikomatsakis