File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 6
6
// We aren't using the standard library.
7
7
#![ no_std]
8
8
// Replacing the allocator and using the `alloc` crate are still unstable.
9
- #![ feature( alloc, core_intrinsics, global_allocator , lang_items) ]
9
+ #![ feature( alloc, core_intrinsics, panic_implementation , lang_items) ]
10
10
11
11
extern crate alloc;
12
12
extern crate wee_alloc;
@@ -15,14 +15,12 @@ extern crate wee_alloc;
15
15
#[ global_allocator]
16
16
static ALLOC : wee_alloc:: WeeAlloc = wee_alloc:: WeeAlloc :: INIT ;
17
17
18
- // Need to provide a tiny `panic_fmt` lang-item implementation for
19
- // `#![no_std]`. This translates into an `unreachable` instruction that will
18
+ // Need to provide a tiny `panic` implementation for `#![no_std]`.
19
+ // This translates into an `unreachable` instruction that will
20
20
// raise a `trap` the WebAssembly execution if we panic at runtime.
21
- #[ lang = "panic_fmt" ]
22
- extern "C" fn panic_fmt ( _args : :: core:: fmt:: Arguments , _file : & ' static str , _line : u32 ) -> ! {
23
- unsafe {
24
- :: core:: intrinsics:: abort ( ) ;
25
- }
21
+ #[ panic_implementation]
22
+ fn panic ( _info : & :: core:: panic:: PanicInfo ) -> ! {
23
+ unsafe { :: core:: intrinsics:: abort ( ) }
26
24
}
27
25
28
26
// Need to provide a tiny `oom` lang-item implementation for
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ extern crate cfg_if;
9
9
extern crate rand;
10
10
extern crate wee_alloc;
11
11
12
- use alloc :: heap :: { Alloc , Layout } ;
12
+ use std :: alloc :: { Alloc , Layout } ;
13
13
use quickcheck:: { Arbitrary , Gen } ;
14
14
use std:: f64;
15
15
use std:: fs;
You can’t perform that action at this time.
0 commit comments