]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/lint/levels.rs
feature-gate lint reasons
[rust.git] / src / librustc / lint / levels.rs
index 86d0a5a4790060f35ce6e252b4528e4514b9cad1..ee878da00660efad5165a7ee88999004bc1d3c60 100644 (file)
@@ -225,11 +225,23 @@ pub fn push(&mut self, attrs: &[ast::Attribute]) -> BuilderPush {
                     match item.node {
                         ast::MetaItemKind::Word => {}  // actual lint names handled later
                         ast::MetaItemKind::NameValue(ref name_value) => {
+                            let gate_reasons = !self.sess.features_untracked().lint_reasons;
                             let name_ident = item.ident.segments[0].ident;
                             let name = name_ident.name.as_str();
+
                             if name == "reason" {
                                 if let ast::LitKind::Str(rationale, _) = name_value.node {
-                                    reason = Some(rationale);
+                                    if gate_reasons {
+                                        feature_gate::emit_feature_err(
+                                            &self.sess.parse_sess,
+                                            "lint_reasons",
+                                            item.span,
+                                            feature_gate::GateIssue::Language,
+                                            "lint reasons are experimental"
+                                        );
+                                    } else {
+                                        reason = Some(rationale);
+                                    }
                                 } else {
                                     let mut err = bad_attr(name_value.span);
                                     err.help("reason must be a string literal");