2828//!
2929
3030#![ feature( start) ]
31- #![ feature( core_intrinsics) ]
32- #![ feature( panic_info_message) ]
3331#![ feature( alloc_error_handler) ]
3432#![ no_std]
3533extern crate libc;
@@ -48,8 +46,7 @@ extern crate wee_alloc;
4846#[ global_allocator]
4947static ALLOC : wee_alloc:: WeeAlloc = wee_alloc:: WeeAlloc :: INIT ;
5048
51- use core:: fmt:: { self , write, Write } ;
52- use core:: intrinsics;
49+ use core:: fmt:: { self , Write } ;
5350use core:: panic:: PanicInfo ;
5451
5552use secp256k1:: ecdh:: { self , SharedSecret } ;
@@ -62,6 +59,10 @@ use serde_cbor::de;
6259use serde_cbor:: ser:: SliceWrite ;
6360use serde_cbor:: Serializer ;
6461
62+ fn abort ( ) -> ! {
63+ unsafe { libc:: abort ( ) }
64+ }
65+
6566struct FakeRng ;
6667impl RngCore for FakeRng {
6768 fn next_u32 ( & mut self ) -> u32 {
@@ -158,7 +159,7 @@ impl Write for Print {
158159 if curr + s. len ( ) > MAX_PRINT {
159160 unsafe {
160161 libc:: printf ( "overflow\n \0 " . as_ptr ( ) as _ ) ;
161- intrinsics :: abort ( ) ;
162+ abort ( ) ;
162163 }
163164 }
164165 self . loc += s. len ( ) ;
@@ -170,15 +171,15 @@ impl Write for Print {
170171#[ panic_handler]
171172fn panic ( info : & PanicInfo ) -> ! {
172173 unsafe { libc:: printf ( "shi1\n \0 " . as_ptr ( ) as _ ) } ;
173- let msg = info. message ( ) . unwrap ( ) ;
174+ let msg = info. message ( ) ;
174175 let mut buf = Print :: new ( ) ;
175- write ( & mut buf, * msg) . unwrap ( ) ;
176+ write ! ( & mut buf, "{}" , msg) . unwrap ( ) ;
176177 buf. print ( ) ;
177- intrinsics :: abort ( )
178+ abort ( )
178179}
179180
180181#[ alloc_error_handler]
181182fn alloc_error ( _layout : Layout ) -> ! {
182183 unsafe { libc:: printf ( "alloc shi1\n \0 " . as_ptr ( ) as _ ) } ;
183- intrinsics :: abort ( )
184+ abort ( )
184185}
0 commit comments