about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/driver/jit.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-04-30 17:15:51 +0000
committerbors <bors@rust-lang.org>2025-04-30 17:15:51 +0000
commit251cda5e1f0057eb04fd9fc1653f2f1e010e8f97 (patch)
treea437ee3fb4d894188f3e7cb395d7c607935434a6 /compiler/rustc_codegen_cranelift/src/driver/jit.rs
parent7188f453111502962326022740e2657fce0a6939 (diff)
parent1e440aecc84b7e208ad14667aac83c963e85cd32 (diff)
downloadrust-251cda5e1f0057eb04fd9fc1653f2f1e010e8f97.tar.gz
rust-251cda5e1f0057eb04fd9fc1653f2f1e010e8f97.zip
Auto merge of #140520 - matthiaskrgr:rollup-7aoqcnp, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #134232 (Share the naked asm impl between cg_ssa and cg_clif)
 - #139624 (Don't allow flattened format_args in const.)
 - #140090 (Check bare function idents for non snake-case name)
 - #140203 (Issue an error when using `no_mangle` on language items)
 - #140450 (ast: Remove token visiting from AST visitor)
 - #140498 (Misc tweaks to HIR typeck (mostly w.r.t. checking calls))
 - #140504 (transmutability: ensure_sufficient_stack when answering query)
 - #140506 (unstable-book: fix capitalization)
 - #140516 (Replace use of rustc_type_ir by rustc_middle)

Failed merges:

 - #140374 (Resolve instance for SymFn in global/naked asm)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/driver/jit.rs')
-rw-r--r--compiler/rustc_codegen_cranelift/src/driver/jit.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/driver/jit.rs b/compiler/rustc_codegen_cranelift/src/driver/jit.rs
index 41f8bb9161c..e368cf4386d 100644
--- a/compiler/rustc_codegen_cranelift/src/driver/jit.rs
+++ b/compiler/rustc_codegen_cranelift/src/driver/jit.rs
@@ -126,6 +126,11 @@ pub(crate) fn codegen_and_compile_fn<'tcx>(
     module: &mut dyn Module,
     instance: Instance<'tcx>,
 ) {
+    if tcx.codegen_fn_attrs(instance.def_id()).flags.contains(CodegenFnAttrFlags::NAKED) {
+        tcx.dcx()
+            .span_fatal(tcx.def_span(instance.def_id()), "Naked asm is not supported in JIT mode");
+    }
+
     cranelift_codegen::timing::set_thread_profiler(Box::new(super::MeasuremeProfiler(
         tcx.prof.clone(),
     )));
@@ -135,16 +140,15 @@ pub(crate) fn codegen_and_compile_fn<'tcx>(
             crate::PrintOnPanic(|| format!("{:?} {}", instance, tcx.symbol_name(instance).name));
 
         let cached_func = std::mem::replace(&mut cached_context.func, Function::new());
-        if let Some(codegened_func) = crate::base::codegen_fn(
+        let codegened_func = crate::base::codegen_fn(
             tcx,
             cx,
             &mut TypeDebugContext::default(),
             cached_func,
             module,
             instance,
-        ) {
-            crate::base::compile_fn(cx, &tcx.prof, cached_context, module, codegened_func);
-        }
+        );
+        crate::base::compile_fn(cx, &tcx.prof, cached_context, module, codegened_func);
     });
 }