Skip to content

Commit 7b69088

Browse files
committed
expansion: Expand attribute macros registered by legacy plugins in usual left-to-right order
1 parent dd6347a commit 7b69088

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

src/librustc_resolve/macros.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use rustc::{ty, lint};
2222
use syntax::ast::{self, Name, Ident};
2323
use syntax::attr;
2424
use syntax::errors::DiagnosticBuilder;
25-
use syntax::ext::base::{self, Determinacy, MultiModifier, MultiDecorator};
25+
use syntax::ext::base::{self, Determinacy};
2626
use syntax::ext::base::{MacroKind, SyntaxExtension, Resolver as SyntaxResolver};
2727
use syntax::ext::expand::{AstFragment, Invocation, InvocationKind, TogetherWith};
2828
use syntax::ext::hygiene::{self, Mark};
@@ -245,22 +245,10 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
245245
// Resolves attribute and derive legacy macros from `#![plugin(..)]`.
246246
fn find_legacy_attr_invoc(&mut self, attrs: &mut Vec<ast::Attribute>, allow_derive: bool)
247247
-> Option<ast::Attribute> {
248-
for i in 0..attrs.len() {
249-
let name = attrs[i].name();
250-
251-
match self.builtin_macros.get(&name).cloned() {
252-
Some(binding) => match *binding.get_macro(self) {
253-
MultiModifier(..) | MultiDecorator(..) | SyntaxExtension::AttrProcMacro(..) => {
254-
return Some(attrs.remove(i))
255-
}
256-
_ => {}
257-
},
258-
None => {}
259-
}
248+
if !allow_derive {
249+
return None;
260250
}
261251

262-
if !allow_derive { return None }
263-
264252
// Check for legacy derives
265253
for i in 0..attrs.len() {
266254
let name = attrs[i].name();

0 commit comments

Comments
 (0)