1
1
use libc:: c_uint;
2
2
use 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,
5
4
} ;
6
5
use rustc_codegen_ssa:: traits:: BaseTypeCodegenMethods as _;
7
6
use rustc_middle:: bug;
@@ -18,7 +17,6 @@ pub(crate) unsafe fn codegen(
18
17
tcx : TyCtxt < ' _ > ,
19
18
cx : SimpleCx < ' _ > ,
20
19
module_name : & str ,
21
- kind : AllocatorKind ,
22
20
alloc_error_handler_kind : AllocatorKind ,
23
21
) {
24
22
let usize = match tcx. sess . target . pointer_width {
@@ -28,38 +26,6 @@ pub(crate) unsafe fn codegen(
28
26
tws => bug ! ( "Unsupported target word size for int: {}" , tws) ,
29
27
} ;
30
28
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
- }
63
29
64
30
// rust alloc error handler
65
31
create_wrapper_function (
0 commit comments