mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-26 23:45:30 +00:00
Add gating for rustc_* attrs
This commit is contained in:
parent
1fffdafe41
commit
0129002d3a
@ -67,6 +67,7 @@
|
|||||||
#![feature(simd, unsafe_destructor)]
|
#![feature(simd, unsafe_destructor)]
|
||||||
#![feature(staged_api)]
|
#![feature(staged_api)]
|
||||||
#![feature(unboxed_closures)]
|
#![feature(unboxed_closures)]
|
||||||
|
#![feature(rustc_attrs)]
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod macros;
|
mod macros;
|
||||||
|
@ -135,7 +135,10 @@ static KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
|
|||||||
("unsafe_no_drop_flag", "1.0.0", Active),
|
("unsafe_no_drop_flag", "1.0.0", Active),
|
||||||
|
|
||||||
// Allows the use of custom attributes; RFC 572
|
// Allows the use of custom attributes; RFC 572
|
||||||
("custom_attribute", "1.0.0", Active)
|
("custom_attribute", "1.0.0", Active),
|
||||||
|
|
||||||
|
// Allows the use of rustc_* attributes; RFC 572
|
||||||
|
("rustc_attrs", "1.0.0", Active),
|
||||||
];
|
];
|
||||||
// (changing above list without updating src/doc/reference.md makes @cmr sad)
|
// (changing above list without updating src/doc/reference.md makes @cmr sad)
|
||||||
|
|
||||||
@ -178,8 +181,6 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
|
|||||||
("repr", Normal),
|
("repr", Normal),
|
||||||
("path", Normal),
|
("path", Normal),
|
||||||
("abi", Normal),
|
("abi", Normal),
|
||||||
("rustc_move_fragments", Normal),
|
|
||||||
("rustc_variance", Normal),
|
|
||||||
("unsafe_destructor", Normal),
|
("unsafe_destructor", Normal),
|
||||||
("automatically_derived", Normal),
|
("automatically_derived", Normal),
|
||||||
("no_mangle", Normal),
|
("no_mangle", Normal),
|
||||||
@ -202,9 +203,6 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
|
|||||||
"no_std is experimental")),
|
"no_std is experimental")),
|
||||||
("lang", Gated("lang_items",
|
("lang", Gated("lang_items",
|
||||||
"language items are subject to change")),
|
"language items are subject to change")),
|
||||||
("rustc_on_unimplemented", Gated("on_unimplemented",
|
|
||||||
"the `#[rustc_on_unimplemented]` attribute \
|
|
||||||
is an experimental feature")),
|
|
||||||
("linkage", Gated("linkage",
|
("linkage", Gated("linkage",
|
||||||
"the `linkage` attribute is experimental \
|
"the `linkage` attribute is experimental \
|
||||||
and not portable across platforms")),
|
and not portable across platforms")),
|
||||||
@ -213,6 +211,19 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
|
|||||||
currently handle destructors. There is no corresponding \
|
currently handle destructors. There is no corresponding \
|
||||||
`#[task_local]` mapping to the task model")),
|
`#[task_local]` mapping to the task model")),
|
||||||
|
|
||||||
|
("rustc_on_unimplemented", Gated("on_unimplemented",
|
||||||
|
"the `#[rustc_on_unimplemented]` attribute \
|
||||||
|
is an experimental feature")),
|
||||||
|
("rustc_variance", Gated("rustc_attrs",
|
||||||
|
"the `#[rustc_variance]` attribute \
|
||||||
|
is an experimental feature")),
|
||||||
|
("rustc_error", Gated("rustc_attrs",
|
||||||
|
"the `#[rustc_error]` attribute \
|
||||||
|
is an experimental feature")),
|
||||||
|
("rustc_move_fragments", Gated("rustc_attrs",
|
||||||
|
"the `#[rustc_move_fragments]` attribute \
|
||||||
|
is an experimental feature")),
|
||||||
|
|
||||||
// FIXME: #14408 whitelist docs since rustdoc looks at them
|
// FIXME: #14408 whitelist docs since rustdoc looks at them
|
||||||
("doc", Whitelisted),
|
("doc", Whitelisted),
|
||||||
|
|
||||||
@ -243,7 +254,6 @@ pub static KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[
|
|||||||
("must_use", Whitelisted),
|
("must_use", Whitelisted),
|
||||||
("stable", Whitelisted),
|
("stable", Whitelisted),
|
||||||
("unstable", Whitelisted),
|
("unstable", Whitelisted),
|
||||||
("rustc_error", Whitelisted),
|
|
||||||
|
|
||||||
// FIXME: #19470 this shouldn't be needed forever
|
// FIXME: #19470 this shouldn't be needed forever
|
||||||
("old_orphan_check", Whitelisted),
|
("old_orphan_check", Whitelisted),
|
||||||
@ -584,12 +594,19 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.gate_feature("custom_attribute", attr.span,
|
if name.starts_with("rustc_") {
|
||||||
format!("The attribute `{}` is currently \
|
self.gate_feature("rustc_attrs", attr.span,
|
||||||
unknown to the the compiler and \
|
"unless otherwise specified, attributes \
|
||||||
may have meaning \
|
with the prefix `rustc_` \
|
||||||
added to it in the future",
|
are reserved for internal compiler diagnostics");
|
||||||
name).as_slice());
|
} else {
|
||||||
|
self.gate_feature("custom_attribute", attr.span,
|
||||||
|
format!("The attribute `{}` is currently \
|
||||||
|
unknown to the the compiler and \
|
||||||
|
may have meaning \
|
||||||
|
added to it in the future",
|
||||||
|
name).as_slice());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_pat(&mut self, pattern: &ast::Pat) {
|
fn visit_pat(&mut self, pattern: &ast::Pat) {
|
||||||
|
Loading…
Reference in New Issue
Block a user