Skip to content

Commit

Permalink
Auto merge of #32787 - Manishearth:rollup, r=Manishearth
Browse files Browse the repository at this point in the history
Rollup of 11 pull requests

- Successful merges: #32016, #32583, #32699, #32729, #32731, #32738, #32741, #32745, #32748, #32757, #32786
- Failed merges: #32773
  • Loading branch information
bors committed Apr 7, 2016
2 parents a9f34c8 + 903b4c2 commit 6a55f4f
Show file tree
Hide file tree
Showing 189 changed files with 1,307 additions and 800 deletions.
12 changes: 0 additions & 12 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -717,18 +717,6 @@ if [ -n "$CFG_ENABLE_DEBUG_JEMALLOC" ]; then putvar CFG_ENABLE_DEBUG_JEMALLOC; f

if [ -n "$CFG_ENABLE_ORBIT" ]; then putvar CFG_ENABLE_ORBIT; fi

# A magic value that allows the compiler to use unstable features
# during the bootstrap even when doing so would normally be an error
# because of feature staging or because the build turns on
# warnings-as-errors and unstable features default to warnings. The
# build has to match this key in an env var. Meant to be a mild
# deterrent from users just turning on unstable features on the stable
# channel.
# Basing CFG_BOOTSTRAP_KEY on CFG_BOOTSTRAP_KEY lets it get picked up
# during a Makefile reconfig.
CFG_BOOTSTRAP_KEY="${CFG_BOOTSTRAP_KEY-`date +%H:%M:%S`}"
putvar CFG_BOOTSTRAP_KEY

step_msg "looking for build programs"

probe_need CFG_CURLORWGET curl wget
Expand Down
11 changes: 11 additions & 0 deletions mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ CFG_PRERELEASE_VERSION=.1
# versions in the same place
CFG_FILENAME_EXTRA=$(shell printf '%s' $(CFG_RELEASE)$(CFG_EXTRA_FILENAME) | $(CFG_HASH_COMMAND))

# A magic value that allows the compiler to use unstable features during the
# bootstrap even when doing so would normally be an error because of feature
# staging or because the build turns on warnings-as-errors and unstable features
# default to warnings. The build has to match this key in an env var.
#
# This value is keyed off the release to ensure that all compilers for one
# particular release have the same bootstrap key. Note that this is
# intentionally not "secure" by any definition, this is largely just a deterrent
# from users enabling unstable features on the stable compiler.
CFG_BOOTSTRAP_KEY=$(CFG_FILENAME_EXTRA)

ifeq ($(CFG_RELEASE_CHANNEL),stable)
# This is the normal semver version string, e.g. "0.12.0", "0.12.0-nightly"
CFG_RELEASE=$(CFG_RELEASE_NUM)
Expand Down
13 changes: 11 additions & 2 deletions src/bootstrap/build/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,18 @@ pub fn linkcheck(build: &Build, stage: u32, host: &str) {
}

pub fn cargotest(build: &Build, stage: u32, host: &str) {

let ref compiler = Compiler::new(stage, host);

// Configure PATH to find the right rustc. NB. we have to use PATH
// and not RUSTC because the Cargo test suite has tests that will
// fail if rustc is not spelled `rustc`.
let path = build.sysroot(compiler).join("bin");
let old_path = ::std::env::var("PATH").expect("");
let sep = if cfg!(windows) { ";" } else {":" };
let ref newpath = format!("{}{}{}", path.display(), sep, old_path);

build.run(build.tool_cmd(compiler, "cargotest")
.env("RUSTC", build.compiler_path(compiler))
.env("RUSTDOC", build.rustdoc(compiler))
.env("PATH", newpath)
.arg(&build.cargo));
}
2 changes: 1 addition & 1 deletion src/bootstrap/build/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ impl<'a> Step<'a> {
vec![self.librustc(self.compiler(stage))]
}
Source::ToolCargoTest { stage } => {
vec![self.libstd(self.compiler(stage))]
vec![self.libtest(self.compiler(stage))]
}

