core: Allow using failure outside of libcore

Due to our excellent macro hygiene, this involves having a global path and a
hidden module in libcore itself.
This commit is contained in:
Alex Crichton 2014-05-12 21:23:13 -07:00
parent 82a8a5ebb3
commit 949443eff6
3 changed files with 7 additions and 4 deletions

View File

@ -10,7 +10,7 @@
//! Failure support for libcore
#![allow(dead_code)]
#![allow(dead_code, missing_doc)]
#[cfg(not(test))]
use str::raw::c_str_to_static_slice;

View File

@ -106,6 +106,7 @@ pub mod atomics;
pub mod bool;
pub mod cell;
pub mod char;
pub mod failure;
pub mod finally;
pub mod iter;
pub mod option;
@ -118,13 +119,15 @@ pub mod tuple;
#[cfg(stage0, not(test))]
pub mod owned;
mod failure;
// FIXME: this module should not exist. Once owned allocations are no longer a
// language type, this module can move outside to the owned allocation
// crate.
mod should_not_exist;
mod core {
pub use failure;
}
mod std {
pub use clone;
pub use cmp;

View File

@ -17,7 +17,7 @@ macro_rules! fail(
fail!("explicit failure")
);
($msg:expr) => (
::failure::begin_unwind($msg, file!(), line!())
::core::failure::begin_unwind($msg, file!(), line!())
);
)