From 33c6d3fd7880df371151ec3e9a053b7169a181e5 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 8 Aug 2013 13:28:06 -0400 Subject: Allow attributes to appear as macro arguments Fixes #8393 --- src/libsyntax/parse/parser.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/libsyntax/parse/parser.rs') diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 7d6dce22fb7..dcab89930dc 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#[macro_escape]; + use abi; use abi::AbiSet; use ast::{Sigil, BorrowedSigil, ManagedSigil, OwnedSigil}; @@ -4452,7 +4454,17 @@ impl Parser { attrs: ~[Attribute], macros_allowed: bool) -> item_or_view_item { - maybe_whole!(iovi self, nt_item); + match *self.token { + INTERPOLATED(token::nt_item(item)) => { + self.bump(); + let new_attrs = vec::append(attrs, item.attrs); + return iovi_item(@ast::item { + attrs: new_attrs, + ..(*item).clone()}); + } + _ => {} + } + let lo = self.span.lo; let visibility = self.parse_non_priv_visibility(); -- cgit 1.4.1-3-g733a5