File tree Expand file tree Collapse file tree 5 files changed +29
-13
lines changed
Expand file tree Collapse file tree 5 files changed +29
-13
lines changed Original file line number Diff line number Diff line change 2020//! [`rustc_parse::lexer`]: ../rustc_parse/lexer/index.html
2121#![ deny( rustc:: untranslatable_diagnostic) ]
2222#![ deny( rustc:: diagnostic_outside_of_impl) ]
23- // We want to be able to build this crate with a stable compiler, so no
24- // `#![feature]` attributes should be added.
23+ // We want to be able to build this crate with a stable compiler,
24+ // so no `#![feature]` attributes should be added.
25+ #![ deny( unstable_features) ]
2526
2627mod cursor;
2728pub mod unescape;
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ lint_builtin_unsafe_impl = implementation of an `unsafe` trait
144144
145145lint_builtin_unsafe_trait = declaration of an `unsafe` trait
146146
147- lint_builtin_unstable_features = unstable feature
147+ lint_builtin_unstable_features = use of an unstable feature
148148
149149lint_builtin_unused_doc_comment = unused doc comment
150150 .label = rustdoc does not generate documentation for { $kind }
Original file line number Diff line number Diff line change @@ -1232,10 +1232,26 @@ impl<'tcx> LateLintPass<'tcx> for MutableTransmutes {
12321232}
12331233
12341234declare_lint ! {
1235- /// The `unstable_features` is deprecated and should no longer be used.
1235+ /// The `unstable_features` lint detects uses of `#![feature]`.
1236+ ///
1237+ /// ### Example
1238+ ///
1239+ /// ```rust,compile_fail
1240+ /// #![deny(unstable_features)]
1241+ /// #![feature(test)]
1242+ /// ```
1243+ ///
1244+ /// {{produces}}
1245+ ///
1246+ /// ### Explanation
1247+ ///
1248+ /// Crates that use unstable features require a nightly compiler which might not be desirable.
1249+ /// Especially in larger projects with a multitude of crates where some crates are allowed to
1250+ /// use unstable features and some are not, this lint may come in handy to enforce policies of
1251+ /// this kind.
12361252 UNSTABLE_FEATURES ,
12371253 Allow ,
1238- "enabling unstable features (deprecated. do not use) "
1254+ "enabling unstable features"
12391255}
12401256
12411257declare_lint_pass ! (
@@ -1245,11 +1261,9 @@ declare_lint_pass!(
12451261
12461262impl < ' tcx > LateLintPass < ' tcx > for UnstableFeatures {
12471263 fn check_attribute ( & mut self , cx : & LateContext < ' _ > , attr : & ast:: Attribute ) {
1248- if attr. has_name ( sym:: feature) {
1249- if let Some ( items) = attr. meta_item_list ( ) {
1250- for item in items {
1251- cx. emit_spanned_lint ( UNSTABLE_FEATURES , item. span ( ) , BuiltinUnstableFeatures ) ;
1252- }
1264+ if attr. has_name ( sym:: feature) && let Some ( items) = attr. meta_item_list ( ) {
1265+ for item in items {
1266+ cx. emit_spanned_lint ( UNSTABLE_FEATURES , item. span ( ) , BuiltinUnstableFeatures ) ;
12531267 }
12541268 }
12551269 }
Original file line number Diff line number Diff line change 1111) ]
1212#![ deny( rustc:: untranslatable_diagnostic) ]
1313#![ deny( rustc:: diagnostic_outside_of_impl) ]
14- // WARNING: We want to be able to build this crate with a stable compiler,
15- // so no `#![feature]` attributes should be added!
14+ // We want to be able to build this crate with a stable compiler,
15+ // so no `#![feature]` attributes should be added.
16+ #![ deny( unstable_features) ]
1617
1718use rustc_lexer:: unescape;
1819pub use Alignment :: * ;
Original file line number Diff line number Diff line change 1- error: unstable feature
1+ error: use of an unstable feature
22 --> $DIR/feature-gate-feature-gate.rs:2:12
33 |
44LL | #![feature(intrinsics)]
You can’t perform that action at this time.
0 commit comments