Skip to content

Commit 9b9aae8

Browse files
committed
Allow attributes to be marked used before cfg proccessing.
1 parent 8787a12 commit 9b9aae8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/libsyntax/config.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,16 @@ impl<'a> StripUnconfigured<'a> {
6262
};
6363

6464
if attr::cfg_matches(self.config, &cfg, self.sess, self.features) {
65-
self.process_cfg_attr(respan(mi.span, ast::Attribute_ {
65+
let inner_attr = respan(mi.span, ast::Attribute_ {
6666
id: attr::mk_attr_id(),
6767
style: attr.node.style,
6868
value: mi.clone(),
6969
is_sugared_doc: false,
70-
}))
70+
});
71+
if attr::is_used(&attr) {
72+
attr::mark_used(&inner_attr);
73+
}
74+
self.process_cfg_attr(inner_attr)
7175
} else {
7276
None
7377
}

0 commit comments

Comments
 (0)