Try to fix intrinsics example on nightly

This commit is contained in:
Alex Crichton 2018-07-12 09:29:32 -07:00
parent 8142298fe6
commit 182450f20c
4 changed files with 29 additions and 6 deletions

View File

@ -9,6 +9,9 @@ test = false
[build-dependencies] [build-dependencies]
cc = { optional = true, version = "1.0" } cc = { optional = true, version = "1.0" }
[dev-dependencies]
panic-implementation = { path = 'crates/panic-implementation' }
[features] [features]
default = ["compiler-builtins"] default = ["compiler-builtins"]

View File

@ -0,0 +1,6 @@
[package]
name = "panic-implementation"
version = "0.1.0"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
[dependencies]

View File

@ -0,0 +1,11 @@
// Hack of a crate until rust-lang/rust#51647 is fixed
#![feature(no_core, panic_implementation)]
#![no_core]
extern crate core;
#[panic_implementation]
fn panic(_: &core::panic::PanicInfo) -> ! {
loop {}
}

View File

@ -12,12 +12,13 @@
#![feature(core_float)] #![feature(core_float)]
#![feature(lang_items)] #![feature(lang_items)]
#![feature(start)] #![feature(start)]
#![feature(global_allocator)]
#![feature(allocator_api)] #![feature(allocator_api)]
#![feature(panic_implementation)] #![feature(panic_implementation)]
#![cfg_attr(windows, feature(panic_unwind))] #![cfg_attr(windows, feature(panic_unwind))]
#![no_std] #![no_std]
extern crate panic_implementation;
#[cfg(not(thumb))] #[cfg(not(thumb))]
#[link(name = "c")] #[link(name = "c")]
extern {} extern {}
@ -393,6 +394,13 @@ fn run() {
bb(modti3(bb(2), bb(2))); bb(modti3(bb(2), bb(2)));
something_with_a_dtor(&|| assert_eq!(bb(1), 1)); something_with_a_dtor(&|| assert_eq!(bb(1), 1));
extern {
fn rust_begin_unwind();
}
// if bb(false) {
unsafe { rust_begin_unwind(); }
// }
} }
fn something_with_a_dtor(f: &Fn()) { fn something_with_a_dtor(f: &Fn()) {
@ -442,8 +450,3 @@ pub fn _Unwind_Resume() {}
#[lang = "eh_personality"] #[lang = "eh_personality"]
#[no_mangle] #[no_mangle]
pub extern "C" fn eh_personality() {} pub extern "C" fn eh_personality() {}
#[panic_implementation]
fn panic(x: &core::panic::PanicInfo) -> ! {
loop {}
}