@@ -22,28 +22,6 @@ use core::usize;
2222#[ doc( inline) ]
2323pub use core:: alloc:: * ;
2424
25- #[ cfg( stage0) ]
26- extern "Rust" {
27- #[ allocator]
28- #[ rustc_allocator_nounwind]
29- fn __rust_alloc ( size : usize , align : usize , err : * mut u8 ) -> * mut u8 ;
30- #[ cold]
31- #[ rustc_allocator_nounwind]
32- fn __rust_oom ( err : * const u8 ) -> !;
33- #[ rustc_allocator_nounwind]
34- fn __rust_dealloc ( ptr : * mut u8 , size : usize , align : usize ) ;
35- #[ rustc_allocator_nounwind]
36- fn __rust_realloc ( ptr : * mut u8 ,
37- old_size : usize ,
38- old_align : usize ,
39- new_size : usize ,
40- new_align : usize ,
41- err : * mut u8 ) -> * mut u8 ;
42- #[ rustc_allocator_nounwind]
43- fn __rust_alloc_zeroed ( size : usize , align : usize , err : * mut u8 ) -> * mut u8 ;
44- }
45-
46- #[ cfg( not( stage0) ) ]
4725extern "Rust" {
4826 #[ allocator]
4927 #[ rustc_allocator_nounwind]
@@ -74,10 +52,7 @@ pub const Heap: Global = Global;
7452unsafe impl GlobalAlloc for Global {
7553 #[ inline]
7654 unsafe fn alloc ( & self , layout : Layout ) -> * mut Opaque {
77- #[ cfg( not( stage0) ) ]
7855 let ptr = __rust_alloc ( layout. size ( ) , layout. align ( ) ) ;
79- #[ cfg( stage0) ]
80- let ptr = __rust_alloc ( layout. size ( ) , layout. align ( ) , & mut 0 ) ;
8156 ptr as * mut Opaque
8257 }
8358
@@ -88,20 +63,13 @@ unsafe impl GlobalAlloc for Global {
8863
8964 #[ inline]
9065 unsafe fn realloc ( & self , ptr : * mut Opaque , layout : Layout , new_size : usize ) -> * mut Opaque {
91- #[ cfg( not( stage0) ) ]
9266 let ptr = __rust_realloc ( ptr as * mut u8 , layout. size ( ) , layout. align ( ) , new_size) ;
93- #[ cfg( stage0) ]
94- let ptr = __rust_realloc ( ptr as * mut u8 , layout. size ( ) , layout. align ( ) ,
95- new_size, layout. align ( ) , & mut 0 ) ;
9667 ptr as * mut Opaque
9768 }
9869
9970 #[ inline]
10071 unsafe fn alloc_zeroed ( & self , layout : Layout ) -> * mut Opaque {
101- #[ cfg( not( stage0) ) ]
10272 let ptr = __rust_alloc_zeroed ( layout. size ( ) , layout. align ( ) ) ;
103- #[ cfg( stage0) ]
104- let ptr = __rust_alloc_zeroed ( layout. size ( ) , layout. align ( ) , & mut 0 ) ;
10573 ptr as * mut Opaque
10674 }
10775}
@@ -152,14 +120,7 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
152120 }
153121}
154122
155- #[ cfg( stage0) ]
156- #[ lang = "box_free" ]
157- #[ inline]
158- unsafe fn old_box_free < T : ?Sized > ( ptr : * mut T ) {
159- box_free ( Unique :: new_unchecked ( ptr) )
160- }
161-
162- #[ cfg_attr( not( any( test, stage0) ) , lang = "box_free" ) ]
123+ #[ cfg_attr( not( test) , lang = "box_free" ) ]
163124#[ inline]
164125pub ( crate ) unsafe fn box_free < T : ?Sized > ( ptr : Unique < T > ) {
165126 let ptr = ptr. as_ptr ( ) ;
@@ -172,12 +133,6 @@ pub(crate) unsafe fn box_free<T: ?Sized>(ptr: Unique<T>) {
172133 }
173134}
174135
175- #[ cfg( stage0) ]
176- pub fn oom ( ) -> ! {
177- unsafe { :: core:: intrinsics:: abort ( ) }
178- }
179-
180- #[ cfg( not( stage0) ) ]
181136pub fn oom ( ) -> ! {
182137 extern {
183138 #[ lang = "oom" ]
0 commit comments