Add companion-module core.rs that exports log levels and option/some/none everywhere.

This commit is contained in:
Graydon Hoare 2011-12-20 12:29:59 -08:00
parent 8bde865d09
commit a24c19e867
7 changed files with 19 additions and 17 deletions

17
src/libcore/core.rs Normal file
View file

@ -0,0 +1,17 @@
// Top-level, visible-everywhere definitions.
// Export type option as a synonym for option::t and export the some and none
// tag constructors.
import option::{some, none};
import option = option::t;
export option, some, none;
// Export the log levels as global constants. Higher levels mean
// more-verbosity. Error is the bottom level, default logging level is
// warn-and-below.
const error : int = 0;
const warn : int = 1;
const info : int = 2;
const debug : int = 3;

View file

@ -9,9 +9,8 @@ red-black tree or something else.
*/
import core::option;
import option::{some, none};
import option = option::t;
import core::option::{some, none};
import option = core::option::t;
export treemap;
export init;

View file

@ -1,8 +1,4 @@
// error-pattern:explicit failure
use std;
import option::*;
fn foo(s: str) { }

View file

@ -1,5 +1,3 @@
use std;
import option::*;
fn main() {
let i: int =

View file

@ -1,5 +1,4 @@
use std;
import option::*;
pure fn p(x: int) -> bool { true }

View file

@ -1,7 +1,4 @@
use std;
import option::*;
fn baz() -> ! { fail; }
fn foo() {

View file

@ -1,13 +1,9 @@
// Tests that trans_path checks whether a
// pattern-bound var is an upvar (when translating
// the for-each body)
use std;
import option::*;
import uint;
fn foo(src: uint) {
alt some(src) {
some(src_id) {
uint::range(0u, 10u) {|i|