about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_ast_pretty/src/pp.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_ast_pretty/src/pp.rs b/compiler/rustc_ast_pretty/src/pp.rs
index b2870ac2734..d32cc4694d3 100644
--- a/compiler/rustc_ast_pretty/src/pp.rs
+++ b/compiler/rustc_ast_pretty/src/pp.rs
@@ -335,14 +335,14 @@ impl Printer {
     }
 
     fn check_stream(&mut self) {
-        if self.right_total - self.left_total > self.space {
+        while self.right_total - self.left_total > self.space {
             if self.scan_stack.back() == Some(&self.left) {
                 self.scan_stack.pop_back().unwrap();
                 self.buf[self.left].size = SIZE_INFINITY;
             }
             self.advance_left();
-            if self.left != self.right {
-                self.check_stream();
+            if self.left == self.right {
+                break;
             }
         }
     }