about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2014-11-26 20:49:36 -0500
committerNiko Matsakis <niko@alum.mit.edu>2014-12-04 10:04:51 -0500
commitcc32f867d8337cfb97fbddf832169dc79556e31d (patch)
tree94a49893e7879d5124c0cea555d13e5a05306ec5 /src/libsyntax
parent1e112e94c3cd71f792e59318f7f7197999e30cf6 (diff)
downloadrust-cc32f867d8337cfb97fbddf832169dc79556e31d.tar.gz
rust-cc32f867d8337cfb97fbddf832169dc79556e31d.zip
Modify libsyntax/diagnostics to not be so persnickety. The scheme
doesn't work in a multi-crate context. We'll need to come up with
something better.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/diagnostics/plugin.rs37
1 files changed, 11 insertions, 26 deletions
diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs
index 5f4e675aad5..2be11a236d3 100644
--- a/src/libsyntax/diagnostics/plugin.rs
+++ b/src/libsyntax/diagnostics/plugin.rs
@@ -45,15 +45,6 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt,
         [ast::TtToken(_, token::Ident(code, _))] => code,
         _ => unreachable!()
     };
-    with_registered_diagnostics(|diagnostics| {
-        if !diagnostics.contains_key(&code.name) {
-            ecx.span_err(span, format!(
-                "unknown diagnostic code {}; add to librustc/diagnostics.rs",
-                token::get_ident(code).get()
-            ).as_slice());
-        }
-        ()
-    });
     with_used_diagnostics(|diagnostics| {
         match diagnostics.insert(code.name, span) {
             Some(previous_span) => {
@@ -106,25 +97,19 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt,
         _ => unreachable!()
     };
 
-    let (count, expr) = with_used_diagnostics(|diagnostics_in_use| {
+    let (count, expr) =
         with_registered_diagnostics(|diagnostics| {
-            let descriptions: Vec<P<ast::Expr>> = diagnostics
-                .iter().filter_map(|(code, description)| {
-                if !diagnostics_in_use.contains_key(code) {
-                    ecx.span_warn(span, format!(
-                        "diagnostic code {} never used", token::get_name(*code).get()
-                    ).as_slice());
-                }
-                description.map(|description| {
-                    ecx.expr_tuple(span, vec![
-                        ecx.expr_str(span, token::get_name(*code)),
-                        ecx.expr_str(span, token::get_name(description))
-                    ])
-                })
-            }).collect();
+            let descriptions: Vec<P<ast::Expr>> =
+                diagnostics.iter().filter_map(|(code, description)| {
+                    description.map(|description| {
+                        ecx.expr_tuple(span, vec![
+                            ecx.expr_str(span, token::get_name(*code)),
+                            ecx.expr_str(span, token::get_name(description))])
+                    })
+                }).collect();
             (descriptions.len(), ecx.expr_vec(span, descriptions))
-        })
-    });
+        });
+
     MacItems::new(vec![quote_item!(ecx,
         pub static $name: [(&'static str, &'static str), ..$count] = $expr;
     ).unwrap()].into_iter())