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-08-20 14:23:37 -05:00
|
|
|
import option::{Some, None};
|
|
|
|
import Option = option::Option;
|
|
|
|
// XXX: snapshot rustc is generating code that wants lower-case option
|
|
|
|
#[cfg(stage0)]
|
|
|
|
import option = option::Option;
|
2012-08-24 17:28:43 -05:00
|
|
|
|
2012-08-28 16:49:22 -05:00
|
|
|
import result::{Result, Ok, Err};
|
|
|
|
|
2012-08-29 15:25:31 -05:00
|
|
|
import Path = path::Path;
|
|
|
|
import GenericPath = path::GenericPath;
|
|
|
|
import WindowsPath = path::WindowsPath;
|
|
|
|
import PosixPath = path::PosixPath;
|
2012-08-24 17:28:43 -05:00
|
|
|
|
2012-08-13 18:20:27 -05:00
|
|
|
import tuple::{TupleOps, ExtendedTupleOps};
|
2012-08-14 18:54:13 -05:00
|
|
|
import str::{StrSlice, UniqueStr};
|
|
|
|
import vec::{ConstVector, CopyableVector, ImmutableVector};
|
2012-08-23 12:22:14 -05:00
|
|
|
import vec::{ImmutableCopyableVector};
|
2012-08-14 18:54:13 -05:00
|
|
|
import iter::{BaseIter, ExtendedIter, CopyableIter, Times, TimesIx};
|
2012-08-13 18:20:27 -05:00
|
|
|
import num::Num;
|
2012-08-14 18:54:13 -05:00
|
|
|
import ptr::Ptr;
|
2012-08-13 18:20:27 -05:00
|
|
|
import to_str::ToStr;
|
2012-03-17 20:02:45 -05:00
|
|
|
|
2012-08-24 17:28:43 -05:00
|
|
|
export Path, WindowsPath, PosixPath, GenericPath;
|
2012-08-20 14:23:37 -05:00
|
|
|
export Option, Some, None, unreachable;
|
2012-08-28 22:16:21 -05:00
|
|
|
export Result, Ok, Err;
|
2012-03-16 19:35:38 -05:00
|
|
|
export extensions;
|
2012-06-23 23:05:52 -05:00
|
|
|
// The following exports are the extension impls for numeric types
|
2012-08-14 18:54:13 -05:00
|
|
|
export Num, Times, TimesIx;
|
2012-07-11 17:00:40 -05:00
|
|
|
// The following exports are the common traits
|
2012-08-14 18:54:13 -05:00
|
|
|
export StrSlice, UniqueStr;
|
|
|
|
export ConstVector, CopyableVector, ImmutableVector;
|
|
|
|
export ImmutableCopyableVector, IterTraitExtensions;
|
|
|
|
export BaseIter, CopyableIter, ExtendedIter;
|
2012-08-13 18:20:27 -05:00
|
|
|
export TupleOps, ExtendedTupleOps;
|
2012-08-14 18:54:13 -05:00
|
|
|
export Ptr;
|
2012-08-13 18:20:27 -05:00
|
|
|
export ToStr;
|
2012-07-28 16:13:08 -05:00
|
|
|
|
2012-07-25 20:36:18 -05:00
|
|
|
// The following exports are the core operators and kinds
|
2012-07-28 16:13:08 -05:00
|
|
|
// The compiler has special knowlege of these so we must not duplicate them
|
|
|
|
// when compiling for testing
|
|
|
|
#[cfg(notest)]
|
|
|
|
import ops::{const, copy, send, owned};
|
|
|
|
#[cfg(notest)]
|
2012-07-28 16:14:17 -05:00
|
|
|
import ops::{add, sub, mul, div, modulo, neg, bitand, bitor, bitxor};
|
2012-07-28 16:13:08 -05:00
|
|
|
#[cfg(notest)]
|
2012-07-28 16:14:17 -05:00
|
|
|
import ops::{shl, shr, index};
|
2012-07-28 16:13:08 -05:00
|
|
|
|
|
|
|
#[cfg(notest)]
|
2012-07-25 20:36:18 -05:00
|
|
|
export const, copy, send, owned;
|
2012-07-28 16:13:08 -05:00
|
|
|
#[cfg(notest)]
|
2012-07-28 16:14:17 -05:00
|
|
|
export add, sub, mul, div, modulo, neg, bitand, bitor, bitxor;
|
|
|
|
#[cfg(notest)]
|
|
|
|
export shl, shr, index;
|
2011-12-20 14:29:59 -06:00
|
|
|
|
2012-07-28 18:05:38 -05:00
|
|
|
#[cfg(test)]
|
|
|
|
use coreops(name = "core", vers = "0.3");
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
import coreops::ops::{const, copy, send, owned};
|
|
|
|
#[cfg(test)]
|
|
|
|
import coreops::ops::{add, sub, mul, div, modulo, neg, bitand, bitor, bitxor};
|
|
|
|
#[cfg(test)]
|
|
|
|
import coreops::ops::{shl, shr, index};
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2012-07-04 16:53:12 -05:00
|
|
|
/// The error log level
|
2011-12-22 12:30:04 -06:00
|
|
|
const error : u32 = 0_u32;
|
2012-07-04 16:53:12 -05:00
|
|
|
/// The warning log level
|
2011-12-22 12:30:04 -06:00
|
|
|
const warn : u32 = 1_u32;
|
2012-07-04 16:53:12 -05:00
|
|
|
/// The info log level
|
2011-12-22 12:30:04 -06:00
|
|
|
const info : u32 = 2_u32;
|
2012-07-04 16:53:12 -05:00
|
|
|
/// 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 {
|
2012-07-11 11:09:08 -05:00
|
|
|
use std(vers = "0.3");
|
2012-01-17 18:45:22 -06:00
|
|
|
import std::test;
|
2012-01-20 10:12:03 -06:00
|
|
|
}
|
2012-03-08 16:29:17 -06:00
|
|
|
|
2012-07-04 16:53:12 -05: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-08 16:29:17 -06:00
|
|
|
fn unreachable() -> ! {
|
2012-07-14 00:57:48 -05:00
|
|
|
fail ~"Internal error: entered unreachable code";
|
2012-03-08 16:29:17 -06:00
|
|
|
}
|
|
|
|
|