1
Fork 0

Auto merge of #112400 - WaffleLapkin:vtable_stats, r=compiler-errors

Collect VTable stats & add `-Zprint-vtable-sizes`

This is a bit hacky/buggy, but I'm not entirely sure how to fix it, so I want to ask reviewers for help...

To try this, use either of those:
- `cargo clean && RUSTFLAGS="-Zprint-vtable-sizes" cargo +toolchain b`
- `cargo clean && cargo rustc +toolchain -Zprint-vtable-sizes`
- `rustc +toolchain -Zprint-vtable-sizes ./file.rs`
This commit is contained in:
bors 2023-06-14 11:24:42 +00:00
commit 7b0eac438a
10 changed files with 232 additions and 5 deletions

View file

@ -21,7 +21,7 @@ mod structural_match;
mod structural_normalize;
#[cfg_attr(not(bootstrap), allow(hidden_glob_reexports))]
mod util;
mod vtable;
pub mod vtable;
pub mod wf;
use crate::infer::outlives::env::OutlivesEnvironment;

View file

@ -15,13 +15,13 @@ use std::fmt::Debug;
use std::ops::ControlFlow;
#[derive(Clone, Debug)]
pub(super) enum VtblSegment<'tcx> {
pub enum VtblSegment<'tcx> {
MetadataDSA,
TraitOwnEntries { trait_ref: ty::PolyTraitRef<'tcx>, emit_vptr: bool },
}
/// Prepare the segments for a vtable
pub(super) fn prepare_vtable_segments<'tcx, T>(
pub fn prepare_vtable_segments<'tcx, T>(
tcx: TyCtxt<'tcx>,
trait_ref: ty::PolyTraitRef<'tcx>,
mut segment_visitor: impl FnMut(VtblSegment<'tcx>) -> ControlFlow<T>,