11use libc:: c_uint;
22use rustc_ast:: expand:: allocator:: {
3- ALLOCATOR_METHODS , AllocatorKind , AllocatorTy , NO_ALLOC_SHIM_IS_UNSTABLE ,
4- alloc_error_handler_name, default_fn_name, global_fn_name,
3+ AllocatorKind , NO_ALLOC_SHIM_IS_UNSTABLE , alloc_error_handler_name,
54} ;
65use rustc_codegen_ssa:: traits:: BaseTypeCodegenMethods as _;
76use rustc_middle:: bug;
@@ -18,7 +17,6 @@ pub(crate) unsafe fn codegen(
1817 tcx : TyCtxt < ' _ > ,
1918 cx : SimpleCx < ' _ > ,
2019 module_name : & str ,
21- kind : AllocatorKind ,
2220 alloc_error_handler_kind : AllocatorKind ,
2321) {
2422 let usize = match tcx. sess . target . pointer_width {
@@ -28,38 +26,6 @@ pub(crate) unsafe fn codegen(
2826 tws => bug ! ( "Unsupported target word size for int: {}" , tws) ,
2927 } ;
3028 let i8 = cx. type_i8 ( ) ;
31- let i8p = cx. type_ptr ( ) ;
32-
33- if kind == AllocatorKind :: Default {
34- for method in ALLOCATOR_METHODS {
35- let mut args = Vec :: with_capacity ( method. inputs . len ( ) ) ;
36- for input in method. inputs . iter ( ) {
37- match input. ty {
38- AllocatorTy :: Layout => {
39- args. push ( usize) ; // size
40- args. push ( usize) ; // align
41- }
42- AllocatorTy :: Ptr => args. push ( i8p) ,
43- AllocatorTy :: Usize => args. push ( usize) ,
44-
45- AllocatorTy :: ResultPtr | AllocatorTy :: Unit => panic ! ( "invalid allocator arg" ) ,
46- }
47- }
48- let output = match method. output {
49- AllocatorTy :: ResultPtr => Some ( i8p) ,
50- AllocatorTy :: Unit => None ,
51-
52- AllocatorTy :: Layout | AllocatorTy :: Usize | AllocatorTy :: Ptr => {
53- panic ! ( "invalid allocator output" )
54- }
55- } ;
56-
57- let from_name = mangle_internal_symbol ( tcx, & global_fn_name ( method. name ) ) ;
58- let to_name = mangle_internal_symbol ( tcx, & default_fn_name ( method. name ) ) ;
59-
60- create_wrapper_function ( tcx, & cx, & from_name, & to_name, & args, output, false ) ;
61- }
62- }
6329
6430 // rust alloc error handler
6531 create_wrapper_function (
0 commit comments