Skip to content

Commit 10426f6

Browse files
committed
Add more debugging to syntax::feature_gate.
1 parent ab7ef74 commit 10426f6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/libsyntax/feature_gate.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
285285
("recursion_limit", CrateLevel),
286286
];
287287

288-
#[derive(PartialEq, Copy)]
288+
#[derive(PartialEq, Copy, Debug)]
289289
pub enum AttributeType {
290290
/// Normal, builtin attribute that is consumed
291291
/// by the compiler before the unused_attribute check
@@ -353,7 +353,9 @@ struct Context<'a> {
353353

354354
impl<'a> Context<'a> {
355355
fn gate_feature(&self, feature: &str, span: Span, explain: &str) {
356-
if !self.has_feature(feature) {
356+
let has_feature = self.has_feature(feature);
357+
debug!("gate_feature(feature = {:?}, span = {:?}); has? {}", feature, span, has_feature);
358+
if !has_feature {
357359
emit_feature_err(self.span_handler, feature, span, explain);
358360
}
359361
}
@@ -634,12 +636,14 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
634636
}
635637

636638
fn visit_attribute(&mut self, attr: &ast::Attribute) {
639+
debug!("visit_attribute(attr = {:?})", attr);
637640
let name = &*attr.name();
638641
for &(n, ty) in KNOWN_ATTRIBUTES {
639642
if n == name {
640643
if let Gated(gate, desc) = ty {
641644
self.gate_feature(gate, attr.span, desc);
642645
}
646+
debug!("visit_attribute: {:?} is known, {:?}", name, ty);
643647
return;
644648
}
645649
}

0 commit comments

Comments
 (0)