Source::DistDocs { stage } => vec![self.doc(stage)],
Expand Down
12 changes: 9 additions & 3 deletions src/build_helper/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,16 @@ pub fn cc2ar(cc: &Path, target: &str) -> PathBuf {
if target.contains("musl") || target.contains("msvc") {
PathBuf::from("ar")
} else {
let parent = cc.parent().unwrap();
let file = cc.file_name().unwrap().to_str().unwrap();
cc.parent().unwrap().join(file.replace("gcc", "ar")
.replace("cc", "ar")
.replace("clang", "ar"))
for suffix in &["gcc", "cc", "clang"] {
if let Some(idx) = file.rfind(suffix) {
let mut file = file[..idx].to_owned();
file.push_str("ar");
return parent.join(&file);
}
}
parent.join(file)
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/doc/book/closures.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,13 @@ assert_eq!(6, answer);
This gives us these long, related errors:

```text
error: the trait `core::marker::Sized` is not implemented for the type
`core::ops::Fn(i32) -> i32` [E0277]
error: the trait bound `core::ops::Fn(i32) -> i32 : core::marker::Sized` is not satisfied [E0277]
fn factory() -> (Fn(i32) -> i32) {
^~~~~~~~~~~~~~~~
note: `core::ops::Fn(i32) -> i32` does not have a constant size known at compile-time
fn factory() -> (Fn(i32) -> i32) {
^~~~~~~~~~~~~~~~
error: the trait `core::marker::Sized` is not implemented for the type `core::ops::Fn(i32) -> i32` [E0277]
error: the trait bound `core::ops::Fn(i32) -> i32 : core::marker::Sized` is not satisfied [E0277]
let f = factory();
^
note: `core::ops::Fn(i32) -> i32` does not have a constant size known at compile-time
Expand Down
4 changes: 2 additions & 2 deletions src/doc/book/concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ fn main() {
This won't work, however, and will give us the error:

```text
13:9: 13:22 error: the trait `core::marker::Send` is not
implemented for the type `alloc::rc::Rc<collections::vec::Vec<i32>>`
13:9: 13:22 error: the trait bound `alloc::rc::Rc<collections::vec::Vec<i32>> : core::marker::Send`
is not satisfied
...
13:9: 13:22 note: `alloc::rc::Rc<collections::vec::Vec<i32>>`
cannot be sent between threads safely
Expand Down
4 changes: 2 additions & 2 deletions src/doc/book/traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ print_area(5);
We get a compile-time error:

```text
error: the trait `HasArea` is not implemented for the type `_` [E0277]
error: the trait bound `_ : HasArea` is not satisfied [E0277]
```

## Trait bounds on generic structs
Expand Down Expand Up @@ -496,7 +496,7 @@ impl FooBar for Baz {
If we forget to implement `Foo`, Rust will tell us:

```text
error: the trait `main::Foo` is not implemented for the type `main::Baz` [E0277]
error: the trait bound `main::Baz : main::Foo` is not satisfied [E0277]
```

# Deriving
Expand Down
4 changes: 2 additions & 2 deletions src/doc/book/vectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ v[j];
Indexing with a non-`usize` type gives an error that looks like this:

```text
error: the trait `core::ops::Index<i32>` is not implemented for the type
`collections::vec::Vec<_>` [E0277]
error: the trait bound `collections::vec::Vec<_> : core::ops::Index<i32>`
is not satisfied [E0277]
v[j];
^~~~
note: the type `collections::vec::Vec<_>` cannot be indexed by `i32`
Expand Down
2 changes: 1 addition & 1 deletion src/doc/nomicon/coercions.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn main() {
```

```text
<anon>:10:5: 10:8 error: the trait `Trait` is not implemented for the type `&mut i32` [E0277]
<anon>:10:5: 10:8 error: the trait bound `&mut i32 : Trait` is not satisfied [E0277]
<anon>:10 foo(t);
^~~
```
45 changes: 21 additions & 24 deletions src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
#[unsafe_no_drop_flag]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Arc<T: ?Sized> {
// FIXME #12808: strange name to try to avoid interfering with
// field accesses of the contained type via Deref
_ptr: Shared<ArcInner<T>>,
ptr: Shared<ArcInner<T>>,
}

#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -144,9 +142,7 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Arc<U>> for Arc<T> {}
#[unsafe_no_drop_flag]
#[stable(feature = "arc_weak", since = "1.4.0")]
pub struct Weak<T: ?Sized> {
// FIXME #12808: strange name to try to avoid interfering with
// field accesses of the contained type via Deref
_ptr: Shared<ArcInner<T>>,
ptr: Shared<ArcInner<T>>,
}

#[stable(feature = "arc_weak", since = "1.4.0")]
Expand Down Expand Up @@ -198,7 +194,7 @@ impl<T> Arc<T> {
weak: atomic::AtomicUsize::new(1),
data: data,
};
Arc { _ptr: unsafe { Shared::new(Box::into_raw(x)) } }
Arc { ptr: unsafe { Shared::new(Box::into_raw(x)) } }
}

/// Unwraps the contained value if the `Arc<T>` has exactly one strong reference.
Expand Down Expand Up @@ -230,11 +226,11 @@ impl<T> Arc<T> {
atomic::fence(Acquire);

unsafe {
let ptr = *this._ptr;
let ptr = *this.ptr;
let elem = ptr::read(&(*ptr).data);

// Make a weak pointer to clean up the implicit strong-weak reference
let _weak = Weak { _ptr: this._ptr };
let _weak = Weak { ptr: this.ptr };
mem::forget(this);

Ok(elem)
Expand Down Expand Up @@ -263,6 +259,7 @@ impl<T: ?Sized> Arc<T> {
loop {
// check if the weak counter is currently "locked"; if so, spin.
if cur == usize::MAX {
cur = this.inner().weak.load(Relaxed);
continue;
}

Expand All @@ -274,7 +271,7 @@ impl<T: ?Sized> Arc<T> {
// synchronize with the write coming from `is_unique`, so that the
// events prior to that write happen before this read.
match this.inner().weak.compare_exchange_weak(cur, cur + 1, Acquire, Relaxed) {
Ok(_) => return Weak { _ptr: this._ptr },
Ok(_) => return Weak { ptr: this.ptr },
Err(old) => cur = old,
}
}
Expand Down Expand Up @@ -303,13 +300,13 @@ impl<T: ?Sized> Arc<T> {
// `ArcInner` structure itself is `Sync` because the inner data is
// `Sync` as well, so we're ok loaning out an immutable pointer to these
// contents.
unsafe { &**self._ptr }
unsafe { &**self.ptr }
}

// Non-inlined part of `drop`.
#[inline(never)]
unsafe fn drop_slow(&mut self) {
let ptr = *self._ptr;
let ptr = *self.ptr;

// Destroy the data at this time, even though we may not free the box
// allocation itself (there may still be weak pointers lying around).
Expand Down Expand Up @@ -367,7 +364,7 @@ impl<T: ?Sized> Clone for Arc<T> {
}
}

Arc { _ptr: self._ptr }
Arc { ptr: self.ptr }
}
}

Expand Down Expand Up @@ -435,15 +432,15 @@ impl<T: Clone> Arc<T> {

// Materialize our own implicit weak pointer, so that it can clean
// up the ArcInner as needed.
let weak = Weak { _ptr: this._ptr };
let weak = Weak { ptr: this.ptr };

// mark the data itself as already deallocated
unsafe {
// there is no data race in the implicit write caused by `read`
// here (due to zeroing) because data is no longer accessed by
// other threads (due to there being no more strong refs at this
// point).
let mut swap = Arc::new(ptr::read(&(**weak._ptr).data));
let mut swap = Arc::new(ptr::read(&(**weak.ptr).data));
mem::swap(this, &mut swap);
mem::forget(swap);
}
Expand All @@ -456,7 +453,7 @@ impl<T: Clone> Arc<T> {
// As with `get_mut()`, the unsafety is ok because our reference was
// either unique to begin with, or became one upon cloning the contents.
unsafe {
let inner = &mut **this._ptr;
let inner = &mut **this.ptr;
&mut inner.data
}
}
Expand Down Expand Up @@ -488,7 +485,7 @@ impl<T: ?Sized> Arc<T> {
// the Arc itself to be `mut`, so we're returning the only possible
// reference to the inner data.
unsafe {
let inner = &mut **this._ptr;
let inner = &mut **this.ptr;
Some(&mut inner.data)
}
} else {
Expand Down Expand Up @@ -557,7 +554,7 @@ impl<T: ?Sized> Drop for Arc<T> {
// This structure has #[unsafe_no_drop_flag], so this drop glue may run
// more than once (but it is guaranteed to be zeroed after the first if
// it's run more than once)
let thin = *self._ptr as *const ();
let thin = *self.ptr as *const ();

if thin as usize == mem::POST_DROP_USIZE {
return;
Expand Down Expand Up @@ -638,7 +635,7 @@ impl<T: ?Sized> Weak<T> {

// Relaxed is valid for the same reason it is on Arc's Clone impl
match inner.strong.compare_exchange_weak(n, n + 1, Relaxed, Relaxed) {
Ok(_) => return Some(Arc { _ptr: self._ptr }),
Ok(_) => return Some(Arc { ptr: self.ptr }),
Err(old) => n = old,
}
}
Expand All @@ -647,7 +644,7 @@ impl<T: ?Sized> Weak<T> {
#[inline]
fn inner(&self) -> &ArcInner<T> {
// See comments above for why this is "safe"
unsafe { &**self._ptr }
unsafe { &**self.ptr }
}
}

Expand Down Expand Up @@ -681,7 +678,7 @@ impl<T: ?Sized> Clone for Weak<T> {
}
}

return Weak { _ptr: self._ptr };
return Weak { ptr: self.ptr };
}
}

Expand Down Expand Up @@ -713,7 +710,7 @@ impl<T: ?Sized> Drop for Weak<T> {
/// } // implicit drop
/// ```
fn drop(&mut self) {
let ptr = *self._ptr;
let ptr = *self.ptr;
let thin = ptr as *const ();

// see comments above for why this check is here
Expand Down Expand Up @@ -885,7 +882,7 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Arc<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> fmt::Pointer for Arc<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Pointer::fmt(&*self._ptr, f)
fmt::Pointer::fmt(&*self.ptr, f)
}
}

Expand Down Expand Up @@ -930,7 +927,7 @@ impl<T> Weak<T> {
issue = "30425")]
pub fn new() -> Weak<T> {
unsafe {
Weak { _ptr: Shared::new(Box::into_raw(box ArcInner {
Weak { ptr: Shared::new(Box::into_raw(box ArcInner {
strong: atomic::AtomicUsize::new(0),
weak: atomic::AtomicUsize::new(1),
data: uninitialized(),
Expand Down
Loading

0 comments on commit 6a55f4f

Please sign in to comment.