about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-11-21 03:41:45 +0000
committerbors <bors@rust-lang.org>2014-11-21 03:41:45 +0000
commitc9f6d696420107f82304b992cf623b806995fe18 (patch)
treed2224bd566aaf93132fb5a959e0ba33192bde035 /src/libsyntax
parent98300516072c6afd0e93654b325f5924b60dea53 (diff)
parent32c3d027801b8f30f741b1b5340682e7009d02ac (diff)
downloadrust-c9f6d696420107f82304b992cf623b806995fe18.tar.gz
rust-c9f6d696420107f82304b992cf623b806995fe18.zip
auto merge of #18967 : aturon/rust/remove-runtime, r=alexcrichton
This PR completes the removal of the runtime system and green-threaded abstractions as part of implementing [RFC 230](https://github.com/rust-lang/rfcs/pull/230).

Specifically:

* It removes the `Runtime` trait, welding the scheduling infrastructure directly to native threads.

* It removes `libgreen` and `libnative` entirely.

* It rewrites `sync::mutex` as a trivial layer on top of native mutexes. Eventually, the two modules will be merged.

* It hides the vast majority of `std::rt`.

This completes the basic task of removing the runtime system (I/O and scheduling) and components that depend on it. 

After this lands, a follow-up PR will pull the `rustrt` crate back into `std`, turn `std::task` into `std::thread` (with API changes to go along with it), and completely cut out the remaining startup/teardown sequence. Other changes, including new [TLS](https://github.com/rust-lang/rfcs/pull/461) and synchronization are in the RFC or pre-RFC phase.

Closes #17325
Closes #18687

[breaking-change]

r? @alexcrichton 
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/std_inject.rs31
1 files changed, 3 insertions, 28 deletions
diff --git a/src/libsyntax/std_inject.rs b/src/libsyntax/std_inject.rs
index 6a4ab365a50..e98be046586 100644
--- a/src/libsyntax/std_inject.rs
+++ b/src/libsyntax/std_inject.rs
@@ -22,10 +22,10 @@ use util::small_vector::SmallVector;
 
 use std::mem;
 
-pub fn maybe_inject_crates_ref(krate: ast::Crate, alt_std_name: Option<String>, any_exe: bool)
+pub fn maybe_inject_crates_ref(krate: ast::Crate, alt_std_name: Option<String>)
                                -> ast::Crate {
     if use_std(&krate) {
-        inject_crates_ref(krate, alt_std_name, any_exe)
+        inject_crates_ref(krate, alt_std_name)
     } else {
         krate
     }
@@ -43,17 +43,12 @@ fn use_std(krate: &ast::Crate) -> bool {
     !attr::contains_name(krate.attrs.as_slice(), "no_std")
 }
 
-fn use_start(krate: &ast::Crate) -> bool {
-    !attr::contains_name(krate.attrs.as_slice(), "no_start")
-}
-
 fn no_prelude(attrs: &[ast::Attribute]) -> bool {
     attr::contains_name(attrs, "no_implicit_prelude")
 }
 
 struct StandardLibraryInjector<'a> {
     alt_std_name: Option<String>,
-    any_exe: bool,
 }
 
 impl<'a> fold::Folder for StandardLibraryInjector<'a> {
@@ -80,23 +75,6 @@ impl<'a> fold::Folder for StandardLibraryInjector<'a> {
             span: DUMMY_SP
         });
 
-        if use_start(&krate) && self.any_exe {
-            let visible_rt_name = "rt";
-            let actual_rt_name = "native";
-            // Gensym the ident so it can't be named
-            let visible_rt_name = token::gensym_ident(visible_rt_name);
-            let actual_rt_name = token::intern_and_get_ident(actual_rt_name);
-
-            vis.push(ast::ViewItem {
-                node: ast::ViewItemExternCrate(visible_rt_name,
-                                               Some((actual_rt_name, ast::CookedStr)),
-                                               ast::DUMMY_NODE_ID),
-                attrs: Vec::new(),
-                vis: ast::Inherited,
-                span: DUMMY_SP
-            });
-        }
-
         // `extern crate` must be precede `use` items
         mem::swap(&mut vis, &mut krate.module.view_items);
         krate.module.view_items.extend(vis.into_iter());
@@ -118,12 +96,9 @@ impl<'a> fold::Folder for StandardLibraryInjector<'a> {
     }
 }
 
-fn inject_crates_ref(krate: ast::Crate,
-                     alt_std_name: Option<String>,
-                     any_exe: bool) -> ast::Crate {
+fn inject_crates_ref(krate: ast::Crate, alt_std_name: Option<String>) -> ast::Crate {
     let mut fold = StandardLibraryInjector {
         alt_std_name: alt_std_name,
-        any_exe: any_exe,
     };
     fold.fold_crate(krate)
 }