Use nightly with no features?



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?



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


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.)



#![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.


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/ --crate-type=lib -D unstable-features
src/ 1:16 error: unstable feature [-D unstable-features]
src/ #![feature(test)]
error: aborting due to previous error

So maybe request that this lint is reinstated?