Auto merge of #32561 - steveklabnik:rollup, r=steveklabnik

Rollup of 7 pull requests

- Successful merges: #32177, #32235, #32472, #32504, #32507, #32509, #32534
- Failed merges:
This commit is contained in:
bors 2016-03-28 12:52:03 -07:00
commit 221c940bf3
16 changed files with 73 additions and 44 deletions

View File

@ -502,5 +502,5 @@ assert_eq!(6, answer);
```
By making the inner closure a `move Fn`, we create a new stack frame for our
closure. By `Box`ing it up, weve given it a known size, and allowing it to
closure. By `Box`ing it up, weve given it a known size, allowing it to
escape our stack frame.

View File

@ -417,7 +417,7 @@ first. This leaves the top-level project directory (in this case,
to your code. In this way, using Cargo helps you keep your projects nice and
tidy. There's a place for everything, and everything is in its place.
Now, copy *main.rs* to the *src* directory, and delete the compiled file you
Now, move *main.rs* into the *src* directory, and delete the compiled file you
created with `rustc`. As usual, replace `main` with `main.exe` if you're on
Windows.

View File

@ -337,8 +337,8 @@ fn main() {
}
```
Instead you need to pass the variable name into the invocation, so its tagged
with the right syntax context.
Instead you need to pass the variable name into the invocation, so that its
tagged with the right syntax context.
```rust
macro_rules! foo {
@ -470,7 +470,7 @@ which syntactic form it matches.
* `ty`: a type. Examples: `i32`; `Vec<(char, String)>`; `&T`.
* `pat`: a pattern. Examples: `Some(t)`; `(17, 'a')`; `_`.
* `stmt`: a single statement. Example: `let x = 3`.
* `block`: a brace-delimited sequence of statements. Example:
* `block`: a brace-delimited sequence of statements and optionally an expression. Example:
`{ log(error, "hi"); return 12; }`.
* `item`: an [item][item]. Examples: `fn foo() { }`; `struct Bar;`.
* `meta`: a "meta item", as found in attributes. Example: `cfg(target_os = "windows")`.

View File

@ -107,7 +107,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize;
/// use std::thread;
///
/// fn main() {
/// let numbers: Vec<_> = (0..100u32).collect();
/// let numbers: Vec<_> = (0..100).collect();
/// let shared_numbers = Arc::new(numbers);
///
/// for _ in 0..10 {
@ -1118,7 +1118,7 @@ mod tests {
#[test]
fn test_strong_count() {
let a = Arc::new(0u32);
let a = Arc::new(0);
assert!(Arc::strong_count(&a) == 1);
let w = Arc::downgrade(&a);
assert!(Arc::strong_count(&a) == 1);
@ -1135,7 +1135,7 @@ mod tests {
#[test]
fn test_weak_count() {
let a = Arc::new(0u32);
let a = Arc::new(0);
assert!(Arc::strong_count(&a) == 1);
assert!(Arc::weak_count(&a) == 0);
let w = Arc::downgrade(&a);
@ -1161,7 +1161,7 @@ mod tests {
#[test]
fn show_arc() {
let a = Arc::new(5u32);
let a = Arc::new(5);
assert_eq!(format!("{:?}", a), "5");
}

View File

@ -1014,7 +1014,7 @@ mod tests {
#[test]
fn test_strong_count() {
let a = Rc::new(0u32);
let a = Rc::new(0);
assert!(Rc::strong_count(&a) == 1);
let w = Rc::downgrade(&a);
assert!(Rc::strong_count(&a) == 1);
@ -1031,7 +1031,7 @@ mod tests {
#[test]
fn test_weak_count() {
let a = Rc::new(0u32);
let a = Rc::new(0);
assert!(Rc::strong_count(&a) == 1);
assert!(Rc::weak_count(&a) == 0);
let w = Rc::downgrade(&a);

View File

@ -1305,10 +1305,10 @@ mod tests {
//
// https://github.com/rust-lang/rust/issues/26021
let mut v1 = LinkedList::new();
v1.push_front(1u8);
v1.push_front(1u8);
v1.push_front(1u8);
v1.push_front(1u8);
v1.push_front(1);
v1.push_front(1);
v1.push_front(1);
v1.push_front(1);
let _ = v1.split_off(3); // Dropping this now should not cause laundry consumption
assert_eq!(v1.len(), 3);
@ -1319,10 +1319,10 @@ mod tests {
#[test]
fn test_split_off() {
let mut v1 = LinkedList::new();
v1.push_front(1u8);
v1.push_front(1u8);
v1.push_front(1u8);
v1.push_front(1u8);
v1.push_front(1);
v1.push_front(1);
v1.push_front(1);
v1.push_front(1);
// test all splits
for ix in 0..1 + v1.len() {

View File

@ -267,9 +267,9 @@ fn test_swap_remove_fail() {
fn test_swap_remove_noncopyable() {
// Tests that we don't accidentally run destructors twice.
let mut v: Vec<Box<_>> = Vec::new();
v.push(box 0u8);
v.push(box 0u8);
v.push(box 0u8);
v.push(box 0);
v.push(box 0);
v.push(box 0);
let mut _e = v.swap_remove(0);
assert_eq!(v.len(), 2);
_e = v.swap_remove(1);
@ -884,7 +884,7 @@ fn test_overflow_does_not_cause_segfault_managed() {
#[test]
fn test_mut_split_at() {
let mut values = [1u8,2,3,4,5];
let mut values = [1,2,3,4,5];
{
let (left, right) = values.split_at_mut(2);
{

View File

@ -327,6 +327,30 @@ fn main() {
<Test as Trait1>::foo()
}
```
One last example:
```
trait F {
fn m(&self);
}
trait G {
fn m(&self);
}
struct X;
impl F for X { fn m(&self) { println!("I am F"); } }
impl G for X { fn m(&self) { println!("I am G"); } }
fn main() {
let f = X;
F::m(&f); // it displays "I am F"
G::m(&f); // it displays "I am G"
}
```
"##,
E0035: r##"

View File

@ -17,16 +17,21 @@ use sync::{Mutex, Condvar};
/// use std::sync::{Arc, Barrier};
/// use std::thread;
///
/// let mut handles = Vec::with_capacity(10);
/// let barrier = Arc::new(Barrier::new(10));
/// for _ in 0..10 {
/// let c = barrier.clone();
/// // The same messages will be printed together.
/// // You will NOT see any interleaving.
/// thread::spawn(move|| {
/// handles.push(thread::spawn(move|| {
/// println!("before wait");
/// c.wait();
/// println!("after wait");
/// });
/// }));
/// }
/// // Wait for other threads to finish.
/// for handle in handles {
/// handle.join().unwrap();
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]