Skip to content

Commit 0112f3b

Browse files
committed
move other attribute check to visit_attribute
1 parent 5ffb7db commit 0112f3b

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

src/libsyntax/feature_gate.rs

+10-20
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,16 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
202202
"no_std is experimental")),
203203
("lang", Gated("lang_items",
204204
"language items are subject to change")),
205+
("rustc_on_unimplemented", Gated("on_unimplemented",
206+
"the `#[rustc_on_unimplemented]` attribute \
207+
is an experimental feature")),
208+
("linkage", Gated("linkage",
209+
"the `linkage` attribute is experimental \
210+
and not portable across platforms")),
211+
("thread_local", Gated("thread_local",
212+
"`#[thread_local]` is an experimental feature, and does not \
213+
currently handle destructors. There is no corresponding \
214+
`#[task_local]` mapping to the task model")),
205215

206216
// FIXME: #14408 whitelist docs since rustdoc looks at them
207217
("doc", Whitelisted),
@@ -214,14 +224,12 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
214224
("link", Whitelisted),
215225
("link_name", Whitelisted),
216226
("link_section", Whitelisted),
217-
("linkage", Whitelisted),
218227
("no_builtins", Whitelisted),
219228
("no_mangle", Whitelisted),
220229
("no_split_stack", Whitelisted),
221230
("no_stack_check", Whitelisted),
222231
("packed", Whitelisted),
223232
("static_assert", Whitelisted),
224-
("thread_local", Whitelisted),
225233
("no_debug", Whitelisted),
226234
("omit_gdb_pretty_printer_section", Whitelisted),
227235
("unsafe_no_drop_flag", Whitelisted),
@@ -235,7 +243,6 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
235243
("must_use", Whitelisted),
236244
("stable", Whitelisted),
237245
("unstable", Whitelisted),
238-
("rustc_on_unimplemented", Whitelisted),
239246
("rustc_error", Whitelisted),
240247

241248
// FIXME: #19470 this shouldn't be needed forever
@@ -395,22 +402,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
395402
}
396403

397404
fn visit_item(&mut self, i: &ast::Item) {
398-
for attr in &i.attrs {
399-
if attr.name() == "thread_local" {
400-
self.gate_feature("thread_local", i.span,
401-
"`#[thread_local]` is an experimental feature, and does not \
402-
currently handle destructors. There is no corresponding \
403-
`#[task_local]` mapping to the task model");
404-
} else if attr.name() == "linkage" {
405-
self.gate_feature("linkage", i.span,
406-
"the `linkage` attribute is experimental \
407-
and not portable across platforms")
408-
} else if attr.name() == "rustc_on_unimplemented" {
409-
self.gate_feature("on_unimplemented", i.span,
410-
"the `#[rustc_on_unimplemented]` attribute \
411-
is an experimental feature")
412-
}
413-
}
414405
match i.node {
415406
ast::ItemExternCrate(_) => {
416407
if attr::contains_name(&i.attrs[], "macro_reexport") {
@@ -592,7 +583,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
592583
}
593584
return;
594585
}
595-
596586
}
597587
self.gate_feature("custom_attribute", attr.span,
598588
format!("The attribute `{}` is currently \

0 commit comments

Comments
 (0)