Remove fake BoxMarkers.

They don't appear to do anything -- no test output is affected -- and no
other pretty-printing code looks like this.
This commit is contained in:
Nicholas Nethercote
2025-04-29 16:52:17 +10:00
parent 4824c2bb74
commit 882c74dfcf
2 changed files with 1 additions and 19 deletions

View File

@@ -13,7 +13,7 @@ use rustc_ast::{
use crate::pp::Breaks::Inconsistent; use crate::pp::Breaks::Inconsistent;
use crate::pprust::state::fixup::FixupContext; use crate::pprust::state::fixup::FixupContext;
use crate::pprust::state::{AnnNode, BoxMarker, INDENT_UNIT, PrintState, State}; use crate::pprust::state::{AnnNode, INDENT_UNIT, PrintState, State};
impl<'a> State<'a> { impl<'a> State<'a> {
fn print_else(&mut self, els: Option<&ast::Expr>) { fn print_else(&mut self, els: Option<&ast::Expr>) {
@@ -542,15 +542,6 @@ impl<'a> State<'a> {
self.print_fn_params_and_ret(fn_decl, true); self.print_fn_params_and_ret(fn_decl, true);
self.space(); self.space();
self.print_expr(body, FixupContext::default()); self.print_expr(body, FixupContext::default());
// FIXME(nnethercote): Bogus. Reduce visibility of `ended` once it's fixed.
let fake_ib = BoxMarker;
self.end(fake_ib);
// A box will be closed by print_expr, but we didn't want an overall
// wrapper so we closed the corresponding opening. so create an
// empty box to satisfy the close.
// FIXME(nnethercote): Bogus.
let _ib = self.ibox(0);
} }
ast::ExprKind::Block(blk, opt_label) => { ast::ExprKind::Block(blk, opt_label) => {
if let Some(label) = opt_label { if let Some(label) = opt_label {

View File

@@ -1572,15 +1572,6 @@ impl<'a> State<'a> {
// This is a bare expression. // This is a bare expression.
self.ann.nested(self, Nested::Body(body)); self.ann.nested(self, Nested::Body(body));
// FIXME(nnethercote): this is bogus
let fake_ib = BoxMarker;
self.end(fake_ib);
// A box will be closed by `print_expr`, but we didn't want an overall
// wrapper so we closed the corresponding opening. so create an
// empty box to satisfy the close.
// FIXME(nnethercote): this is bogus, and `print_expr` is missing
let _ib = self.ibox(0);
} }
hir::ExprKind::Block(blk, opt_label) => { hir::ExprKind::Block(blk, opt_label) => {
if let Some(label) = opt_label { if let Some(label) = opt_label {