Skip to content

Commit 0490e43

Browse files
committed
Implement check_stream nonrecursively
1 parent 947a09a commit 0490e43

File tree

1 file changed

+3
-3
lines changed
  • compiler/rustc_ast_pretty/src

1 file changed

+3
-3
lines changed

compiler/rustc_ast_pretty/src/pp.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,14 @@ impl Printer {
335335
}
336336

337337
fn check_stream(&mut self) {
338-
if self.right_total - self.left_total > self.space {
338+
while self.right_total - self.left_total > self.space {
339339
if self.scan_stack.back() == Some(&self.left) {
340340
self.scan_stack.pop_back().unwrap();
341341
self.buf[self.left].size = SIZE_INFINITY;
342342
}
343343
self.advance_left();
344-
if self.left != self.right {
345-
self.check_stream();
344+
if self.left == self.right {
345+
break;
346346
}
347347
}
348348
}

0 commit comments

Comments
 (0)