Rust: make the epoch Enable All The Things

Created on 6 Mar 2018  ยท  12Comments  ยท  Source: rust-lang/rust

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.

Key

๐Ÿšง 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

Feature gates

  • ๐Ÿ†˜ 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)
  • ๐Ÿšง module system feature gates not yet decided
  • ๐Ÿšง tying feature gates to epochs: (https://github.com/rust-lang/rust/issues/48794)

    Lints

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/46906

    • ๐Ÿ’› warn by default on master (not yet!)

    • โ“hard error in the new epoch, I believe



      • this is to make way for the newer features



  • bare_trait_object

    • ๐Ÿ’› warn by default on master (not yet!)

    • ๐Ÿ†˜ deny by default in new epoch

  • elided_lifetime_in_path

    • ๐Ÿšง warn by default on master (blocked: https://github.com/rust-lang/rust/issues/48385)

    • ๐Ÿšง deny by default in new epoch

  • single_use_lifetime (https://github.com/rust-lang/rust/issues/44752)

    • ๐Ÿšง warn by default on master (blocked: not fully implemented, see issue above)

    • ๐Ÿšง deny by default in new epoch (blocked: still has bugs)

  • dyn keyword lint

    • ๐Ÿšง warn by default on master (blocked: not implemented)

    • ๐Ÿšง deny by default on master (blocked: not implemented)

  • catch keyword lint (https://github.com/rust-lang/rust/issues/48791)

    • ๐Ÿšง warn by default on master (blocked: not implemented)

    • ๐Ÿšง deny by default on master (blocked: not implemented)

  • unusued_pub ??
C-tracking-issue T-compiler T-lang WG-epoch

Most helpful comment

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)

All 12 comments

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)
  • we want to introduce a lint that suggests using 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:

  • Add the keyword lint
  • Keep the dyn trait lint behind the dyn trait flag, and remove the EpochDeny for now
  • In Rust 2018, dyn trait is enabled automatically, and the lint is enabled.
  • In Rust 2018, wait a couple releases and _then_ make it EpochDeny. Actually, this lint doesn't need EpochDeny since we can just make it Deny then, Rust 2015 doesn't get this lint without the feature flag, and we don't particularly care about users still using Rust 2015 but also using nightly with feature flags.

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:

  • uh oh, this will break in 2018, fix it please
  • oh btw have you heard the good news of our lord and savior <cool new feature>?

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

Was this page helpful?
0 / 5 - 0 ratings