Add missing closing brackets to THIR output.

Closing brackets were missing on AdtDef, the field_types list in FruInfo, and InlineAsmExpr, breaking folding in some editors;
Fields were incorrectly (?) indexed in the list for functional update syntax, showing the (implicit, irrelevant) iteration index instead of the field index;
also spurious colon after Pat.
This commit is contained in:
Alex Celeste 2026-01-16 12:34:51 +00:00
parent d2015e2359
commit 1f691f7dbd
8 changed files with 978 additions and 24 deletions

View file

@ -618,8 +618,8 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> {
print_indented!(self, format!("args: {:?}", adt_expr.args), depth_lvl + 1);
print_indented!(self, format!("user_ty: {:?}", adt_expr.user_ty), depth_lvl + 1);
for (i, field_expr) in adt_expr.fields.iter().enumerate() {
print_indented!(self, format!("field {}:", i), depth_lvl + 1);
for field_expr in adt_expr.fields.iter() {
print_indented!(self, format!("field {}:", field_expr.name.as_u32()), depth_lvl + 1);
self.print_expr(field_expr.expr, depth_lvl + 2);
}
@ -643,6 +643,7 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> {
print_indented!(self, format!("variants: {:?}", adt_def.variants()), depth_lvl + 1);
print_indented!(self, format!("flags: {:?}", adt_def.flags()), depth_lvl + 1);
print_indented!(self, format!("repr: {:?}", adt_def.repr()), depth_lvl + 1);
print_indented!(self, "}", depth_lvl);
}
fn print_fru_info(&mut self, fru_info: &FruInfo<'tcx>, depth_lvl: usize) {
@ -653,6 +654,7 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> {
for ty in fru_info.field_types.iter() {
print_indented!(self, format!("ty: {:?}", ty), depth_lvl + 2);
}
print_indented!(self, "]", depth_lvl + 1);
print_indented!(self, "}", depth_lvl);
}
@ -683,7 +685,7 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> {
fn print_pat(&mut self, pat: &Pat<'tcx>, depth_lvl: usize) {
let &Pat { ty, span, ref kind, ref extra } = pat;
print_indented!(self, "Pat: {", depth_lvl);
print_indented!(self, "Pat {", depth_lvl);
print_indented!(self, format!("ty: {:?}", ty), depth_lvl + 1);
print_indented!(self, format!("span: {:?}", span), depth_lvl + 1);
self.print_pat_extra(extra.as_deref(), depth_lvl + 1);
@ -913,6 +915,8 @@ impl<'a, 'tcx> ThirPrinter<'a, 'tcx> {
print_indented!(self, format!("options: {:?}", options), depth_lvl + 1);
print_indented!(self, format!("line_spans: {:?}", line_spans), depth_lvl + 1);
print_indented!(self, "}", depth_lvl);
}
fn print_inline_operand(&mut self, operand: &InlineAsmOperand<'tcx>, depth_lvl: usize) {