-
Notifications
You must be signed in to change notification settings - Fork 534
Add introductory text for editions #393
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Editions | ||
|
||
Before we get into the details of the language itself, we need to cover the | ||
concept of an "edition." | ||
|
||
An "edition" of Rust consists of a particular year. There are two editions of | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Change Not nit: Although really, we want the defining sentence to summarize the feature even if its gets expanded on later. See the comment on the core definition below for more on that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: "of Rust" is redundant in both places. |
||
Rust, currently: | ||
|
||
* Rust 2015 | ||
* Rust 2018 | ||
|
||
Conforming compilers are expected to: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reference isn't a specification (even if it's the closest to a specification we have), so we can't say what a conforming compiler is from that perspective and we don't have a specification. So we don't really have a definition of what a conforming compiler can be outside the reference and we don't want to define that here either. We can talk about "The compiler" referring to |
||
|
||
* Provide a flag allowing users to select an edition. | ||
* Default to the 2015 edition if no edition is selected. | ||
|
||
The reference follows this guideline; everything stated in this document is | ||
part of the 2015 edition unless specifically marked otherwise. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like a good policy for now, given how small the actual "made into an error" class of things is. |
||
|
||
## What editions can change | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels like the core definition of an edition, and IMO, should be before the list of years. We're also missing that it's a per-crate setting. And we want to talk about them today, and not just new ones. Perhaps something like (if not exactly)
Hmm, I just realized that this means that the deprecatedness of a feature and in which edition it was deprecated in are now part of the language proper (and in-scope for the reference) and not just a part of linting (which is currently out-of-scope for the reference) |
||
|
||
There are only two things a new edition can do: | ||
|
||
* Change an existing deprecation into a hard error. | ||
* Change an existing deprecation to deny by default, and leverage the | ||
corresponding lint setting to produce error messages as if the feature were | ||
removed entirely. | ||
|
||
As a corollary to this, these changes can free up space for new features, | ||
that would then require being tied to a particular edition. For example, | ||
consider the desire to add a new (non-contextual) keyword. For a keyword to | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Parenthesis are not needed. |
||
be added, a previous edition must deprecate using that keyword as an | ||
identifier. The new edition may then turn that into an error, freeing space | ||
for the addition of the keyword. | ||
|
||
Restricting what editions can do is important for both users and compiler | ||
authors; if Rust were to change drastically between editions, it would be | ||
difficult for users, who would need to switch between editions while using | ||
Rust, and compilers would be much harder to implement. |
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.
The general flow of the reference, as it stands today, is that you can jump in on any page. Unlike The Book, the reference assumes you know Rust well enough that you should be able to jump to any page and then link around to concepts you don't know. This paragraph seems to imply that the reference should be read from front to end, which is a change to that concept. If we don't want to change that, it'd be best to just remove this paragraph.