From 0ce5faaa7becfac2786c4a305602b63dc96ba2f8 Mon Sep 17 00:00:00 2001 From: Aaron Turon Date: Wed, 17 Dec 2014 15:41:16 -0800 Subject: [PATCH] Delete rest of rustrt ... and address other rebasing fallout. --- src/librustrt/lib.rs | 132 ----------------------------------------- src/libstd/comm/mod.rs | 2 +- src/libstd/io/stdio.rs | 1 + 3 files changed, 2 insertions(+), 133 deletions(-) delete mode 100644 src/librustrt/lib.rs diff --git a/src/librustrt/lib.rs b/src/librustrt/lib.rs deleted file mode 100644 index 02ca7d3ce6d45..0000000000000 --- a/src/librustrt/lib.rs +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name = "rustrt"] -#![crate_type = "rlib"] -#![crate_type = "dylib"] -#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", - html_favicon_url = "http://www.rust-lang.org/favicon.ico", - html_root_url = "http://doc.rust-lang.org/nightly/")] - -#![allow(unknown_features)] -#![feature(macro_rules, phase, globs, thread_local, asm)] -#![feature(linkage, lang_items, unsafe_destructor, default_type_params)] -#![feature(import_shadowing, slicing_syntax)] -#![feature(unboxed_closures)] -#![no_std] -#![experimental] - -#[phase(plugin, link)] extern crate core; -extern crate alloc; -extern crate libc; -extern crate collections; - -#[cfg(test)] extern crate "rustrt" as realrustrt; -#[cfg(test)] extern crate test; - -#[cfg(test)] #[phase(plugin, link)] extern crate std; - -pub use self::util::{Stdio, Stdout, Stderr}; -pub use self::unwind::{begin_unwind, begin_unwind_fmt}; - -use core::prelude::*; - -mod macros; - -mod at_exit_imp; -mod local_ptr; -mod thread_local_storage; -mod util; -mod libunwind; -mod stack_overflow; -pub mod thunk; - -pub mod args; -pub mod bookkeeping; -pub mod c_str; -pub mod exclusive; -pub mod local; -pub mod mutex; -pub mod stack; -pub mod task; -pub mod thread; -pub mod unwind; - -/// The default error code of the rust runtime if the main task panics instead -/// of exiting cleanly. -pub const DEFAULT_ERROR_CODE: int = 101; - -/// One-time runtime initialization. -/// -/// Initializes global state, including frobbing the crate's logging flags, -/// and storing the process arguments. -pub fn init(argc: int, argv: *const *const u8) { - // FIXME: Derefing these pointers is not safe. - // Need to propagate the unsafety to `start`. - unsafe { - args::init(argc, argv); - local_ptr::init(); - at_exit_imp::init(); - thread::init(); - } - - // FIXME(#14344) this shouldn't be necessary - collections::fixme_14344_be_sure_to_link_to_collections(); - alloc::fixme_14344_be_sure_to_link_to_collections(); - libc::issue_14344_workaround(); -} - -/// Enqueues a procedure to run when the runtime is cleaned up -/// -/// The procedure passed to this function will be executed as part of the -/// runtime cleanup phase. For normal rust programs, this means that it will run -/// after all other tasks have exited. -/// -/// The procedure is *not* executed with a local `Task` available to it, so -/// primitives like logging, I/O, channels, spawning, etc, are *not* available. -/// This is meant for "bare bones" usage to clean up runtime details, this is -/// not meant as a general-purpose "let's clean everything up" function. -/// -/// It is forbidden for procedures to register more `at_exit` handlers when they -/// are running, and doing so will lead to a process abort. -pub fn at_exit(f: F) { - at_exit_imp::push(thunk::Thunk::new(f)); -} - -/// One-time runtime cleanup. -/// -/// This function is unsafe because it performs no checks to ensure that the -/// runtime has completely ceased running. It is the responsibility of the -/// caller to ensure that the runtime is entirely shut down and nothing will be -/// poking around at the internal components. -/// -/// Invoking cleanup while portions of the runtime are still in use may cause -/// undefined behavior. -pub unsafe fn cleanup() { - bookkeeping::wait_for_other_tasks(); - at_exit_imp::run(); - args::cleanup(); - thread::cleanup(); - local_ptr::cleanup(); -} - -// FIXME: these probably shouldn't be public... -#[doc(hidden)] -pub mod shouldnt_be_public { - #[cfg(not(test))] - pub use super::local_ptr::native::maybe_tls_key; - #[cfg(all(not(windows), not(target_os = "android"), not(target_os = "ios")))] - pub use super::local_ptr::compiled::RT_TLS_PTR; -} - -#[cfg(not(test))] -mod std { - pub use core::{fmt, option, cmp, kinds}; -} diff --git a/src/libstd/comm/mod.rs b/src/libstd/comm/mod.rs index 4977f966eba29..8f945fec4d562 100644 --- a/src/libstd/comm/mod.rs +++ b/src/libstd/comm/mod.rs @@ -1516,7 +1516,7 @@ mod test { // wait for the child task to exit before we exit rx2.recv(); - }) + }} } #[cfg(test)] diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 8e28ad1add58a..aa50597c81698 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -41,6 +41,7 @@ use option::Option; use option::Option::{Some, None}; use ops::{Deref, DerefMut, FnOnce}; use result::Result::{Ok, Err}; +use rt; use slice::SliceExt; use str::StrPrelude; use string::String;