pprust: Do not convert attributes into `MetaItem`s for printing

Fixes https://github.com/rust-lang/rust/issues/62628
This commit is contained in:
Vadim Petrochenkov 2019-07-13 23:24:58 +03:00
parent 160c40bc88
commit 75896011dc
3 changed files with 20 additions and 17 deletions

View File

@ -617,9 +617,6 @@ pub trait PrintState<'a>: std::ops::Deref<Target=pp::Printer> + std::ops::DerefM
ast::AttrStyle::Outer => self.word("#["), ast::AttrStyle::Outer => self.word("#["),
} }
self.ibox(0); self.ibox(0);
if let Some(mi) = attr.meta() {
self.print_meta_item(&mi);
} else {
match attr.tokens.trees().next() { match attr.tokens.trees().next() {
Some(TokenTree::Delimited(_, delim, tts)) => { Some(TokenTree::Delimited(_, delim, tts)) => {
self.print_mac_common( self.print_mac_common(
@ -634,7 +631,6 @@ pub trait PrintState<'a>: std::ops::Deref<Target=pp::Printer> + std::ops::DerefM
} }
} }
} }
}
self.end(); self.end();
self.word("]"); self.word("]");
} }

View File

@ -0,0 +1,7 @@
// Keywords in attribute paths are printed as raw idents,
// but keywords in attribute arguments are not.
// pp-exact
#[rustfmt::r#final(final)]
fn main() { }