Use the actual computed crate name for -Zprint-vtable-sizes

This commit is contained in:
bjorn3 2023-11-04 18:12:22 +00:00
parent 1a1b10fa63
commit ba82056a14
3 changed files with 14 additions and 14 deletions

View file

@ -41,6 +41,7 @@ use rustc_session::cstore::MetadataLoader;
use rustc_session::getopts::{self, Matches};
use rustc_session::lint::{Lint, LintId};
use rustc_session::{config, EarlyErrorHandler, Session};
use rustc_span::def_id::LOCAL_CRATE;
use rustc_span::source_map::FileLoader;
use rustc_span::symbol::sym;
use rustc_span::FileName;
@ -481,8 +482,7 @@ fn run_compiler(
}
if sess.opts.unstable_opts.print_vtable_sizes {
let crate_name =
compiler.session().opts.crate_name.as_deref().unwrap_or("<UNKNOWN_CRATE>");
let crate_name = queries.global_ctxt()?.enter(|tcx| tcx.crate_name(LOCAL_CRATE));
sess.code_stats.print_vtable_sizes(crate_name);
}