Skip to content

Commit

Permalink
auto merge of #14234 : alexcrichton/rust/rollup, r=alexcrichton
Browse files Browse the repository at this point in the history
Let's try this again!
  • Loading branch information
bors committed May 15, 2014
2 parents 182c96c + 17df573 commit 0481d62
Show file tree
Hide file tree
Showing 95 changed files with 2,032 additions and 432 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
#
# * `TESTNAME=...` - Specify the name of tests to run
# * `CHECK_IGNORED=1` - Run normally-ignored tests
# * `NO_BENCH=1` - Don't run crate benchmarks (disable `--bench` flag)
# * `PLEASE_BENCH=1` - Run crate benchmarks (enable `--bench` flag)
#
# * `CFG_ENABLE_VALGRIND=1` - Run tests under valgrind
# * `VALGRIND_COMPILE=1` - Run the compiler itself under valgrind
Expand Down
7 changes: 5 additions & 2 deletions mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,21 @@

TARGET_CRATES := libc std green rustuv native flate arena glob term semver \
uuid serialize sync getopts collections num test time rand \
workcache url log regex graphviz core
workcache url log regex graphviz core rlibc
HOST_CRATES := syntax rustc rustdoc fourcc hexfloat regex_macros fmt_macros
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
TOOLS := compiletest rustdoc rustc

DEPS_core :=
DEPS_rlibc :=
DEPS_std := core libc native:rustrt native:compiler-rt native:backtrace native:jemalloc
DEPS_graphviz := std
DEPS_green := std rand native:context_switch
DEPS_rustuv := std native:uv native:uv_support
DEPS_native := std
DEPS_syntax := std term serialize collections log fmt_macros
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
collections time log
collections time log graphviz
DEPS_rustdoc := rustc native:hoedown serialize sync getopts collections \
test time
DEPS_flate := std native:miniz
Expand Down Expand Up @@ -98,6 +100,7 @@ TOOL_SOURCE_rustdoc := $(S)src/driver/driver.rs
TOOL_SOURCE_rustc := $(S)src/driver/driver.rs

ONLY_RLIB_core := 1
ONLY_RLIB_rlibc := 1

################################################################################
# You should not need to edit below this line
Expand Down
12 changes: 9 additions & 3 deletions mk/docs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ DOCS := index intro tutorial guide-ffi guide-macros guide-lifetimes \
guide-tasks guide-container guide-pointers guide-testing \
guide-runtime complement-bugreport complement-cheatsheet \
complement-lang-faq complement-project-faq rust rustdoc \
guide-unsafe not_found
guide-unsafe

PDF_DOCS := tutorial rust

Expand All @@ -42,10 +42,11 @@ L10N_LANGS := ja
# Generally no need to edit below here.

# The options are passed to the documentation generators.
RUSTDOC_HTML_OPTS = --markdown-css rust.css \
--markdown-before-content=doc/version_info.html \
RUSTDOC_HTML_OPTS_NO_CSS = --markdown-before-content=doc/version_info.html \
--markdown-in-header=doc/favicon.inc --markdown-after-content=doc/footer.inc

RUSTDOC_HTML_OPTS = $(RUSTDOC_HTML_OPTS_NO_CSS) --markdown-css rust.css

PANDOC_BASE_OPTS := --standalone --toc --number-sections
PANDOC_TEX_OPTS = $(PANDOC_BASE_OPTS) --include-before-body=doc/version.tex \
--from=markdown --include-before-body=doc/footer.tex --to=latex
Expand Down Expand Up @@ -152,6 +153,11 @@ doc/footer.tex: $(D)/footer.inc | doc/
@$(call E, pandoc: $@)
$(CFG_PANDOC) --from=html --to=latex $< --output=$@

# HTML (rustdoc)
DOC_TARGETS += doc/not_found.html
doc/not_found.html: $(D)/not_found.md $(HTML_DEPS) | doc/
$(RUSTDOC) $(RUSTDOC_HTML_OPTS_NO_CSS) --markdown-css http://static.rust-lang.org/doc/master/rust.css $<

define DEF_DOC

# HTML (rustdoc)
Expand Down
6 changes: 3 additions & 3 deletions mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ ifdef CHECK_IGNORED
TESTARGS += --ignored
endif

TEST_BENCH = --bench
TEST_BENCH =

# Arguments to the cfail/rfail/rpass/bench tests
ifdef CFG_VALGRIND
CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
TEST_BENCH =
endif

ifdef NO_BENCH
TEST_BENCH =
ifdef PLEASE_BENCH
TEST_BENCH = --bench
endif

# Arguments to the perf tests
Expand Down
2 changes: 2 additions & 0 deletions src/doc/rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -1799,6 +1799,8 @@ type int8_t = i8;
- `no_start` - disable linking to the `native` crate, which specifies the
"start" language item.
- `no_std` - disable linking to the `std` crate.
- `no_builtins` - disable optimizing certain code patterns to invocations of
library functions that are assumed to exist

### Module-only attributes

Expand Down
34 changes: 34 additions & 0 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,25 @@ impl<'b, T> Deref<T> for Ref<'b, T> {
}
}

