Undeprecate lint unstable_features and make use of it in the compiler by fmease · Pull Request #118639 · rust-lang/rust (original) (raw)
Nominating for lang team discussion:
There exist some rustc crates that ought to compile on stable for use in rust-analyzer.
These crates (namely: rustc_lexer, rustc_parse_format) should not use any #![feature]s.
Currently this is only enforced by comments which lead to a mass-update PR to accidentally disregard this policy (it was missed by the author and the reviewer).
I propose to undeprecate the lint unstable_features to enforce this rule automatically.
According to #117937 (comment), the lint was previously deprecated because it was replaced by a hard error (#![feature] may not be used on the stable release channel).
Alternative: In CI, build those crates with RUSTC_BOOTSTRAP=0 instead. CON: Bootstrap needs to hard-code a list of “stable crates”. PRO: Nothing needs to be undeprecated.
There also exists rustc_type_ir where we could use the lint in the form of #![cfg_attr(not(feature = "nightly"), deny(unstable_features))] (and build it twice, once with feature nighly and once without it and maybe with RUSTC_BOOTSTAP=0, too, for good measure).