Skip to content

Commit 5644a08

Browse files
committed
Stop passing BackendConfig to run_jit
1 parent 56a64ba commit 5644a08

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/driver/jit.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_span::Symbol;
1616
use crate::debuginfo::TypeDebugContext;
1717
use crate::prelude::*;
1818
use crate::unwind_module::UnwindModule;
19-
use crate::{BackendConfig, CodegenCx, CodegenMode};
19+
use crate::{CodegenCx, CodegenMode};
2020

2121
struct JitState {
2222
jit_module: UnwindModule<JITModule>,
@@ -77,7 +77,7 @@ fn create_jit_module(tcx: TyCtxt<'_>, hotswap: bool) -> (UnwindModule<JITModule>
7777
(jit_module, cx)
7878
}
7979

80-
pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
80+
pub(crate) fn run_jit(tcx: TyCtxt<'_>, codegen_mode: CodegenMode, jit_args: Vec<String>) -> ! {
8181
if !tcx.sess.opts.output_types.should_codegen() {
8282
tcx.dcx().fatal("JIT mode doesn't work with `cargo check`");
8383
}
@@ -87,7 +87,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
8787
}
8888

8989
let (mut jit_module, mut cx) =
90-
create_jit_module(tcx, matches!(backend_config.codegen_mode, CodegenMode::JitLazy));
90+
create_jit_module(tcx, matches!(codegen_mode, CodegenMode::JitLazy));
9191
let mut cached_context = Context::new();
9292

9393
let (_, cgus) = tcx.collect_and_partition_mono_items(());
@@ -103,7 +103,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
103103
super::predefine_mono_items(tcx, &mut jit_module, &mono_items);
104104
for (mono_item, _) in mono_items {
105105
match mono_item {
106-
MonoItem::Fn(inst) => match backend_config.codegen_mode {
106+
MonoItem::Fn(inst) => match codegen_mode {
107107
CodegenMode::Aot => unreachable!(),
108108
CodegenMode::Jit => {
109109
codegen_and_compile_fn(
@@ -144,7 +144,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
144144
);
145145

146146
let args = std::iter::once(&*tcx.crate_name(LOCAL_CRATE).as_str().to_string())
147-
.chain(backend_config.jit_args.iter().map(|arg| &**arg))
147+
.chain(jit_args.iter().map(|arg| &**arg))
148148
.map(|arg| CString::new(arg).unwrap())
149149
.collect::<Vec<_>>();
150150

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
221221
CodegenMode::Aot => driver::aot::run_aot(tcx, metadata, need_metadata_module),
222222
CodegenMode::Jit | CodegenMode::JitLazy => {
223223
#[cfg(feature = "jit")]
224-
driver::jit::run_jit(tcx, config);
224+
driver::jit::run_jit(tcx, config.codegen_mode, config.jit_args);
225225

226226
#[cfg(not(feature = "jit"))]
227227
tcx.dcx().fatal("jit support was disabled when compiling rustc_codegen_cranelift");

0 commit comments

Comments
 (0)