Use nightly with no features?


#1

Hi,

I’d like to build with the nightly compiler, but have it complain about any #[feature(...)] use in the same way that stable/beta does. Is there a way to do this?

Thanks,
J


#2

What is the version of rustc? What are the features?


#3

I’d like any given nightly compiler to reject all attempts to use #[feature(...)] as if it were a stable compiler. I don’t necessarily want it to pretend to be a an older version of the language; if it has new features which no longer require a feature gate, then using them shouldn’t raise errors.

(That said, having a “rustc --use-language 1.2” would be kinda useful to test across versions without having lots of toolchains, but I realize it could be v awkward to implement.)

J


#4

#![feature(...)] can only be a crate-level attribute, so it should be pretty easy to abstain. If anywhere you try to use something gated without declaring that in the crate, you’ll get your error even on nightly.


#5

rustc already has a lint that does this, but it has this description:

unstable-features  allow    enabling unstable features (deprecated. do not use)

It can indeed deny using unstable features:

$ rustc src/lib.rs --crate-type=lib -D unstable-features
src/lib.rs:1:12: 1:16 error: unstable feature [-D unstable-features]
src/lib.rs:1 #![feature(test)]
                        ^~~~
error: aborting due to previous error

So maybe request that this lint is reinstated?