Uh oh!
There was an error while loading. Please reload this page.
RFC 2008: Enum Variants - #59376
Conversation
davidtwco
commented
Mar 23, 2019
I anticipate a lot of review comments so I'd appreciate any feedback and I'm happy to make any requested changes. I tried to split some of the later commits up to make it easier to review but unfortunately wasn't able to with the earlier commits that did the bulk of the refactoring. |
petrochenkov
commented
Mar 23, 2019
Looks like something went wrong during rebase because |
petrochenkov
commented
Mar 23, 2019
This work would benefit from splitting into two PRs - one for the |
davidtwco
commented
Mar 23, 2019
I may be mistaken, but isn’t this due to #58140 landing?
I’ll split this into two PRs. I wanted to make the RFC 2008 changes on top so that I could confirm that the refactoring did work as expected. |
petrochenkov
commented
Mar 23, 2019
Exactly. |
|
516fadf to
fa89ba1Compare
This comment has been minimized.
This comment has been minimized.
516f410 to
1b382f3CompareSeparate `DefId`s for variants and their constructors Part of #44109. Split off from #59376. See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140) for previous discussion. r? @petrochenkov
1b382f3 to
147a385Comparedavidtwco
commented
Mar 25, 2019
Rebased atop master now #59382 has landed, unblocked. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
08c4943 to
07de867Comparecc @rust-lang/rustdoc for the final commit which modifies rustdoc to extend existing non-exhaustive support to enum variants. |
Uh oh!
There was an error while loading. Please reload this page.
petrochenkov
commented
Mar 28, 2019
r=me for non-rustdoc changes |
This commit removes the check that disallows the `#[non_exhaustive]` attribute from being placed on enum variants and removes the associated tests. Further, this commit lowers the visibility of enum variant constructors when the variant is marked as non-exhaustive.
07de867 to
4de38faCompareGuillaumeGomez
commented
Mar 29, 2019
Does it generate a whole page for enum variants now? |
This commit updates the unstable book and diagnostics to reflect that the `#[non_exhaustive]` attribute is now available for enum variants.
This commit adds support for non-exhaustive enum variants in rustdoc, extending the existing support for non-exhaustive enums and structs.
4de38fa to
49a6da2Comparedavidtwco
commented
Mar 29, 2019
@GuillaumeGomez When an enum variant is marked as enumFoo{#[non_exhaustive]Unit,#[non_exhaustive]Tuple(u8,u8),#[non_exhaustive]Struct{x:u8,y:u8},}Then it is displayed like this: This expands to: For reference, here are the equivalent messages for structs (expanded) and enums (expanded). All that the final commit of this PR does is add support for these messages and make it so that the non-exhaustive sections always start collapsed (since they're a lot of repetitive text otherwise). |
GuillaumeGomez
commented
Mar 29, 2019
Ah I see! Looks good to me then. |
QuietMisdreavus
commented
Mar 29, 2019
Rustdoc code looks good. Thanks for the screenshots! @bors r=petrochenkov,QuietMisdreavus |
bors
commented
Mar 29, 2019
📌 Commit 49a6da2 has been approved by |
…, r=petrochenkov,QuietMisdreavus RFC 2008: Enum Variants Part of rust-lang#44109. See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140) for previous discussion. r? @petrochenkov cc @nikomatsakis
…, r=petrochenkov,QuietMisdreavus RFC 2008: Enum Variants Part of rust-lang#44109. See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140) for previous discussion. r? @petrochenkov cc @nikomatsakis
Rollup of 10 pull requests Successful merges: - #59376 (RFC 2008: Enum Variants) - #59453 (Recover from parse error in tuple syntax) - #59455 (Account for short-hand field syntax when suggesting borrow) - #59499 (Fix broken download link in the armhf-gnu image) - #59512 (implement `AsRawFd` for stdio locks) - #59525 (Whitelist some rustc attrs) - #59528 (Improve the dbg! macro docs ) - #59532 (In doc examples, don't ignore read/write results) - #59534 (rustdoc: collapse blanket impls in the same way as normal impls) - #59537 (Fix OnceWith docstring.) Failed merges: r? @ghost
Fix cross-crate visibility of fictive variant constructors After merging rust-lang#59376 I realized that the code in the decoder wasn't entirely correct - we "decoded" fictive variant constructors with their variant's visibility, which could be public, rather than demoted to `pub(crate)`. Fictive constructors are not directly usable in expression/patterns, but the effect still can be observed with imports. r? @davidtwco
Fix cross-crate visibility of fictive variant constructors After merging rust-lang#59376 I realized that the code in the decoder wasn't entirely correct - we "decoded" fictive variant constructors with their variant's visibility, which could be public, rather than demoted to `pub(crate)`. Fictive constructors are not directly usable in expression/patterns, but the effect still can be observed with imports. r? @davidtwco


Part of #44109. See Zulip topic for previous discussion.
r? @petrochenkov
cc @nikomatsakis