From 5d65ad4efd9a6e406cbe8d650919c8521fbf4cfa Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Sat, 23 Sep 2017 17:09:24 +1200 Subject: [PATCH] Add a few stubs required from std into the library --- src/lib.rs | 5 +++++ src/std_stub.rs | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/std_stub.rs diff --git a/src/lib.rs b/src/lib.rs index 691ebce..7e1dc59 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,6 +3,9 @@ #![feature(asm)] #![feature(no_core)] #![feature(const_fn)] +#![feature(associated_consts)] +#![feature(lang_items)] +#![feature(unwind_attributes)] #![no_core] @@ -23,6 +26,8 @@ pub mod spi; mod register; mod pin; mod usart; +#[doc(hidden)] +pub mod std_stub; pub enum DataDirection { Input, diff --git a/src/std_stub.rs b/src/std_stub.rs new file mode 100644 index 0000000..60bbb60 --- /dev/null +++ b/src/std_stub.rs @@ -0,0 +1,16 @@ +//! Stub methods that `libstd` normally defines. + +// These do not need to be in a module, but we group them here for clarity. +pub mod std { + #[lang = "eh_personality"] + #[no_mangle] + pub unsafe extern "C" fn rust_eh_personality(_state: (), _exception_object: *mut (), _context: *mut ()) -> () { + } + + #[lang = "panic_fmt"] + #[unwind] + pub extern fn rust_begin_panic(_msg: (), _file: &'static str, _line: u32) -> ! { + loop { } + } +} +