Skip to content

Commit 121c5be

Browse files
committed
Fixes examples and tests
1 parent bb41040 commit 121c5be

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

example/src/lib.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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

1111
extern crate alloc;
1212
extern crate wee_alloc;
@@ -15,14 +15,12 @@ extern crate wee_alloc;
1515
#[global_allocator]
1616
static 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

test/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extern crate cfg_if;
99
extern crate rand;
1010
extern crate wee_alloc;
1111

12-
use alloc::heap::{Alloc, Layout};
12+
use std::alloc::{Alloc, Layout};
1313
use quickcheck::{Arbitrary, Gen};
1414
use std::f64;
1515
use std::fs;

0 commit comments

Comments
 (0)