Inline and remove record_layout_for_printing.

It has a single call site.
This commit is contained in:
Nicholas Nethercote 2023-11-16 17:22:30 +11:00
parent e2664eba50
commit a3bd5a0974

View File

@ -65,7 +65,11 @@ fn layout_of<'tcx>(
let layout = layout_of_uncached(&cx, ty)?;
let layout = TyAndLayout { ty, layout };
record_layout_for_printing(&cx, layout);
// If we are running with `-Zprint-type-sizes`, maybe record layouts
// for dumping later.
if cx.tcx.sess.opts.unstable_opts.print_type_sizes {
record_layout_for_printing(&cx, layout);
}
sanity_check_layout(&cx, &layout);
@ -911,21 +915,7 @@ fn coroutine_layout<'tcx>(
Ok(layout)
}
/// This is invoked by the `layout_of` query to record the final
/// layout of each type.
#[inline(always)]
fn record_layout_for_printing<'tcx>(cx: &LayoutCx<'tcx, TyCtxt<'tcx>>, layout: TyAndLayout<'tcx>) {
// If we are running with `-Zprint-type-sizes`, maybe record layouts
// for dumping later.
if cx.tcx.sess.opts.unstable_opts.print_type_sizes {
record_layout_for_printing_outlined(cx, layout)
}
}
fn record_layout_for_printing_outlined<'tcx>(
cx: &LayoutCx<'tcx, TyCtxt<'tcx>>,
layout: TyAndLayout<'tcx>,
) {
// Ignore layouts that are done with non-empty environments or
// non-monomorphic layouts, as the user only wants to see the stuff
// resulting from the final codegen session.