]> git.lizzy.rs Git - rust.git/commitdiff
Add more debugging to syntax::feature_gate.
authorHuon Wilson <dbau.pp+github@gmail.com>
Wed, 4 Mar 2015 07:10:54 +0000 (18:10 +1100)
committerHuon Wilson <dbau.pp+github@gmail.com>
Thu, 5 Mar 2015 13:18:29 +0000 (00:18 +1100)
src/libsyntax/feature_gate.rs

index 3b2d86cffe22c8841398718f6d783964bff1535e..bc955259ab5e0961a8f26fd33334b7d541a2de50 100644 (file)
@@ -285,7 +285,7 @@ enum Status {
     ("recursion_limit", CrateLevel),
 ];
 
-#[derive(PartialEq, Copy)]
+#[derive(PartialEq, Copy, Debug)]
 pub enum AttributeType {
     /// Normal, builtin attribute that is consumed
     /// by the compiler before the unused_attribute check
@@ -353,7 +353,9 @@ struct Context<'a> {
 
 impl<'a> Context<'a> {
     fn gate_feature(&self, feature: &str, span: Span, explain: &str) {
-        if !self.has_feature(feature) {
+        let has_feature = self.has_feature(feature);
+        debug!("gate_feature(feature = {:?}, span = {:?}); has? {}", feature, span, has_feature);
+        if !has_feature {
             emit_feature_err(self.span_handler, feature, span, explain);
         }
     }
@@ -634,12 +636,14 @@ fn visit_expr(&mut self, e: &ast::Expr) {
     }
 
     fn visit_attribute(&mut self, attr: &ast::Attribute) {
+        debug!("visit_attribute(attr = {:?})", attr);
         let name = &*attr.name();
         for &(n, ty) in KNOWN_ATTRIBUTES {
             if n == name {
                 if let Gated(gate, desc) = ty {
                     self.gate_feature(gate, attr.span, desc);
                 }
+                debug!("visit_attribute: {:?} is known, {:?}", name, ty);
                 return;
             }
         }