From 02a86dbd1d929b1235b57ef26198f95ec1d41e51 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 3 Jun 2025 10:19:31 +1000 Subject: Remove pre-expansion AST stats. They're very little value, because they only measure the top-level `main.rs` or `lib.rs` file. (Other `.rs` files don't get read and parsed until expansion occurs.) I saw an example recently where the pre-expansion AST was 3KB in size and the post-expansion AST was 66MB. I kept the "POST EXPANSION" in the output header, I think that's useful information to avoid possible confusion about when the measurement happens. --- compiler/rustc_interface/src/passes.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'compiler/rustc_interface/src/passes.rs') diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 75d92ae7a2e..ada3bf96a62 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -60,10 +60,6 @@ pub fn parse<'a>(sess: &'a Session) -> ast::Crate { guar.raise_fatal(); }); - if sess.opts.unstable_opts.input_stats { - input_stats::print_ast_stats(&krate, "PRE EXPANSION AST STATS", "ast-stats-1"); - } - rustc_builtin_macros::cmdline_attrs::inject( &mut krate, &sess.psess, @@ -298,7 +294,7 @@ fn early_lint_checks(tcx: TyCtxt<'_>, (): ()) { let mut lint_buffer = resolver.lint_buffer.steal(); if sess.opts.unstable_opts.input_stats { - input_stats::print_ast_stats(krate, "POST EXPANSION AST STATS", "ast-stats-2"); + input_stats::print_ast_stats(krate, "POST EXPANSION AST STATS", "ast-stats"); } // Needs to go *after* expansion to be able to check the results of macro expansion. -- cgit 1.4.1-3-g733a5