Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 86f80d3

Browse files
committed
pprust: adjust mixed comment printing
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]>
1 parent fd4d151 commit 86f80d3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/librustc_ast_pretty/pprust.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,9 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
450450
fn print_comment(&mut self, cmnt: &comments::Comment) {
451451
match cmnt.style {
452452
comments::Mixed => {
453-
self.zerobreak();
453+
if !self.is_beginning_of_line() {
454+
self.zerobreak();
455+
}
454456
if let Some((last, lines)) = cmnt.lines.split_last() {
455457
self.ibox(0);
456458

src/test/pretty/block-comment-wchar.pp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,13 @@
7373
*/
7474

7575

76-
7776
/* */
7877

7978
/*
8079
Hello from offset 6
8180
Space 6+2: compare A
8281
Ogham Space Mark 6+2: compare B
8382
*/
84-
8583
/* */
8684

8785
/*

0 commit comments

Comments
 (0)