Skip to content

Commit

Permalink
pprust: adjust mixed comment printing
Browse files Browse the repository at this point in the history
This commit adjusts the pretty printing of mixed comments so that the
initial zero-break isn't emitted at the beginning of the line. Through
this, the `block-comment-wchar` test can have the `pp-exact` file
removed, as it no longer converges from pretty printing of the source.

Signed-off-by: David Wood <[email protected]>
  • Loading branch information
davidtwco committed Aug 2, 2020
1 parent fd4d151 commit 86f80d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/librustc_ast_pretty/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
fn print_comment(&mut self, cmnt: &comments::Comment) {
match cmnt.style {
comments::Mixed => {
self.zerobreak();
if !self.is_beginning_of_line() {
self.zerobreak();
}
if let Some((last, lines)) = cmnt.lines.split_last() {
self.ibox(0);

Expand Down
2 changes: 0 additions & 2 deletions src/test/pretty/block-comment-wchar.pp
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,13 @@
*/



/* */

/*
Hello from offset 6
Space 6+2: compare A
Ogham Space Mark 6+2: compare B
*/

/* */

/*
Expand Down

0 comments on commit 86f80d3

Please sign in to comment.