Skip to content

Commit

Permalink
Auto merge of #44375 - topecongiro:macrodef-span, r=petrochenkov
Browse files Browse the repository at this point in the history
Add visibility to span for macros 2.0

cc rust-lang/rustfmt#1949.
r? @nrc
  • Loading branch information
bors committed Sep 11, 2017
2 parents 3d29f0e + ed63e0b commit e6bce95
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3789,9 +3789,9 @@ impl<'a> Parser<'a> {
is_defaultness
}

fn eat_macro_def(&mut self, attrs: &[Attribute], vis: &Visibility)
fn eat_macro_def(&mut self, attrs: &[Attribute], vis: &Visibility, lo: Span)
-> PResult<'a, Option<P<Item>>> {
let lo = self.span;
let token_lo = self.span;
let (ident, def) = match self.token {
token::Ident(ident) if ident.name == keywords::Macro.name() => {
self.bump();
Expand All @@ -3811,7 +3811,7 @@ impl<'a> Parser<'a> {
};
TokenStream::concat(vec![
args.into(),
TokenTree::Token(lo.to(self.prev_span), token::FatArrow).into(),
TokenTree::Token(token_lo.to(self.prev_span), token::FatArrow).into(),
body.into(),
])
} else {
Expand Down Expand Up @@ -3861,7 +3861,7 @@ impl<'a> Parser<'a> {
node: StmtKind::Local(self.parse_local(attrs.into())?),
span: lo.to(self.prev_span),
}
} else if let Some(macro_def) = self.eat_macro_def(&attrs, &Visibility::Inherited)? {
} else if let Some(macro_def) = self.eat_macro_def(&attrs, &Visibility::Inherited, lo)? {
Stmt {
id: ast::DUMMY_NODE_ID,
node: StmtKind::Item(macro_def),
Expand Down Expand Up @@ -6011,7 +6011,7 @@ impl<'a> Parser<'a> {
maybe_append(attrs, extra_attrs));
return Ok(Some(item));
}
if let Some(macro_def) = self.eat_macro_def(&attrs, &visibility)? {
if let Some(macro_def) = self.eat_macro_def(&attrs, &visibility, lo)? {
return Ok(Some(macro_def));
}

Expand Down

0 comments on commit e6bce95

Please sign in to comment.