2011-12-20 14:29:59 -06:00
|
|
|
// Top-level, visible-everywhere definitions.
|
|
|
|
|
2012-03-02 19:20:00 -06:00
|
|
|
// Export various ubiquitous types, constructors, methods.
|
2011-12-20 14:29:59 -06:00
|
|
|
|
2012-02-21 11:23:01 -06:00
|
|
|
import option::{some, none};
|
2011-12-20 14:29:59 -06:00
|
|
|
import option = option::t;
|
2012-03-02 19:20:00 -06:00
|
|
|
import path = path::path;
|
2012-02-14 02:10:47 -06:00
|
|
|
import vec::vec_len;
|
2012-03-08 16:29:17 -06:00
|
|
|
export path, option, some, none, vec_len, unreachable;
|
2011-12-20 14:29:59 -06:00
|
|
|
|
|
|
|
// Export the log levels as global constants. Higher levels mean
|
|
|
|
// more-verbosity. Error is the bottom level, default logging level is
|
|
|
|
// warn-and-below.
|
|
|
|
|
2011-12-22 12:30:04 -06:00
|
|
|
export error, warn, info, debug;
|
2012-01-24 02:54:17 -06:00
|
|
|
|
|
|
|
#[doc = "The error log level"]
|
2011-12-22 12:30:04 -06:00
|
|
|
const error : u32 = 0_u32;
|
2012-01-24 02:54:17 -06:00
|
|
|
#[doc = "The warning log level"]
|
2011-12-22 12:30:04 -06:00
|
|
|
const warn : u32 = 1_u32;
|
2012-01-24 02:54:17 -06:00
|
|
|
#[doc = "The info log level"]
|
2011-12-22 12:30:04 -06:00
|
|
|
const info : u32 = 2_u32;
|
2012-01-24 02:54:17 -06:00
|
|
|
#[doc = "The debug log level"]
|
2011-12-22 12:30:04 -06:00
|
|
|
const debug : u32 = 3_u32;
|
2011-12-22 16:42:52 -06:00
|
|
|
|
|
|
|
// A curious inner-module that's not exported that contains the binding
|
|
|
|
// 'core' so that macro-expanded references to core::error and such
|
|
|
|
// can be resolved within libcore.
|
|
|
|
mod core {
|
|
|
|
const error : u32 = 0_u32;
|
|
|
|
const warn : u32 = 1_u32;
|
|
|
|
const info : u32 = 2_u32;
|
|
|
|
const debug : u32 = 3_u32;
|
2012-01-17 18:45:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Similar to above. Some magic to make core testable.
|
|
|
|
#[cfg(test)]
|
|
|
|
mod std {
|
|
|
|
use std;
|
|
|
|
import std::test;
|
2012-01-20 10:12:03 -06:00
|
|
|
}
|
2012-03-08 16:29:17 -06:00
|
|
|
|
2012-03-06 21:09:32 -06:00
|
|
|
#[doc = "
|
2012-03-08 16:29:17 -06:00
|
|
|
A standard function to use to indicate unreachable code. Because the
|
|
|
|
function is guaranteed to fail typestate will correctly identify
|
|
|
|
any code paths following the appearance of this function as unreachable.
|
2012-03-06 21:09:32 -06:00
|
|
|
"]
|
2012-03-08 16:29:17 -06:00
|
|
|
fn unreachable() -> ! {
|
|
|
|
fail "Internal error: entered unreachable code";
|
|
|
|
}
|
|
|
|
|