diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-06-02 10:49:22 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-06-02 11:22:16 +1000 |
| commit | 77e1069a5dfcc662ca2b0e731fa2fca2b6ee073b (patch) | |
| tree | 981e81642a2d4f6e4d8bf4234ce4cffe95ca501c /compiler/rustc_ast_pretty/src | |
| parent | bef2b7cd1c7bcb3393f10d5752fcf9ee3026bce8 (diff) | |
| download | rust-77e1069a5dfcc662ca2b0e731fa2fca2b6ee073b.tar.gz rust-77e1069a5dfcc662ca2b0e731fa2fca2b6ee073b.zip | |
Revert #96682.
The change was "Show invisible delimiters (within comments) when pretty printing". It's useful to show these delimiters, but is a breaking change for some proc macros. Fixes #97608.
Diffstat (limited to 'compiler/rustc_ast_pretty/src')
| -rw-r--r-- | compiler/rustc_ast_pretty/src/pprust/state.rs | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index 7357ddf2134..b80a553b418 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -590,28 +590,14 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere self.nbsp(); } self.word("{"); - let empty = tts.is_empty(); - if !empty { + if !tts.is_empty() { self.space(); } self.ibox(0); self.print_tts(tts, convert_dollar_crate); self.end(); - self.bclose(span, empty); - } - Some(Delimiter::Invisible) => { - self.word("/*«*/"); let empty = tts.is_empty(); - if !empty { - self.space(); - } - self.ibox(0); - self.print_tts(tts, convert_dollar_crate); - self.end(); - if !empty { - self.space(); - } - self.word("/*»*/"); + self.bclose(span, empty); } Some(delim) => { let token_str = self.token_kind_to_string(&token::OpenDelim(delim)); @@ -786,8 +772,9 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere token::CloseDelim(Delimiter::Bracket) => "]".into(), token::OpenDelim(Delimiter::Brace) => "{".into(), token::CloseDelim(Delimiter::Brace) => "}".into(), - token::OpenDelim(Delimiter::Invisible) => "/*«*/".into(), - token::CloseDelim(Delimiter::Invisible) => "/*»*/".into(), + token::OpenDelim(Delimiter::Invisible) | token::CloseDelim(Delimiter::Invisible) => { + "".into() + } token::Pound => "#".into(), token::Dollar => "$".into(), token::Question => "?".into(), |
