@@ -6,7 +6,6 @@ use rustc_ast::expand::allocator::{
66 AllocatorMethod , AllocatorTy , NO_ALLOC_SHIM_IS_UNSTABLE , default_fn_name, global_fn_name,
77} ;
88use rustc_codegen_ssa:: base:: { allocator_kind_for_codegen, allocator_shim_contents} ;
9- use rustc_session:: config:: OomStrategy ;
109use rustc_symbol_mangling:: mangle_internal_symbol;
1110
1211use crate :: prelude:: * ;
@@ -15,16 +14,11 @@ use crate::prelude::*;
1514pub ( crate ) fn codegen ( tcx : TyCtxt < ' _ > , module : & mut dyn Module ) -> bool {
1615 let Some ( kind) = allocator_kind_for_codegen ( tcx) else { return false } ;
1716 let methods = allocator_shim_contents ( tcx, kind) ;
18- codegen_inner ( tcx, module, & methods, tcx . sess . opts . unstable_opts . oom ) ;
17+ codegen_inner ( tcx, module, & methods) ;
1918 true
2019}
2120
22- fn codegen_inner (
23- tcx : TyCtxt < ' _ > ,
24- module : & mut dyn Module ,
25- methods : & [ AllocatorMethod ] ,
26- oom_strategy : OomStrategy ,
27- ) {
21+ fn codegen_inner ( tcx : TyCtxt < ' _ > , module : & mut dyn Module , methods : & [ AllocatorMethod ] ) {
2822 let usize_ty = module. target_config ( ) . pointer_type ( ) ;
2923
3024 for method in methods {
@@ -65,35 +59,6 @@ fn codegen_inner(
6559 ) ;
6660 }
6761
68- {
69- let sig = Signature {
70- call_conv : module. target_config ( ) . default_call_conv ,
71- params : vec ! [ ] ,
72- returns : vec ! [ AbiParam :: new( types:: I8 ) ] ,
73- } ;
74- let func_id = module
75- . declare_function (
76- & mangle_internal_symbol ( tcx, OomStrategy :: SYMBOL ) ,
77- Linkage :: Export ,
78- & sig,
79- )
80- . unwrap ( ) ;
81- let mut ctx = Context :: new ( ) ;
82- ctx. func . signature = sig;
83- {
84- let mut func_ctx = FunctionBuilderContext :: new ( ) ;
85- let mut bcx = FunctionBuilder :: new ( & mut ctx. func , & mut func_ctx) ;
86-
87- let block = bcx. create_block ( ) ;
88- bcx. switch_to_block ( block) ;
89- let value = bcx. ins ( ) . iconst ( types:: I8 , oom_strategy. should_panic ( ) as i64 ) ;
90- bcx. ins ( ) . return_ ( & [ value] ) ;
91- bcx. seal_all_blocks ( ) ;
92- bcx. finalize ( ) ;
93- }
94- module. define_function ( func_id, & mut ctx) . unwrap ( ) ;
95- }
96-
9762 {
9863 let sig = Signature {
9964 call_conv : module. target_config ( ) . default_call_conv ,
0 commit comments