From 2e40d11f8cd9d0e2f9c62e40311f64161d3071cb Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 9 Nov 2023 13:38:30 +1100 Subject: [PATCH] Remove `-Zkeep-hygiene-data`. It was added way back in #28585 under the name `-Zkeep-mtwt-tables`. The justification was: > This is so that the resolution results can be used after analysis, > potentially for tool support. There are no uses of significance in the code base, and various Google searches for both option names (and variants) found nothing of interest. @petrochenkov says removing this part (and it's only part) of the hygiene data is dubious. It doesn't seem that big, so let's just keep it around. --- compiler/rustc_ast_lowering/src/lib.rs | 5 ----- compiler/rustc_interface/src/tests.rs | 1 - compiler/rustc_session/src/options.rs | 2 -- compiler/rustc_span/src/hygiene.rs | 4 ---- 4 files changed, 12 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index a88493acf982f..55d50e5fe6a1d 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -443,11 +443,6 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> hir::Crate<'_> { drop(ast_index); sess.time("drop_ast", || drop(krate)); - // Discard hygiene data, which isn't required after lowering to HIR. - if !sess.opts.unstable_opts.keep_hygiene_data { - rustc_span::hygiene::clear_syntax_context_map(); - } - // Don't hash unless necessary, because it's expensive. let opt_hir_hash = if tcx.needs_crate_hash() { Some(compute_hir_hash(tcx, &owners)) } else { None }; diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index d308169552317..9d06b6496b88c 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -679,7 +679,6 @@ fn test_unstable_options_tracking_hash() { untracked!(incremental_info, true); untracked!(incremental_verify_ich, true); untracked!(input_stats, true); - untracked!(keep_hygiene_data, true); untracked!(link_native_libraries, false); untracked!(llvm_time_trace, true); untracked!(ls, vec!["all".to_owned()]); diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 964a26e94fed9..a4dc1b64a4cef 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1622,8 +1622,6 @@ options! { `=skip-entry` `=skip-exit` Multiple options can be combined with commas."), - keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED], - "keep hygiene data after analysis (default: no)"), layout_seed: Option = (None, parse_opt_number, [TRACKED], "seed layout randomization"), link_directives: bool = (true, parse_bool, [TRACKED], diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs index 36731d0fe7478..988ff57254c53 100644 --- a/compiler/rustc_span/src/hygiene.rs +++ b/compiler/rustc_span/src/hygiene.rs @@ -569,10 +569,6 @@ impl HygieneData { } } -pub fn clear_syntax_context_map() { - HygieneData::with(|data| data.syntax_context_map = FxHashMap::default()); -} - pub fn walk_chain(span: Span, to: SyntaxContext) -> Span { HygieneData::with(|data| data.walk_chain(span, to)) }