Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upEpoch.Next Tracking Issue #46889
Comments
nikomatsakis
added
C-tracking-issue
T-core
labels
Dec 20, 2017
kennytm
added
the
metabug
label
Dec 20, 2017
This comment has been minimized.
This comment has been minimized.
nyarly
commented
Dec 21, 2017
|
the tracking issue link for "Clarify and streamline paths" links to the issue for NLLs. |
This comment has been minimized.
This comment has been minimized.
tcr
commented
Dec 21, 2017
This comment has been minimized.
This comment has been minimized.
|
Fixed, thanks! |
This comment has been minimized.
This comment has been minimized.
glyn
commented
Dec 21, 2017
This comment has been minimized.
This comment has been minimized.
|
Looking forward to those ownership improvements :) |
This comment has been minimized.
This comment has been minimized.
|
@glyn Fixed, thanks! |
This comment has been minimized.
This comment has been minimized.
|
Should specialization and macros 2.0 be tracked here? |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis - Not sure if anyone else mentioned it, but NLL says "This feature is blocked on #46862 landing." which has now landed. |
This comment has been minimized.
This comment has been minimized.
|
@jonathandturner updated, though nightly still does seem to have the changes. |
This comment has been minimized.
This comment has been minimized.
I don't think either of those are on track to be part of the next epoch. Specialization no, because it is not on track -- design is still very much in flux. I feel similarly about Macros 2.0 -- for example, there is no RFC or description of the hygiene system. Note though that not being "part of the epoch" won't necessarily delay features from being available. The epoch is more of an end-point: basically a way to say "hey, a coherent set of features and associated tooling and documentation has landed -- you should give Rust another look!". |
This comment has been minimized.
This comment has been minimized.
nixpulvis
commented
Dec 22, 2017
•
|
Awesome to see so much great work in this! Where does the work on const items, and constants in types land in respect to the Epoch system? |
This comment has been minimized.
This comment has been minimized.
|
The description of the
|
This comment has been minimized.
This comment has been minimized.
|
What about const generics? Currently for me it's the most expected feature and I think it will be good for marketing to include it into the new epoch features list. |
This comment has been minimized.
This comment has been minimized.
|
@newpavlov New features should only be part of an epoch if they require a change which is not backwards compatible. Otherwise the feature should land normally so that people aren't forced to update their code for the new epoch just to gain access to that feature. Shoving something into an epoch just for the sake of marketing is a bad idea. |
This comment has been minimized.
This comment has been minimized.
|
@retep998 |
This comment has been minimized.
This comment has been minimized.
MoSal
commented
Dec 25, 2017
|
I wouldn't consider |
This comment has been minimized.
This comment has been minimized.
|
#46479 ( |
This comment has been minimized.
This comment has been minimized.
gamozolabs
commented
Jan 12, 2018
|
Can we change the legend/keys to be colorblind friendly (different shapes for each key)? I can't tell the difference between the two hearts. |
This comment has been minimized.
This comment has been minimized.
|
I've updated the previous green heart ( |
This comment has been minimized.
This comment has been minimized.
Sorry about that -- I was actually trying to be colorblind friendly by having at least have the red/green keys have a distinct shape, but I guess I should have further. =) |
This comment has been minimized.
This comment has been minimized.
|
@nikomatsakis - any guidance on what makes the epoch.next list? I know some folks are going to ask about features like const generics and no doubt others. |
This comment has been minimized.
This comment has been minimized.
|
Const generics seems like a pretty big feature to try to finish this year and get it to stable... |
Centril
added
the
WG-epoch
label
Mar 6, 2018
This comment has been minimized.
This comment has been minimized.
BatmanAoD
commented
Mar 14, 2018
|
Should async/await be added to this list, given the recent design breakthroughs (described in the @withoutboats blog posts) and the inclusion in the 2018 Roadmap? |
This comment has been minimized.
This comment has been minimized.
|
We have to figure out just how to manage this issue -- I wouldn't take this as an exhaustive list just now. |
This comment has been minimized.
This comment has been minimized.
|
Closing this, seems out of date |
nikomatsakis commentedDec 20, 2017
•
edited
What is this issue?
Have you noticed that there is a lot going on with Rust these days? Over the last year, there’s been a large push to design a number of tweaks to the Rust language, all with the goal of improving ergonomics and productivity for new and experienced users alike. This issue will help you see what changes are in the works and give you tips for trying them out, giving feedback, or helping to get them implemented.
Legend
Ownership
#![feature(match_default_bindings)]Matching over borrowed data today in Rust requires a combination of
*operators,&patterns, andrefbindings. Thematch_default_bindingsfeature replaces them with a simpler system; when matching against a value of type&T, you can simply ignore the&and give a pattern that matches the underlying typeT. Any bindings in that pattern will be made into references themselves.Example
Simple example matching an
&Option<String>::What’s left to be done?
Not much. There are a few corner cases that we might want to fine-tune: see the tracking issue for the full details.
#![feature(nll)]The compiler is now able to understand control flow much more deeply when deciding what paths are borrowed at any particular point in the program. These changes eliminate a large number of confusing borrowing errors, particularly those errors that are due more to imprecision in the analysis.
Examples
Borrow lifetimes are no longer tied to lexical scopes.
Invoking
&mut selfmethods no longer requires “unnesting”:What’s left to be done?
There is still some engineering effort remaining. For example, some of the error messages are not yet particularly user friendly. In addition, we need to tighten some of the corner cases described in the various RFCs (these are not soundness issues per se, but rather cases where we fear that the analysis may not be forwards compatible with future changes we have in mind).
We will be transitioning to the new borrow system, but slowly. We plan to run a “trial period” where we gather feedback and try to find bugs. We also need to do a “warning period” before enabling the new borrowing system by default, as the new system fixes a number of bugs where the compiler incorrectly accepted illegal code (the new implementation is believed to be significantly more robust).
#![feature(underscore_lifetimes, in_band_lifetimes)]#![warn(single_use_lifetime, elided_lifetime_in_path)]The current rules that govern explicit lifetime names have some confusing edge cases. These can lead to surprising errors that are hard to diagnose. In addition, the existing annotations can be tedious to supply and get right. The in-band lifetimes RFC aims to adjust the rules to make for a smoother experience overall.
Warning: while the major features of this RFC are in place, some of the lints are not yet fully implemented. This
The highlights:
'_to indicate an “anonymous lifetime” that you do not care to give a name. This is primarily intended for use with lifetime-parameterized structs; for example, one can now writeFoo<'_>, whereas before it was common to either writeFoo(which obscured the fact that a lifetime was present) or to introduce a one-off name likeFoo<'a>(where'ais never used anywhere else).FooisFoohas a lifetime parameter — but you can useFoo<'_>if the specific value is not important.<'a>inimpl<'a>. Instead, the intention is that simply annotate the lifetimes that must be the same by giving them explicit names, and use'_for lifetimes that are not required to match against other lifetimes.Examples
TBD
What is left to do?
Some pieces of this design are not yet implemented:
'_or elide lifetimes in impls (issue #15872)'_) (issue #44752)Fooinstead ofFoo<'_>) (issue #45992)Explicit
T: 'xannotations will no longer be needed on type definitions. We will infer their presence based on the fields of the struct or enum. In short, if the struct contains a reference (directly or indirectly) toTwith lifetime'x, then we will infer thatT: 'xis a requirement:Explicit annotations remain as an option used to control trait object lifetime defaults, and simply for backwards compatibility.
Examples
Coming soon =)
What’s left to be done
Everything
The Trait System
#![feature(universal_impl_trait, conservative_impl_trait, dyn_trait)]impl Traitis a long awaited feature that allows one to describe types by the traits that they implement. For example, a function likefn foo(args: impl Iterator<Item = u32>)declares a functionfoothat takes an iterator ofu32of argument;impl Traitcan also be used in return position. Currently,impl Traitis limited to function signatures and cannot be used in traits or trait impls. In the future, we aim to support the notation in more places.dyn Traitis a simple syntactic change: whereas a trait object type used to be written as something like&Write(whereWriteis a trait), it is now preferred to write&dyn Write, which helps to make clear that (a)Writeis a trait and (b) that method calls onWritewill employ dynamic dispatch.Together, these two features help to both grow expressiveness, and to address a common point of user confusion about the role of traits and types. In particular, when using these keywords, a trait is never used directly as a type; rather one uses the
implordynkeyword to select how to useExamples
Using
impl Traitin argument position:Using
impl Traitin return position:Using
dyn Trait:What’s left to be done?
There are still a few outstanding questions about the syntax, notably the precedence of
impl Trait. You can get the full details at the tracking issues:#![feature(copy_closures, clone_closures)]Closures are now copyable / cloneable if the variables that they capture are copyable / cloneable. Note that non-move closures often borrow captured variables instead of taking ownership of them, and hence a closure may be
Copyeven if some of the variable that it uses are not (because it only requires a shared reference to them).Examples
(Try it on play.)
What’s left to be done?
Gain experience.
#![feature(trait_alias)]Trait aliases allow you to make aliases for common used combinations of trait bounds and where-clauses, much like a type alias lets you have an alternate name for a commonly used type.
Example
(Since this feature is not fully implemented yet, example will not actually work.)
What’s left to be done?
Quite a bit. Some of the parsing and infrastructure work landed in nightly, but the semantics are not yet implemented.
#![feature(generic_associated_types)]Generic associated types allow associated types defined in traits to take lifetime or type parameters. This allows for common patterns like an
Iterabletrait which are currently quite difficult to do.Example
(Since this feature is not fully implemented yet, example will not actually work.)
What’s left to be done
The parsing and various bits of the semantics are implemented, but there is still more to come. See the tracking issue.
Error Handling
#![feature(try_trait)], but not needed to use?withOptionYou can now use the
?operator in functions that returnOption, not justResult. Furthermore, through the (as yet unstable)Trytrait, you can extend?to operate on types of your own.Example
What’s left to be done?
Gain more experience with the
Trytrait.#![feature(termination_trait)]You can now give
main()alternative return types, notably includingResulttypes. This enables the use of the?operator withinmain(). The goal is to support?also in unit tests, but this is not yet implemented.Note: Implemented in PR #46479, which has not yet landed.
Example
What’s left to be done?
Once PR #46479 lands, you should be able to use examples involving
main. But the full design also allows for writing unit tests (#[test]fns) withResultreturn types as well.The Module System
#![feature(use_nested_groups)]You can now nest “import groups”, making it easier to import many names from a single crate without breaking things into multiple
usestatements.Example
(Try it on play)
What’s left to be done?
Gain experience, find bugs in the implementation.
#![feature(crate_in_paths, crate_visibility_modifier, non_modrs_mods)]#![warn(unreachable_pub)]These changes seek to clarify and streamline Rust's story around paths and visibility for modules and crates. That story will look as follows:
craterefers to the current crate (other forms are linted, see below)extern crate is no longer necessary, and is linted (see below); dependencies are available at the root unless shadowed.
cratekeyword also acts as a visibility modifier, equivalent to today'spub(crate). Consequently, uses of barepubon items that are not actually publicly exported are linted, suggestingcratevisibility instead.foo.rsandfoo/subdirectory may coexist;mod.rsis no longer needed when placing submodules in a subdirectory.Example
What’s left to be done?