Skip to content

Commit f47c480

Browse files
committed
Reduce scope of unsafe block in cg_llvm allocator codegen
1 parent acf2437 commit f47c480

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

compiler/rustc_codegen_llvm/src/allocator.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -95,28 +95,28 @@ pub(crate) unsafe fn codegen(
9595
&CodegenFnAttrs::new(),
9696
);
9797

98-
unsafe {
99-
// __rust_alloc_error_handler_should_panic_v2
100-
create_const_value_function(
101-
tcx,
102-
&cx,
103-
&mangle_internal_symbol(tcx, OomStrategy::SYMBOL),
104-
&i8,
105-
&llvm::LLVMConstInt(i8, tcx.sess.opts.unstable_opts.oom.should_panic() as u64, FALSE),
106-
);
98+
// __rust_alloc_error_handler_should_panic_v2
99+
create_const_value_function(
100+
tcx,
101+
&cx,
102+
&mangle_internal_symbol(tcx, OomStrategy::SYMBOL),
103+
&i8,
104+
unsafe {
105+
llvm::LLVMConstInt(i8, tcx.sess.opts.unstable_opts.oom.should_panic() as u64, FALSE)
106+
},
107+
);
107108

108-
// __rust_no_alloc_shim_is_unstable_v2
109-
create_wrapper_function(
110-
tcx,
111-
&cx,
112-
&mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
113-
None,
114-
&[],
115-
None,
116-
false,
117-
&CodegenFnAttrs::new(),
118-
);
119-
}
109+
// __rust_no_alloc_shim_is_unstable_v2
110+
create_wrapper_function(
111+
tcx,
112+
&cx,
113+
&mangle_internal_symbol(tcx, NO_ALLOC_SHIM_IS_UNSTABLE),
114+
None,
115+
&[],
116+
None,
117+
false,
118+
&CodegenFnAttrs::new(),
119+
);
120120

121121
if tcx.sess.opts.debuginfo != DebugInfo::None {
122122
let dbg_cx = debuginfo::CodegenUnitDebugContext::new(cx.llmod);

0 commit comments

Comments
 (0)