diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-08 11:36:43 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-08 23:55:25 +0300 |
| commit | ea4ad555d76d2eb8e6eb749e1b4c163e16077985 (patch) | |
| tree | db7c7c663622201b88c9deb1d41bbe24177c3283 /src/libsyntax | |
| parent | 74a6d1c821a37a407d2b2bc701d62d0b460b9215 (diff) | |
| download | rust-ea4ad555d76d2eb8e6eb749e1b4c163e16077985.tar.gz rust-ea4ad555d76d2eb8e6eb749e1b4c163e16077985.zip | |
Introduce `#[rustc_dummy]` attribute and use it in tests
Unlike other built-in attributes, this attribute accepts any input
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index ac4a7271221..7119fd13fbb 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1336,6 +1336,11 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ "internal implementation detail", cfg_fn!(rustc_attrs))), + (sym::rustc_dummy, Normal, template!(Word /* doesn't matter*/), Gated(Stability::Unstable, + sym::rustc_attrs, + "used by the test suite", + cfg_fn!(rustc_attrs))), + // FIXME: #14408 whitelist docs since rustdoc looks at them ( sym::doc, @@ -1962,12 +1967,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } match attr_info { - Some(&(name, _, template, _)) => self.check_builtin_attribute( - attr, - name, - template - ), - None => if let Some(TokenTree::Token(token)) = attr.tokens.trees().next() { + // `rustc_dummy` doesn't have any restrictions specific to built-in attributes. + Some(&(name, _, template, _)) if name != sym::rustc_dummy => + self.check_builtin_attribute(attr, name, template), + _ => if let Some(TokenTree::Token(token)) = attr.tokens.trees().next() { if token == token::Eq { // All key-value attributes are restricted to meta-item syntax. attr.parse_meta(self.context.parse_sess).map_err(|mut err| err.emit()).ok(); |