/// Copy a `Ref`.
///
/// The `RefCell` is already immutably borrowed, so this cannot fail.
///
/// A `Clone` implementation would interfere with the widespread
/// use of `r.borrow().clone()` to clone the contents of a `RefCell`.
#[experimental]
pub fn clone_ref<'b, T>(orig: &Ref<'b, T>) -> Ref<'b, T> {
// Since this Ref exists, we know the borrow flag
// is not set to WRITING.
let borrow = orig.parent.borrow.get();
debug_assert!(borrow != WRITING && borrow != UNUSED);
orig.parent.borrow.set(borrow + 1);

Ref {
parent: orig.parent,
}
}

/// Wraps a mutable borrowed reference to a value in a `RefCell` box.
pub struct RefMut<'b, T> {
parent: &'b RefCell<T>
Expand Down Expand Up @@ -307,4 +326,19 @@ mod test {
let _ = _b;
let _b = x.borrow_mut();
}

#[test]
fn clone_ref_updates_flag() {
let x = RefCell::new(0);
{
let b1 = x.borrow();
assert!(x.try_borrow_mut().is_none());
{
let _b2 = clone_ref(&b1);
assert!(x.try_borrow_mut().is_none());
}
assert!(x.try_borrow_mut().is_none());
}
assert!(x.try_borrow_mut().is_some());
}
}
18 changes: 17 additions & 1 deletion src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,23 @@ pub fn max<T: TotalOrd>(v1: T, v2: T) -> T {
// Implementation of Eq/TotalEq for some primitive types
#[cfg(not(test))]
mod impls {
use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering};
use cmp::{Ord, TotalOrd, Eq, TotalEq, Ordering, Equal};

impl Eq for () {
#[inline]
fn eq(&self, _other: &()) -> bool { true }
#[inline]
fn ne(&self, _other: &()) -> bool { false }
}
impl TotalEq for () {}
impl Ord for () {
#[inline]
fn lt(&self, _other: &()) -> bool { false }
}
impl TotalOrd for () {
#[inline]
fn cmp(&self, _other: &()) -> Ordering { Equal }
}

// & pointers
impl<'a, T: Eq> Eq for &'a T {
Expand Down
5 changes: 5 additions & 0 deletions src/libcore/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ pub trait Default {
fn default() -> Self;
}

impl Default for () {
#[inline]
fn default() -> () { () }
}

impl<T: Default + 'static> Default for @T {
fn default() -> @T { @Default::default() }
}
7 changes: 3 additions & 4 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
//! * `memcpy`, `memcmp`, `memset` - These are core memory routines which are
//! often generated by LLVM. Additionally, this library can make explicit
//! calls to these funcitons. Their signatures are the same as found in C.
//! These functions are often provided by the system libc, but can also be
//! provided by `librlibc` which is distributed with the standard rust
//! distribution.
//!
//! * `rust_begin_unwind` - This function takes three arguments, a
//! `&fmt::Arguments`, a `&str`, and a `uint. These three arguments dictate
Expand Down Expand Up @@ -100,7 +103,6 @@ pub mod container;
/* Core types and methods on primitives */

mod unicode;
mod unit;
pub mod any;
pub mod atomics;
pub mod bool;
Expand All @@ -116,9 +118,6 @@ pub mod slice;
pub mod str;
pub mod tuple;

#[cfg(stage0, not(test))]
pub mod owned;

// FIXME: this module should not exist. Once owned allocations are no longer a
// language type, this module can move outside to the owned allocation
// crate.
Expand Down
101 changes: 0 additions & 101 deletions src/libcore/owned.rs

This file was deleted.

45 changes: 0 additions & 45 deletions src/libcore/unit.rs

This file was deleted.

5 changes: 2 additions & 3 deletions src/libgreen/sched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1137,11 +1137,10 @@ mod test {
fn test_schedule_home_states() {
use sleeper_list::SleeperList;
use super::{Shutdown, Scheduler, SchedHandle};
use std::unstable::run_in_bare_thread;
use std::rt::thread::Thread;
use std::sync::deque::BufferPool;

run_in_bare_thread(proc() {
Thread::start(proc() {
let sleepers = SleeperList::new();
let mut pool = BufferPool::new();
let (normal_worker, normal_stealer) = pool.deque();
Expand Down Expand Up @@ -1260,7 +1259,7 @@ mod test {

normal_thread.join();
special_thread.join();
});
}).join();
}

//#[test]
Expand Down
4 changes: 1 addition & 3 deletions src/libnative/io/file_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,7 @@ fn mkstat(stat: &libc::stat) -> io::FileStat {
io::FileStat {
size: stat.st_size as u64,
kind: kind,
perm: unsafe {
io::FilePermission::from_bits(stat.st_mode as u32) & io::AllPermissions
},
perm: io::FilePermission::from_bits_truncate(stat.st_mode as u32),
created: mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64),
modified: mktime(stat.st_mtime as u64, stat.st_mtime_nsec as u64),
accessed: mktime(stat.st_atime as u64, stat.st_atime_nsec as u64),
Expand Down
Loading

0 comments on commit 0481d62

Please sign in to comment.