diff options
| author | bors <bors@rust-lang.org> | 2018-05-24 07:14:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-05-24 07:14:21 +0000 |
| commit | 7426f5ccf7b362785a5abeb365674d3da3d4df2e (patch) | |
| tree | 34352c2086a16c38dff8879a915d7d158f909b20 /src/libsyntax/ast.rs | |
| parent | b4463d788bfd30b622a87a0e6f8e9271b9102e50 (diff) | |
| parent | a137d00ce52e9db78bb803d1384fdf3a4c4e63ea (diff) | |
| download | rust-7426f5ccf7b362785a5abeb365674d3da3d4df2e.tar.gz rust-7426f5ccf7b362785a5abeb365674d3da3d4df2e.zip | |
Auto merge of #50971 - alexcrichton:no-stringify, r=petrochenkov
rustc: Correctly pretty-print macro delimiters This commit updates the `Mac_` AST structure to keep track of the delimiters that it originally had for its invocation. This allows us to faithfully pretty-print macro invocations not using parentheses (e.g. `vec![...]`). This in turn helps procedural macros due to #43081. Closes #50840
Diffstat (limited to 'src/libsyntax/ast.rs')
| -rw-r--r-- | src/libsyntax/ast.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 72d5323a872..bd631379120 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1244,9 +1244,17 @@ pub type Mac = Spanned<Mac_>; #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Mac_ { pub path: Path, + pub delim: MacDelimiter, pub tts: ThinTokenStream, } +#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum MacDelimiter { + Parenthesis, + Bracket, + Brace, +} + impl Mac_ { pub fn stream(&self) -> TokenStream { self.tts.clone().into() |
