diff options
| author | David Tolnay <dtolnay@gmail.com> | 2022-01-21 14:20:17 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2022-02-03 10:59:34 -0800 |
| commit | 63406ac771c08597c870cc7b01ca8d8098ea3a2b (patch) | |
| tree | 5e98c5b7e43ed1b8fc729843a472731ab5a5acd0 | |
| parent | 8bdf08fbed2fba60e41dadb3be9714b4c0441f72 (diff) | |
| download | rust-63406ac771c08597c870cc7b01ca8d8098ea3a2b.tar.gz rust-63406ac771c08597c870cc7b01ca8d8098ea3a2b.zip | |
Support offsetting the most recent break
| -rw-r--r-- | compiler/rustc_ast_pretty/src/pp.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_ast_pretty/src/pp.rs b/compiler/rustc_ast_pretty/src/pp.rs index 7f03f98f1a2..ddce86f2165 100644 --- a/compiler/rustc_ast_pretty/src/pp.rs +++ b/compiler/rustc_ast_pretty/src/pp.rs @@ -314,6 +314,12 @@ impl Printer { } } + pub fn offset(&mut self, offset: isize) { + if let Some(BufEntry { token: Token::Break(token), .. }) = &mut self.buf.last_mut() { + token.offset += offset; + } + } + fn check_stream(&mut self) { while self.right_total - self.left_total > self.space { if *self.scan_stack.front().unwrap() == self.buf.index_of_first() { |
