From 10426f69dac38186c7bb8946743023729d65e1e6 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Wed, 4 Mar 2015 18:10:54 +1100 Subject: [PATCH] Add more debugging to syntax::feature_gate. --- src/libsyntax/feature_gate.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 3b2d86cffe22..bc955259ab5e 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -285,7 +285,7 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[ ("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 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { } 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; } }