about summary refs log tree commit diff
path: root/src/librustc/lint/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustc/lint/mod.rs')
-rw-r--r--src/librustc/lint/mod.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs
index 3327b117d60..afd78008109 100644
--- a/src/librustc/lint/mod.rs
+++ b/src/librustc/lint/mod.rs
@@ -470,7 +470,7 @@ pub enum LintSource {
     Default,
 
     /// Lint level was set by an attribute.
-    Node(ast::Name, Span),
+    Node(ast::Name, Span, Option<Symbol> /* RFC 2383 reason */),
 
     /// Lint level was set by a command-line flag.
     CommandLine(Symbol),
@@ -478,7 +478,7 @@ pub enum LintSource {
 
 impl_stable_hash_for!(enum self::LintSource {
     Default,
-    Node(name, span),
+    Node(name, span, reason),
     CommandLine(text)
 });
 
@@ -519,7 +519,7 @@ impl LintBuffer {
     }
 
     pub fn take(&mut self, id: ast::NodeId) -> Vec<BufferedEarlyLint> {
-        self.map.remove(&id).unwrap_or(Vec::new())
+        self.map.remove(&id).unwrap_or_default()
     }
 
     pub fn get_any(&self) -> Option<&[BufferedEarlyLint]> {
@@ -578,7 +578,10 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
                              hyphen_case_flag_val));
             }
         }
-        LintSource::Node(lint_attr_name, src) => {
+        LintSource::Node(lint_attr_name, src, reason) => {
+            if let Some(rationale) = reason {
+                err.note(&rationale.as_str());
+            }
             sess.diag_span_note_once(&mut err, DiagnosticMessageId::from(lint),
                                      src, "lint level defined here");
             if lint_attr_name.as_str() != name {