Skip to content

Commit

Permalink
expansion: Expand attribute macros registered by legacy plugins in us…
Browse files Browse the repository at this point in the history
…ual left-to-right order
  • Loading branch information
petrochenkov committed Oct 5, 2018
1 parent dd6347a commit 7b69088
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/librustc_resolve/macros.rs
Expand Up @@ -22,7 +22,7 @@ use rustc::{ty, lint};
use syntax::ast::{self, Name, Ident};
use syntax::attr;
use syntax::errors::DiagnosticBuilder;
use syntax::ext::base::{self, Determinacy, MultiModifier, MultiDecorator};
use syntax::ext::base::{self, Determinacy};
use syntax::ext::base::{MacroKind, SyntaxExtension, Resolver as SyntaxResolver};
use syntax::ext::expand::{AstFragment, Invocation, InvocationKind, TogetherWith};
use syntax::ext::hygiene::{self, Mark};
Expand Down Expand Up @@ -245,22 +245,10 @@ impl<'a, 'crateloader: 'a> base::Resolver for Resolver<'a, 'crateloader> {
// Resolves attribute and derive legacy macros from `#![plugin(..)]`.
fn find_legacy_attr_invoc(&mut self, attrs: &mut Vec<ast::Attribute>, allow_derive: bool)
-> Option<ast::Attribute> {
for i in 0..attrs.len() {
let name = attrs[i].name();

match self.builtin_macros.get(&name).cloned() {
Some(binding) => match *binding.get_macro(self) {
MultiModifier(..) | MultiDecorator(..) | SyntaxExtension::AttrProcMacro(..) => {
return Some(attrs.remove(i))
}
_ => {}
},
None => {}
}
if !allow_derive {
return None;
}

if !allow_derive { return None }

// Check for legacy derives
for i in 0..attrs.len() {
let name = attrs[i].name();
Expand Down

0 comments on commit 7b69088

Please sign in to comment.