This repository was archived by the owner on Aug 25, 2025. It is now read-only.
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 66// We aren't using the standard library.
77#![ no_std]
88// 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) ]
1010
1111extern crate alloc;
1212extern crate wee_alloc;
@@ -15,14 +15,12 @@ extern crate wee_alloc;
1515#[ global_allocator]
1616static ALLOC : wee_alloc:: WeeAlloc = wee_alloc:: WeeAlloc :: INIT ;
1717
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
2020// 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 ( ) }
2624}
2725
2826// 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;
99extern crate rand;
1010extern crate wee_alloc;
1111
12- use alloc :: heap :: { Alloc , Layout } ;
12+ use std :: alloc :: { Alloc , Layout } ;
1313use quickcheck:: { Arbitrary , Gen } ;
1414use std:: f64;
1515use std:: fs;
You can’t perform that action at this time.
0 commit comments