Rearrange the generics chapter#2165
Open
ehuss wants to merge 24 commits intorust-lang:masterfrom
Open
Conversation
This comment has been minimized.
This comment has been minimized.
Contributor
Author
|
I have pushed up some updates and I think this is now ready for review. I ultimately decided to go ahead and move each generic kind into a dedicated chapter, even though the current content is a bare-bones skeleton. |
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.
Preparing to split into multiple subchapters.
This makes some small editorial and rule name updates to prepare the Generics chapter for having separate sections on parameters, arguments, and the different generic kinds.
Organizationally I think it makes more sense, since this chapter is all about defining bounds.
This follows the intended style that intros come first in a section.
This moves the generic args so that the Generics chapter is whole, and covers all the aspects of generics.
This is just cleanup for clarity, and being more direct on what exactly they are.
This may not be terribly useful, but it felt awkward not having something here.
This rewrites the intro to be a little more precise about the different kinds of arguments.
This will cover the rules specific to arguments.
This moves generics.arguments.complex-const-params and generics.const.argument.const-expr to the const arguments section. These rules have been reworked to simplify how they are presented.
…tion Move this rule to the arguments section since it is pertaining to arguments.
This adds a whole section describing how generic arguments are matched with their parameters.
This adds some rules explaining the basics of this. Of course the actual inference algorithm should eventually be described.
This adds a section with rules describing associated item constraints. I'm not 100% certain this is the best chapter layout to place this section. Perhaps it should go somewhere else? I have intentionally used the terminology "associated item constraint" even though it is currently only *types* that are constrained. My intention is that once MCGA is stabilized, it will also include consts.
Attributes can go on any kind of generic parameter
This was stabilized in 1.37 (via rust-lang/rust#61547), but the documentation here was never updated. There is a longer history of these being stabilized and then `cfg` being removed and then added again, see rust-lang/rust#48848 rust-lang/rust#51279 rust-lang/rust#51283.
This is only a bare-bones skeleton. The intent is that this should get filled out with more rules specific to generic lifetimes.
This is only a bare-bones skeleton. The intent is that this should get filled out with more rules specific to generic types.
Collaborator
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This rearranges things so that there is a comprehensive "Generics" chapter under "Types" that covers the various aspects of generics. The general outline is:
There's a little more reworking such as mentioned in #925 about reworking the "Generic functions", but I didn't feel like doing more extensive rewriting at this time.