Skip to content

Commit 182450f

Browse files
committed
Try to fix intrinsics example on nightly
1 parent 8142298 commit 182450f

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ test = false
99
[build-dependencies]
1010
cc = { optional = true, version = "1.0" }
1111

12+
[dev-dependencies]
13+
panic-implementation = { path = 'crates/panic-implementation' }
14+
1215
[features]
1316
default = ["compiler-builtins"]
1417

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "panic-implementation"
3+
version = "0.1.0"
4+
authors = ["Alex Crichton <[email protected]>"]
5+
6+
[dependencies]
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Hack of a crate until rust-lang/rust#51647 is fixed
2+
3+
#![feature(no_core, panic_implementation)]
4+
#![no_core]
5+
6+
extern crate core;
7+
8+
#[panic_implementation]
9+
fn panic(_: &core::panic::PanicInfo) -> ! {
10+
loop {}
11+
}

examples/intrinsics.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212
#![feature(core_float)]
1313
#![feature(lang_items)]
1414
#![feature(start)]
15-
#![feature(global_allocator)]
1615
#![feature(allocator_api)]
1716
#![feature(panic_implementation)]
1817
#![cfg_attr(windows, feature(panic_unwind))]
1918
#![no_std]
2019

20+
extern crate panic_implementation;
21+
2122
#[cfg(not(thumb))]
2223
#[link(name = "c")]
2324
extern {}
@@ -393,6 +394,13 @@ fn run() {
393394
bb(modti3(bb(2), bb(2)));
394395

395396
something_with_a_dtor(&|| assert_eq!(bb(1), 1));
397+
398+
extern {
399+
fn rust_begin_unwind();
400+
}
401+
// if bb(false) {
402+
unsafe { rust_begin_unwind(); }
403+
// }
396404
}
397405

398406
fn something_with_a_dtor(f: &Fn()) {
@@ -442,8 +450,3 @@ pub fn _Unwind_Resume() {}
442450
#[lang = "eh_personality"]
443451
#[no_mangle]
444452
pub extern "C" fn eh_personality() {}
445-
446-
#[panic_implementation]
447-
fn panic(x: &core::panic::PanicInfo) -> ! {
448-
loop {}
449-
}

0 commit comments

Comments
 (0)