diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2018-04-05 10:49:14 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-04-05 10:49:14 -0500 |
| commit | 46492ffabd7194bb134035cadcd66d47f1b97db8 (patch) | |
| tree | f361c33cc5f7794ae707b5ed1d60fff877000575 /src/libsyntax/print | |
| parent | b0bd9a771e81740da7e4a7a2f5a6dfecce10c699 (diff) | |
| parent | 5d74990cebb82b9573ea6a9d509bb8e05fd6681e (diff) | |
| download | rust-46492ffabd7194bb134035cadcd66d47f1b97db8.tar.gz rust-46492ffabd7194bb134035cadcd66d47f1b97db8.zip | |
Rollup merge of #49350 - abonander:macros-in-extern, r=petrochenkov
Expand macros in `extern {}` blocks
This permits macro and proc-macro and attribute invocations (the latter only with the `proc_macro` feature of course) in `extern {}` blocks, gated behind a new `macros_in_extern` feature.
A tracking issue is now open at #49476
closes #48747
Diffstat (limited to 'src/libsyntax/print')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index c3785c10f69..1bed6109dd2 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -281,6 +281,7 @@ pub fn token_to_string(tok: &Token) -> String { token::NtArg(ref e) => arg_to_string(e), token::NtVis(ref e) => vis_to_string(e), token::NtLifetime(ref e) => lifetime_to_string(e), + token::NtForeignItem(ref ni) => foreign_item_to_string(ni), } } } @@ -422,6 +423,10 @@ pub fn mac_to_string(arg: &ast::Mac) -> String { to_string(|s| s.print_mac(arg, ::parse::token::Paren)) } +pub fn foreign_item_to_string(arg: &ast::ForeignItem) -> String { + to_string(|s| s.print_foreign_item(arg)) +} + pub fn visibility_qualified(vis: &ast::Visibility, s: &str) -> String { format!("{}{}", to_string(|s| s.print_visibility(vis)), s) } @@ -1127,6 +1132,10 @@ impl<'a> State<'a> { self.end()?; // end the head-ibox self.end() // end the outer cbox } + ast::ForeignItemKind::Macro(ref m) => { + self.print_mac(m, token::Paren)?; + self.s.word(";") + } } } |
