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

Commit 80139a0

Browse files
committed
Ensure Printer buf is always indexed using self.left or self.right
1 parent ae28ec5 commit 80139a0

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
@@ -336,9 +336,9 @@ impl Printer {
336336

337337
fn check_stream(&mut self) {
338338
if self.right_total - self.left_total > self.space {
339-
if Some(&self.left) == self.scan_stack.back() {
340-
let scanned = self.scan_stack.pop_back().unwrap();
341-
self.buf[scanned].size = SIZE_INFINITY;
339+
if self.scan_stack.back() == Some(&self.left) {
340+
self.scan_stack.pop_back().unwrap();
341+
self.buf[self.left].size = SIZE_INFINITY;
342342
}
343343
self.advance_left();
344344
if self.left != self.right {

0 commit comments

Comments
 (0)