So @Manishearth added -Zepoch=2018
. It's time to make it your One Stop Shop for turning on all the feature gates and things. This issue is tracking the feature gates and lints that should be enable by -Zepoch=2018
.
This issue is meant to serve as a master issue for tracking the full set of feature gates and language changes as well. It somewhat duplicates https://github.com/rust-lang/rust/issues/46889 in that respect, but it's more targeted.
๐ง Still needs work
๐ The code is on nightly, but we need to link it to the -Zepoch
flag. Help wanted!
๐ Good to go, waiting for us to pull the trigger
โ Something needs to be resolved.
โ
Done
match_default_bindings
(https://github.com/rust-lang/rust/issues/42640)nll
(#43234)underscore_lifetime
(https://github.com/rust-lang/rust/issues/48469)in_band_lifetimes
(https://github.com/rust-lang/rust/issues/44524)universal_impl_trait
(https://github.com/rust-lang/rust/issues/34511))conservative_impl_trait
(https://github.com/rust-lang/rust/issues/34511)dyn_trait
(https://github.com/rust-lang/rust/issues/44662)copy_closures
(#44490)clone_closures
(#44490)termination_trait
(#43301)These lints cover cases where the preferred syntax is changing. Per the epoch RFC, all such changes must have a lint that starts to warn in the old epoch. The preference is for this lint to move to deny-by-default in the new epoch, though in some cases we may choose to create a hard error (not configurable) instead.
We are not ready, I think, to start warning by default yet; therefore, the warn-by-default on master for most lints is marked ๐.
tyvar_behind_raw_pointer
https://github.com/rust-lang/rust/issues/46906bare_trait_object
elided_lifetime_in_path
single_use_lifetime
(https://github.com/rust-lang/rust/issues/44752)dyn
keyword lintcatch
keyword lint (https://github.com/rust-lang/rust/issues/48791)unusued_pub
??Hmm, so actually I'm not 100% sure how we should set this up. In principle, epochs and feature gates are sort of orthogonal. That is -- I want some trivial way to enable the new features, and -- until the epoch is stable -- -Zepoch=2018
(and/or epoch=2018) feels like the most natural way to do it.
But looking further ahead, of course you can be in an epoch and still want feature gates -- and many of these features are going to be stabilized without reference to an epoch longer term (e.g., impl trait).
So I'm feeling a bit uncertain how to proceed here!
Okay, so I think dyn_trait
is a bit tricky.
There are actually two separate concerns here, which we may be rolling together:
dyn
is now a keyword, which we need to compat lint for (blocked on raw identifiers)dyn
(this lint exists, but is hidden behind the feature flag)The latter lint cannot work without dyn trait being possible. That cannot be stabilized until epoch 2018.
What we need to do here is:
The whole "bare traits should use dyn trait" is not a 2018 epoch lint at all, though it may be a compatability lint for the _next_ epoch.
This kinda explains some of the confusion I had when implementing epoch lints -- I implemented what we needed for epoch lints but was kinda confused about how bare_trait_lint fit in there.
Basically, there are two kinds of epoch lints:
The former should exist in 2015 and become hard errors in 2018. The latter should be tied to the feature gate, and eventually become Deny, perhaps.
For the path reform RFC I'm not sure if any of the lints are of this kind.
Regarding feature gates, I think we should do something similar to EpochDeny for them -- currently we have active/accepted/etc features in https://github.com/rust-lang/rust/blob/2789b067da2ac921b86199bde21dd231ace1da39/src/libsyntax/feature_gate.rs#L124
We make it such that you can declare a feature as accepted(epoch), and it gets auto-turned-on in the epoch.
So we can do that for dyn trait, for example. I can work on this if you think this makes sense.
The latter lint cannot work without dyn trait being possible.
Hmm, this is not clear to me. I think we can enable dyn Trait
as a contextual keyword. But I guess we should discuss this over in the dyn Trait tracking issue
Lints
I think we should not tie lints to epochs, continue gradual "escalation" of deprecation lints with small-scale effect, and never enable lints with large-scale effect (e.g. dyn
) by default.
I don't see any point in the recent epoch-related activities in the compiler and breaking the stability promise and user trust (except for maybe earning visibility points in Mozilla or something) following one bad decision made in https://github.com/rust-lang/rfcs/pull/2052.
Ok, I said that, now I can sleep better.
@petrochenkov
breaking the stability promise
I want to push back on this language. The approach you propose ("gradual escalation of deprecation lints") seems to actually be breaking the stability promise (although I guess that depends on long we continue escalating): we are gradually making code stop compiling. The epoch approach, in contrast, tries to avoid making older code stop compiling, and instead pushes for 'opt-in' for larger scale changes. I can certainly see an argument that this is not a good idea: but I don't think you can call it breaking the stability promise.
Filed https://github.com/rust-lang/rust/issues/48794 about auto-opening feature gates in epochs.
I don't see any point in the recent epoch-related activities in the compiler and breaking the stability promise and user trust (except for maybe earning visibility points in Mozilla or something) following one bad decision made in rust-lang/rfcs#2052.
This seems to be directed towards me, given that I'm doing all the implementation work.
Please don't insinuate stuff about motivations. I was asked to help with this, and I'm helping. I shouldn't have to justify doing the implementation work for an _accepted RFC_, the burden of justification is on those who wish it not to be implemented, and you do that by opening another RFC or starting similar discussions, not by pushing back against the implementation work.
(I think there's good consensus amongst the teams that we want epochs to happen, so that's unlikely to go through)
@nikomatsakis
But looking further ahead, of course you can be in an epoch and still want feature gates -- and many of these features are going to be stabilized without reference to an epoch longer term (e.g., impl trait).
So I'm feeling a bit uncertain how to proceed here!
Huh, I had a similar idea. If this sort of "feature gate group" is useful to talk about at an edition level, then maybe a "nightly" edition can be introduced to un-gate likely-to-be-stabilized-in-near-current-form features. Or, alternatively, introduce feature groups like warning groups, so #[feature(edition_2018_preview)]
opts in to the featured feature gates (and -Zedition=2018
enables the language-level features).
@CAD97 I saw that thread. I've been meaning to comment there. Long term, I believe that editions are orthogonal to nightly/stable/etc.
I believe this can be closed now? @nikomatsakis
Most helpful comment
This seems to be directed towards me, given that I'm doing all the implementation work.
Please don't insinuate stuff about motivations. I was asked to help with this, and I'm helping. I shouldn't have to justify doing the implementation work for an _accepted RFC_, the burden of justification is on those who wish it not to be implemented, and you do that by opening another RFC or starting similar discussions, not by pushing back against the implementation work.
(I think there's good consensus amongst the teams that we want epochs to happen, so that's unlikely to go through)