about summary refs log tree commit diff
path: root/src/comp/driver
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-01-26 15:20:29 -0800
committerBrian Anderson <banderson@mozilla.com>2012-01-26 16:23:48 -0800
commit5610205363eb56b2fd7ce6daeaa3b20a659398a5 (patch)
treef23c090f818a34e744807d563b69b2b9ec5b9be7 /src/comp/driver
parent335302f08dbdffd218cbc9fcbfb650cfa273889b (diff)
downloadrust-5610205363eb56b2fd7ce6daeaa3b20a659398a5.tar.gz
rust-5610205363eb56b2fd7ce6daeaa3b20a659398a5.zip
rustc: Move core injection to its own module
Diffstat (limited to 'src/comp/driver')
-rw-r--r--src/comp/driver/driver.rs26
1 files changed, 2 insertions, 24 deletions
diff --git a/src/comp/driver/driver.rs b/src/comp/driver/driver.rs
index 87b00a9e25b..c75e9db8a7a 100644
--- a/src/comp/driver/driver.rs
+++ b/src/comp/driver/driver.rs
@@ -95,27 +95,6 @@ fn time<T>(do_it: bool, what: str, thunk: fn@() -> T) -> T {
     ret rv;
 }
 
-fn inject_libcore_reference(sess: session,
-                            crate: @ast::crate) -> @ast::crate {
-
-    fn spanned<T: copy>(x: T) -> @ast::spanned<T> {
-        ret @{node: x,
-              span: {lo: 0u, hi: 0u,
-                     expanded_from: codemap::os_none}};
-    }
-
-    let n1 = sess.next_node_id();
-    let n2 = sess.next_node_id();
-
-    let vi1 = spanned(ast::view_item_use("core", [], n1));
-    let vi2 = spanned(ast::view_item_import_glob(@["core"], n2));
-
-    let vis = [vi1, vi2] + crate.node.module.view_items;
-
-    ret @{node: {module: { view_items: vis with crate.node.module }
-                 with crate.node} with *crate }
-}
-
 enum compile_upto {
     cu_parse,
     cu_expand,
@@ -147,9 +126,8 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg,
              bind syntax::ext::expand::expand_crate(sess, crate));
 
     if upto == cu_expand { ret {crate: crate, tcx: none}; }
-    if sess.opts.libcore {
-        crate = inject_libcore_reference(sess, crate);
-    }
+
+    crate = front::core_inject::maybe_inject_libcore_ref(sess, crate);
 
     let ast_map =
         time(time_passes, "ast indexing",