diff options
| author | DianQK <dianqk@dianqk.net> | 2024-12-20 21:47:00 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-20 21:47:00 +0800 |
| commit | 350e7f858e6a1cf56bfc99dd8cd4ef7fc4558485 (patch) | |
| tree | 8dc090711d5a7e672c4e1f37cc1c0a6c2370fa66 /compiler/rustc_interface/src | |
| parent | 1652e3a56073b81f4c990f9c560dbbbab288d4ef (diff) | |
| parent | 0daa921f0e95acef303f3c091a09d667f9b63405 (diff) | |
| download | rust-350e7f858e6a1cf56bfc99dd8cd4ef7fc4558485.tar.gz rust-350e7f858e6a1cf56bfc99dd8cd4ef7fc4558485.zip | |
Rollup merge of #134514 - bjorn3:more_driver_refactors, r=jieyouxu
Improve dependency_format a bit * Make `DependencyList` an `IndexVec` rather than emulating one using a `Vec` (which was off-by-one as LOCAL_CRATE was intentionally skipped) * Update some comments for the fact that we now use `#[global_allocator]` rather than `extern crate alloc_system;`/`extern crate alloc_jemalloc;` for specifying which allocator to use. We still use a similar mechanism for the panic runtime, so refer to the panic runtime in those comments instead. * An unrelated refactor to `create_and_enter_global_ctxt` I forgot to include in https://github.com/rust-lang/rust/pull/134302. This refactor is too small to be worth it's own PR.
Diffstat (limited to 'compiler/rustc_interface/src')
| -rw-r--r-- | compiler/rustc_interface/src/passes.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index 02905e632ab..aff66e48fbb 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -19,7 +19,7 @@ use rustc_incremental::setup_dep_graph; use rustc_lint::{BufferedEarlyLint, EarlyCheckNode, LintStore, unerased_lint_store}; use rustc_metadata::creader::CStore; use rustc_middle::arena::Arena; -use rustc_middle::ty::{self, GlobalCtxt, RegisteredTools, TyCtxt}; +use rustc_middle::ty::{self, CurrentGcx, GlobalCtxt, RegisteredTools, TyCtxt}; use rustc_middle::util::Providers; use rustc_parse::{ new_parser_from_file, new_parser_from_source_str, unwrap_or_emit_fatal, validate_attr, @@ -770,15 +770,14 @@ pub fn create_and_enter_global_ctxt<T, F: for<'tcx> FnOnce(TyCtxt<'tcx>) -> T>( // subtyping for GlobalCtxt::enter to be allowed. let inner: Box< dyn for<'tcx> FnOnce( - &'tcx Compiler, + &'tcx Session, + CurrentGcx, &'tcx OnceLock<GlobalCtxt<'tcx>>, &'tcx WorkerLocal<Arena<'tcx>>, &'tcx WorkerLocal<rustc_hir::Arena<'tcx>>, F, ) -> T, - > = Box::new(move |compiler, gcx_cell, arena, hir_arena, f| { - let sess = &compiler.sess; - + > = Box::new(move |sess, current_gcx, gcx_cell, arena, hir_arena, f| { TyCtxt::create_global_ctxt( gcx_cell, sess, @@ -796,7 +795,7 @@ pub fn create_and_enter_global_ctxt<T, F: for<'tcx> FnOnce(TyCtxt<'tcx>) -> T>( incremental, ), providers.hooks, - compiler.current_gcx.clone(), + current_gcx, |tcx| { let feed = tcx.create_crate_num(stable_crate_id).unwrap(); assert_eq!(feed.key(), LOCAL_CRATE); @@ -804,7 +803,7 @@ pub fn create_and_enter_global_ctxt<T, F: for<'tcx> FnOnce(TyCtxt<'tcx>) -> T>( let feed = tcx.feed_unit_query(); feed.features_query(tcx.arena.alloc(rustc_expand::config::features( - sess, + tcx.sess, &pre_configured_attrs, crate_name, ))); @@ -819,7 +818,7 @@ pub fn create_and_enter_global_ctxt<T, F: for<'tcx> FnOnce(TyCtxt<'tcx>) -> T>( ) }); - inner(compiler, &gcx_cell, &arena, &hir_arena, f) + inner(&compiler.sess, compiler.current_gcx.clone(), &gcx_cell, &arena, &hir_arena, f) } /// Runs all analyses that we guarantee to run, even if errors were reported in earlier analyses. |
