Navigation Menu

Skip to content

Commit

Permalink
libs: merge librustrt into libstd
Browse files Browse the repository at this point in the history
This commit merges the `rustrt` crate into `std`, undoing part of the
facade. This merger continues the paring down of the runtime system.

Code relying on the public API of `rustrt` will break; some of this API
is now available through `std::rt`, but is likely to change and/or be
removed very soon.

[breaking-change]
  • Loading branch information
aturon committed Dec 19, 2014
1 parent 840de07 commit 2b3477d
Show file tree
Hide file tree
Showing 54 changed files with 2,111 additions and 1,775 deletions.
7 changes: 3 additions & 4 deletions mk/crates.mk
Expand Up @@ -51,7 +51,7 @@

TARGET_CRATES := libc std flate arena term \
serialize getopts collections test time rand \
log regex graphviz core rbml alloc rustrt \
log regex graphviz core rbml alloc \
unicode
RUSTC_CRATES := rustc rustc_typeck rustc_borrowck rustc_driver rustc_trans rustc_back rustc_llvm
HOST_CRATES := syntax $(RUSTC_CRATES) rustdoc regex_macros fmt_macros
Expand All @@ -62,9 +62,8 @@ DEPS_core :=
DEPS_libc := core
DEPS_unicode := core
DEPS_alloc := core libc native:jemalloc
DEPS_rustrt := alloc core libc collections native:rustrt_native
DEPS_std := core libc rand alloc collections rustrt unicode \
native:rust_builtin native:backtrace
DEPS_std := core libc rand alloc collections unicode \
native:rust_builtin native:backtrace native:rustrt_native
DEPS_graphviz := std
DEPS_syntax := std term serialize log fmt_macros arena libc
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
Expand Down
12 changes: 5 additions & 7 deletions src/libcollections/slice.rs
Expand Up @@ -1344,8 +1344,6 @@ pub mod raw {

#[cfg(test)]
mod tests {
extern crate rustrt;

use std::cell::Cell;
use std::default::Default;
use std::mem;
Expand Down Expand Up @@ -1629,9 +1627,9 @@ mod tests {
#[test]
fn test_swap_remove_noncopyable() {
// Tests that we don't accidentally run destructors twice.
let mut v = vec![rustrt::exclusive::Exclusive::new(()),
rustrt::exclusive::Exclusive::new(()),
rustrt::exclusive::Exclusive::new(())];
let mut v = vec![rt::exclusive::Exclusive::new(()),
rt::exclusive::Exclusive::new(()),
rt::exclusive::Exclusive::new(())];
let mut _e = v.swap_remove(0);
assert_eq!(v.len(), 2);
_e = v.swap_remove(1);
Expand Down Expand Up @@ -1736,7 +1734,7 @@ mod tests {
v2.dedup();
/*
* If the boxed pointers were leaked or otherwise misused, valgrind
* and/or rustrt should raise errors.
* and/or rt should raise errors.
*/
}

Expand All @@ -1750,7 +1748,7 @@ mod tests {
v2.dedup();
/*
* If the pointers were leaked or otherwise misused, valgrind and/or
* rustrt should raise errors.
* rt should raise errors.
*/
}

Expand Down
136 changes: 0 additions & 136 deletions src/librustrt/util.rs

This file was deleted.

30 changes: 16 additions & 14 deletions src/librustrt/c_str.rs → src/libstd/c_str.rs
Expand Up @@ -67,17 +67,17 @@
//! }
//! ```

use string::String;
use hash;
use fmt;
use kinds::marker;
use mem;
use core::prelude::*;

use collections::string::String;
use core::hash;
use core::fmt;
use core::kinds::{Sized, marker};
use core::mem;
use core::ptr;
use core::raw::Slice;
use core::slice;
use core::str;
use ptr;
use raw::Slice;
use slice;
use str;
use libc;

/// The representation of a C String.
Expand Down Expand Up @@ -534,9 +534,9 @@ pub unsafe fn from_c_multistring<F>(buf: *const libc::c_char,

#[cfg(test)]
mod tests {
use std::prelude::*;
use std::ptr;
use std::task;
use prelude::*;
use ptr;
use task;
use libc;

use super::*;
Expand Down Expand Up @@ -726,9 +726,11 @@ mod tests {

#[cfg(test)]
mod bench {
use test::Bencher;
extern crate test;

use self::test::Bencher;
use libc;
use std::prelude::*;
use prelude::*;

#[inline]
fn check(s: &str, c_str: *const libc::c_char) {
Expand Down
11 changes: 5 additions & 6 deletions src/libstd/comm/mod.rs
Expand Up @@ -327,7 +327,7 @@ use alloc::arc::Arc;
use core::kinds::marker;
use core::mem;
use core::cell::UnsafeCell;
use rustrt::task::BlockedTask;
use rt::task::BlockedTask;

pub use comm::select::{Select, Handle};

Expand All @@ -336,9 +336,8 @@ macro_rules! test {
mod $name {
#![allow(unused_imports)]

extern crate rustrt;

use prelude::*;
use rt;

use comm::*;
use super::*;
Expand Down Expand Up @@ -1519,7 +1518,7 @@ mod test {
} }

test! { fn sends_off_the_runtime() {
use rustrt::thread::Thread;
use rt::thread::Thread;

let (tx, rx) = channel();
let t = Thread::start(move|| {
Expand All @@ -1534,7 +1533,7 @@ mod test {
} }

test! { fn try_recvs_off_the_runtime() {
use rustrt::thread::Thread;
use rt::thread::Thread;

let (tx, rx) = channel();
let (cdone, pdone) = channel();
Expand Down Expand Up @@ -1984,7 +1983,7 @@ mod sync_tests {
} }

test! { fn try_recvs_off_the_runtime() {
use rustrt::thread::Thread;
use rt::thread::Thread;

let (tx, rx) = sync_channel::<()>(0);
let (cdone, pdone) = channel();
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/comm/oneshot.rs
Expand Up @@ -41,8 +41,8 @@ use core::prelude::*;

use alloc::boxed::Box;
use core::mem;
use rustrt::local::Local;
use rustrt::task::{Task, BlockedTask};
use rt::local::Local;
use rt::task::{Task, BlockedTask};

use sync::atomic;
use comm::Receiver;
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/comm/select.rs
Expand Up @@ -59,8 +59,8 @@ use core::cell::Cell;
use core::kinds::marker;
use core::mem;
use core::uint;
use rustrt::local::Local;
use rustrt::task::{Task, BlockedTask};
use rt::local::Local;
use rt::task::{Task, BlockedTask};

use comm::Receiver;

Expand Down
6 changes: 3 additions & 3 deletions src/libstd/comm/shared.rs
Expand Up @@ -25,9 +25,9 @@ use core::prelude::*;
use alloc::boxed::Box;
use core::cmp;
use core::int;
use rustrt::local::Local;
use rustrt::task::{Task, BlockedTask};
use rustrt::thread::Thread;
use rt::local::Local;
use rt::task::{Task, BlockedTask};
use rt::thread::Thread;

use sync::{atomic, Mutex, MutexGuard};
use comm::mpsc_queue as mpsc;
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/comm/stream.rs
Expand Up @@ -27,9 +27,9 @@ use core::prelude::*;
use alloc::boxed::Box;
use core::cmp;
use core::int;
use rustrt::local::Local;
use rustrt::task::{Task, BlockedTask};
use rustrt::thread::Thread;
use rt::local::Local;
use rt::task::{Task, BlockedTask};
use rt::thread::Thread;

use sync::atomic;
use comm::spsc_queue as spsc;
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/comm/sync.rs
Expand Up @@ -42,9 +42,9 @@ use alloc::boxed::Box;
use vec::Vec;
use core::mem;
use core::cell::UnsafeCell;
use rustrt::local::Local;
use rustrt::mutex::{NativeMutex, LockGuard};
use rustrt::task::{Task, BlockedTask};
use rt::local::Local;
use rt::mutex::{NativeMutex, LockGuard};
use rt::task::{Task, BlockedTask};

use sync::atomic;

Expand Down
6 changes: 3 additions & 3 deletions src/libstd/failure.rs
Expand Up @@ -20,9 +20,9 @@ use option::Option;
use option::Option::{Some, None};
use result::Result::Ok;
use rt::backtrace;
use rustrt::{Stderr, Stdio};
use rustrt::local::Local;
use rustrt::task::Task;
use rt::util::{Stderr, Stdio};
use rt::local::Local;
use rt::task::Task;
use str::Str;
use string::String;

Expand Down
7 changes: 3 additions & 4 deletions src/libstd/io/stdio.rs
Expand Up @@ -42,9 +42,8 @@ use option::Option::{Some, None};
use ops::{Deref, DerefMut, FnOnce};
use result::Result::{Ok, Err};
use rt;
use rustrt;
use rustrt::local::Local;
use rustrt::task::Task;
use rt::local::Local;
use rt::task::Task;
use slice::SliceExt;
use str::StrPrelude;
use string::String;
Expand Down Expand Up @@ -345,7 +344,7 @@ fn with_task_stdout<F>(f: F) where
});
result
} else {
let mut io = rustrt::Stdout;
let mut io = rt::util::Stdout;
f(&mut io as &mut Writer)
};
match result {
Expand Down

0 comments on commit 2b3477d

Please sign in to comment.