Permalink
Browse files

Copy first batch of material from libstd to libcore.

  • Loading branch information...
1 parent 32087f5 commit fa9ad984fb2f013baebdbe01a42baa3b9101dd84 @graydon graydon committed Dec 14, 2011
Showing 325 changed files with 5,582 additions and 723 deletions.
View
@@ -6,13 +6,13 @@ import rustc::syntax::parse::parser;
import std::fs;
import std::generic_os;
import std::io;
-import std::option;
-import std::option::{none, some};
+import option;
+import option::{none, some};
import std::os;
import std::run;
-import std::str;
+import str;
import std::tempfile;
-import std::vec;
+import vec;
type cargo = {
root: str,
View
@@ -5,10 +5,10 @@ import front::attr;
import middle::ty;
import metadata::{encoder, cstore};
import middle::trans_common::crate_ctxt;
-import std::str;
+import str;
import std::fs;
-import std::vec;
-import std::option;
+import vec;
+import option;
import std::run;
import option::some;
import option::none;
@@ -32,7 +32,7 @@ tag output_type {
fn llvm_err(sess: session::session, msg: str) unsafe {
let buf = llvm::LLVMRustGetLastError();
- if buf == std::ptr::null() {
+ if buf == ptr::null() {
sess.fatal(msg);
} else { sess.fatal(msg + ": " + str::str_from_cstr(buf)); }
}
View
@@ -1,11 +1,11 @@
import std::os;
import std::fs;
import std::os_fs;
-import std::vec;
+import vec;
import std::map;
import std::math;
-import std::str;
-import std::uint;
+import str;
+import uint;
import metadata::cstore;
import driver::session;
import util::filesearch;
View
@@ -10,9 +10,10 @@ import middle::{trans, resolve, freevars, kind, ty, typeck, fn_usage,
import syntax::print::{pp, pprust};
import util::{ppaux, filesearch};
import back::link;
-import std::{fs, option, str, vec, int, io, getopts, result};
-import std::option::{some, none};
-import std::getopts::{optopt, optmulti, optflag, optflagopt, opt_present};
+import core::{option, str, vec, int, result};
+import std::{fs, io, getopts};
+import option::{some, none};
+import getopts::{optopt, optmulti, optflag, optflagopt, opt_present};
import back::{x86, x86_64};
tag pp_mode { ppm_normal; ppm_expanded; ppm_typed; ppm_identified; }
@@ -104,7 +105,7 @@ fn time<T>(do_it: bool, what: str, thunk: fn@() -> T) -> T {
let rv = thunk();
let end = std::time::precise_time_s();
log_err #fmt["time: %s took %s s", what,
- std::float::to_str(end - start, 3u)];
+ float::to_str(end - start, 3u)];
ret rv;
}
@@ -3,8 +3,8 @@ import syntax::{ast, codemap};
import syntax::ast::node_id;
import codemap::span;
import syntax::ast::{int_ty, uint_ty, float_ty};
-import std::{option};
-import std::option::{some, none};
+import option;
+import option::{some, none};
import syntax::parse::parser::parse_sess;
import util::filesearch;
import back::target_strs;
View
@@ -1,6 +1,7 @@
// Functions dealing with attributes and meta_items
-import std::{either, vec, map, option};
+import core::{either, vec, option};
+import std::map;
import syntax::{ast, ast_util};
import driver::session;
View
@@ -1,4 +1,4 @@
-import std::{vec, option};
+import core::{vec, option};
import syntax::{ast, fold};
import attr;
View
@@ -1,6 +1,6 @@
// Code that generates a test runner to run all the tests in a crate
-import std::{option, vec};
+import core::{option, vec};
import syntax::{ast, ast_util};
import syntax::ast_util::*;
//import syntax::ast_util::dummy_sp;
View
@@ -1,5 +1,5 @@
-import std::{vec, str, option};
-import std::str::sbuf;
+import core::{vec, str, option};
+import str::sbuf;
import llvm::{TypeRef, MemoryBufferRef,
PassManagerRef, TargetDataRef,
@@ -960,7 +960,7 @@ fn type_to_str_inner(names: type_names, outer0: [TypeRef], ty: TypeRef) ->
5 { ret "PPC_FP128"; }
6 { ret "Label"; }
7 {
- ret "i" + std::int::str(llvm::LLVMGetIntTypeWidth(ty) as int);
+ ret "i" + int::str(llvm::LLVMGetIntTypeWidth(ty) as int);
}
8 {
let s = "fn(";
@@ -996,7 +996,7 @@ fn type_to_str_inner(names: type_names, outer0: [TypeRef], ty: TypeRef) ->
i += 1u;
if tout as int == ty as int {
let n: uint = vec::len::<TypeRef>(outer0) - i;
- ret "*\\" + std::int::str(n as int);
+ ret "*\\" + int::str(n as int);
}
}
ret "*" +
@@ -1,6 +1,6 @@
// EBML tag definitions and utils shared by the encoder and decoder
-import std::str;
+import str;
const tag_paths: uint = 0x01u;
@@ -7,8 +7,9 @@ import front::attr;
import syntax::visit;
import syntax::codemap::span;
import util::{filesearch};
-import std::{either, vec, str, fs, io, option};
-import std::option::{none, some};
+import core::{either, vec, str, option};
+import std::{io, fs};
+import option::{none, some};
import std::map::{hashmap, new_int_hash};
import syntax::print::pprust;
import common::*;
@@ -206,7 +207,7 @@ fn get_metadata_section(sess: session::session,
let cbuf = llvm::LLVMGetSectionContents(si.llsi);
let csz = llvm::LLVMGetSectionSize(si.llsi);
unsafe {
- let cvbuf: *u8 = std::unsafe::reinterpret_cast(cbuf);
+ let cvbuf: *u8 = unsafe::reinterpret_cast(cbuf);
ret option::some::<@[u8]>(@vec::unsafe::from_buf(cvbuf, csz));
}
}
@@ -2,7 +2,7 @@
import syntax::ast;
import middle::ty;
-import std::option;
+import option;
import driver::session;
export get_symbol;
@@ -1,7 +1,8 @@
// The crate store - a central repo for information collected about external
// crates and libraries
-import std::{vec, map, str};
+import core::{vec, str};
+import std::map;
import syntax::ast;
export cstore;
@@ -1,6 +1,7 @@
// Decoding metadata from a single crate's metadata
-import std::{ebml, vec, option, str, io};
+import core::{vec, option, str};
+import std::{ebml, io};
import syntax::{ast, ast_util};
import front::attr;
import middle::ty;
@@ -1,6 +1,7 @@
// Metadata encoding
-import std::{vec, str, uint, io, ebml, map};
+import core::{vec, str, uint};
+import std::{io, ebml, map};
import syntax::ast::*;
import syntax::ast_util;
import syntax::ast_util::local_def;
@@ -1,7 +1,7 @@
// Type decoding
-import std::{vec, str, uint};
-import std::option::{none, some};
+import core::{vec, str, uint};
+import option::{none, some};
import syntax::ast;
import syntax::ast::*;
import syntax::ast_util;
@@ -1,8 +1,9 @@
// Type encoding
-import std::{io, int, uint};
+import core::{int, uint};
+import std::io;
import std::map::hashmap;
-import std::option::{some, none};
+import option::{some, none};
import syntax::ast::*;
import middle::ty;
import syntax::print::pprust::*;
View
@@ -4,8 +4,9 @@ import ast::{ident, fn_ident, node_id};
import syntax::codemap::span;
import syntax::visit;
import visit::vt;
-import std::{vec, option, list};
-import std::option::{some, none, is_none};
+import core::{vec, option};
+import std::list;
+import option::{some, none, is_none};
import list::list;
// This is not an alias-analyser (though it would merit from becoming one, or
@@ -1,4 +1,5 @@
-import std::{smallintmap, option};
+import option;
+import std::smallintmap;
import syntax::ast::*;
import syntax::ast_util;
import syntax::{visit, codemap};
@@ -2,7 +2,7 @@ import syntax::ast::*;
import syntax::ast_util::{variant_def_ids, dummy_sp, compare_lit_exprs,
lit_expr_eq};
import syntax::visit;
-import std::option::{some, none};
+import option::{some, none};
fn check_crate(tcx: ty::ctxt, crate: @crate) {
let v =
@@ -25,7 +25,7 @@ fn check_arms(tcx: ty::ctxt, arms: [arm]) {
let reachable = true;
let j = 0;
while j < i {
- if std::option::is_none(arms[j].guard) {
+ if option::is_none(arms[j].guard) {
for prev_pat: @pat in arms[j].pats {
if pattern_supersedes(tcx, prev_pat, arm_pat) {
reachable = false;
@@ -149,7 +149,7 @@ fn is_refutable(tcx: ty::ctxt, pat: @pat) -> bool {
}
pat_tag(_, args) {
let vdef = variant_def_ids(tcx.def_map.get(pat.id));
- if std::vec::len(ty::tag_variants(tcx, vdef.tg)) != 1u { ret true; }
+ if vec::len(ty::tag_variants(tcx, vdef.tg)) != 1u { ret true; }
for p: @pat in args { if is_refutable(tcx, p) { ret true; } }
false
}
@@ -1,6 +1,6 @@
import syntax::ast;
import syntax::visit;
-import std::option::some;
+import option::some;
import syntax::print::pprust::expr_to_str;
export check_crate_fn_usage;
@@ -1,9 +1,9 @@
// A pass that annotates for each loops and functions with the free
// variables that they contain.
-import std::{int};
+import int;
import std::map::*;
-import std::option::*;
+import option::*;
import syntax::{ast, ast_util, visit};
import middle::resolve;
import syntax::codemap::span;
@@ -101,7 +101,7 @@ fn get_freevars(tcx: ty::ctxt, fid: ast::node_id) -> freevar_info {
}
}
fn has_freevars(tcx: ty::ctxt, fid: ast::node_id) -> bool {
- ret std::vec::len(*get_freevars(tcx, fid)) != 0u;
+ ret vec::len(*get_freevars(tcx, fid)) != 0u;
}
// Local Variables:
View
@@ -6,8 +6,8 @@ import middle::trans;
import middle::trans::{get_tydesc, tps_normal};
import middle::trans_common::*;
import middle::ty;
-import std::option::none;
-import std::str;
+import option::none;
+import str;
import lll = lib::llvm::llvm;
import bld = trans_build;
View
@@ -1,4 +1,4 @@
-import std::option::{some, none};
+import option::{some, none};
import syntax::{visit, ast_util};
import syntax::ast::*;
import syntax::codemap::span;
@@ -64,7 +64,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
let t = ty::expr_ty(cx.tcx, ex);
let ty_fields = alt ty::struct(cx.tcx, t) { ty::ty_rec(f) { f } };
for tf in ty_fields {
- if !std::vec::any({|f| f.node.ident == tf.ident}, fields) &&
+ if !vec::any({|f| f.node.ident == tf.ident}, fields) &&
ty::type_kind(cx.tcx, tf.mt.ty) == kind_noncopyable {
cx.tcx.sess.span_err(ex.span,
"copying a noncopyable value");
@@ -1,7 +1,8 @@
import syntax::{visit, ast_util};
import syntax::ast::*;
import std::list::{list, nil, cons, tail};
-import std::{vec, list, option};
+import core::{vec, option};
+import std::list;
// Last use analysis pass.
//
View
@@ -1,4 +1,4 @@
-import std::{vec, str, option};
+import core::{vec, str, option};
import option::{some, none};
import syntax::ast::*;
import syntax::visit;
@@ -11,10 +11,11 @@ import std::map::{new_int_hash, new_str_hash};
import syntax::codemap::span;
import syntax::visit;
import visit::vt;
-import std::{vec, list, option, str};
+import core::{vec, option, str};
+import std::list;
import std::map::hashmap;
import std::list::{list, nil, cons};
-import std::option::{some, none, is_none};
+import option::{some, none, is_none};
import syntax::print::pprust::*;
export resolve_crate;
View
@@ -14,9 +14,9 @@ import syntax::ast_util::dummy_sp;
import syntax::util::interner;
import util::common;
-import std::{vec, str};
+import core::{vec, str};
import std::map::hashmap;
-import std::option::{none, some};
+import option::{none, some};
import ty_ctxt = middle::ty::ctxt;
Oops, something went wrong.

0 comments on commit fa9ad98

Please sign in to comment.