auto merge of #15025 : alexcrichton/rust/rollup, r=alexcrichton
This commit is contained in:
commit
3770c42a49
88 changed files with 2251 additions and 1402 deletions
|
|
@ -24,7 +24,6 @@ extern crate debug;
|
|||
use std::comm;
|
||||
use std::os;
|
||||
use std::task;
|
||||
use std::task::TaskBuilder;
|
||||
use std::uint;
|
||||
|
||||
fn move_out<T>(_x: T) {}
|
||||
|
|
@ -64,22 +63,20 @@ fn run(args: &[String]) {
|
|||
let mut worker_results = Vec::new();
|
||||
for _ in range(0u, workers) {
|
||||
let to_child = to_child.clone();
|
||||
let mut builder = TaskBuilder::new();
|
||||
worker_results.push(builder.future_result());
|
||||
builder.spawn(proc() {
|
||||
worker_results.push(task::try_future(proc() {
|
||||
for _ in range(0u, size / workers) {
|
||||
//println!("worker {:?}: sending {:?} bytes", i, num_bytes);
|
||||
to_child.send(bytes(num_bytes));
|
||||
}
|
||||
//println!("worker {:?} exiting", i);
|
||||
});
|
||||
}));
|
||||
}
|
||||
task::spawn(proc() {
|
||||
server(&from_parent, &to_parent);
|
||||
});
|
||||
|
||||
for r in worker_results.iter() {
|
||||
r.recv();
|
||||
for r in worker_results.move_iter() {
|
||||
r.unwrap();
|
||||
}
|
||||
|
||||
//println!("sending stop message");
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ extern crate debug;
|
|||
|
||||
use std::os;
|
||||
use std::task;
|
||||
use std::task::TaskBuilder;
|
||||
use std::uint;
|
||||
|
||||
fn move_out<T>(_x: T) {}
|
||||
|
|
@ -58,29 +57,25 @@ fn run(args: &[String]) {
|
|||
let mut worker_results = Vec::new();
|
||||
let from_parent = if workers == 1 {
|
||||
let (to_child, from_parent) = channel();
|
||||
let mut builder = TaskBuilder::new();
|
||||
worker_results.push(builder.future_result());
|
||||
builder.spawn(proc() {
|
||||
worker_results.push(task::try_future(proc() {
|
||||
for _ in range(0u, size / workers) {
|
||||
//println!("worker {:?}: sending {:?} bytes", i, num_bytes);
|
||||
to_child.send(bytes(num_bytes));
|
||||
}
|
||||
//println!("worker {:?} exiting", i);
|
||||
});
|
||||
}));
|
||||
from_parent
|
||||
} else {
|
||||
let (to_child, from_parent) = channel();
|
||||
for _ in range(0u, workers) {
|
||||
let to_child = to_child.clone();
|
||||
let mut builder = TaskBuilder::new();
|
||||
worker_results.push(builder.future_result());
|
||||
builder.spawn(proc() {
|
||||
worker_results.push(task::try_future(proc() {
|
||||
for _ in range(0u, size / workers) {
|
||||
//println!("worker {:?}: sending {:?} bytes", i, num_bytes);
|
||||
to_child.send(bytes(num_bytes));
|
||||
}
|
||||
//println!("worker {:?} exiting", i);
|
||||
});
|
||||
}));
|
||||
}
|
||||
from_parent
|
||||
};
|
||||
|
|
@ -88,8 +83,8 @@ fn run(args: &[String]) {
|
|||
server(&from_parent, &to_parent);
|
||||
});
|
||||
|
||||
for r in worker_results.iter() {
|
||||
r.recv();
|
||||
for r in worker_results.move_iter() {
|
||||
r.unwrap();
|
||||
}
|
||||
|
||||
//println!("sending stop message");
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ extern crate time;
|
|||
use std::os;
|
||||
use std::result::{Ok, Err};
|
||||
use std::task;
|
||||
use std::task::TaskBuilder;
|
||||
use std::uint;
|
||||
|
||||
fn fib(n: int) -> int {
|
||||
|
|
@ -79,14 +78,12 @@ fn stress_task(id: int) {
|
|||
fn stress(num_tasks: int) {
|
||||
let mut results = Vec::new();
|
||||
for i in range(0, num_tasks) {
|
||||
let mut builder = TaskBuilder::new();
|
||||
results.push(builder.future_result());
|
||||
builder.spawn(proc() {
|
||||
results.push(task::try_future(proc() {
|
||||
stress_task(i);
|
||||
});
|
||||
}));
|
||||
}
|
||||
for r in results.iter() {
|
||||
r.recv();
|
||||
for r in results.move_iter() {
|
||||
r.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
use std::io;
|
||||
use std::io::stdio::StdReader;
|
||||
use std::io::BufferedReader;
|
||||
use std::num::Bitwise;
|
||||
use std::os;
|
||||
|
||||
// Computes a single solution to a given 9x9 sudoku
|
||||
|
|
|
|||
21
src/test/compile-fail/borrowck-array-double-move.rs
Normal file
21
src/test/compile-fail/borrowck-array-double-move.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// 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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn f() {
|
||||
let mut a = [box 0, box 1];
|
||||
drop(a[0]);
|
||||
a[1] = box 2;
|
||||
drop(a[0]); //~ ERROR use of moved value: `a[..]`
|
||||
}
|
||||
|
||||
fn main() {
|
||||
f();
|
||||
}
|
||||
|
||||
|
|
@ -22,7 +22,8 @@ enum CantDeriveThose {}
|
|||
fn main() {
|
||||
doesnt_exist!(); //~ ERROR
|
||||
|
||||
bytes!(invalid); //~ ERROR
|
||||
bytes!(invalid); //~ ERROR non-literal in bytes!
|
||||
//~^ WARN `bytes!` is deprecated
|
||||
|
||||
asm!(invalid); //~ ERROR
|
||||
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@
|
|||
|
||||
fn main() {
|
||||
let vec = bytes!('λ'); //~ ERROR non-ascii char literal in bytes!
|
||||
//~^ WARN `bytes!` is deprecated
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@
|
|||
|
||||
fn main() {
|
||||
let vec = bytes!(foo); //~ ERROR non-literal in bytes!
|
||||
//~^ WARN `bytes!` is deprecated
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@
|
|||
|
||||
fn main() {
|
||||
let vec = bytes!(1024); //~ ERROR too large integer literal in bytes!
|
||||
//~^ WARN `bytes!` is deprecated
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@
|
|||
|
||||
fn main() {
|
||||
let vec = bytes!(1024u8); //~ ERROR too large u8 literal in bytes!
|
||||
//~^ WARN `bytes!` is deprecated
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@
|
|||
|
||||
fn main() {
|
||||
let vec = bytes!(-1024); //~ ERROR non-literal in bytes
|
||||
//~^ WARN `bytes!` is deprecated
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@
|
|||
|
||||
fn main() {
|
||||
let vec = bytes!(-1024u8); //~ ERROR non-literal in bytes
|
||||
//~^ WARN `bytes!` is deprecated
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@
|
|||
|
||||
fn main() {
|
||||
let vec = bytes!(45f64); //~ ERROR unsupported literal in bytes!
|
||||
//~^ WARN `bytes!` is deprecated
|
||||
}
|
||||
|
|
|
|||
25
src/test/debuginfo/issue14411.rs
Normal file
25
src/test/debuginfo/issue14411.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2013-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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// ignore-android: FIXME(#10381)
|
||||
|
||||
// compile-flags:-g
|
||||
|
||||
// No debugger interaction required: just make sure it compiles without
|
||||
// crashing.
|
||||
|
||||
fn test(a: &Vec<u8>) {
|
||||
print!("{}", a.len());
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let data = vec!();
|
||||
test(&data);
|
||||
}
|
||||
30
src/test/run-pass/issue-14865.rs
Normal file
30
src/test/run-pass/issue-14865.rs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2012-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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
enum X {
|
||||
Foo(uint),
|
||||
Bar(bool)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = match Foo(42) {
|
||||
Foo(..) => 1,
|
||||
_ if true => 0,
|
||||
Bar(..) => fail!("Oh dear")
|
||||
};
|
||||
assert_eq!(x, 1);
|
||||
|
||||
let x = match Foo(42) {
|
||||
_ if true => 0,
|
||||
Foo(..) => 1,
|
||||
Bar(..) => fail!("Oh dear")
|
||||
};
|
||||
assert_eq!(x, 0);
|
||||
}
|
||||
29
src/test/run-pass/issue-14958.rs
Normal file
29
src/test/run-pass/issue-14958.rs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// 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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(overloaded_calls)]
|
||||
|
||||
trait Foo {}
|
||||
|
||||
struct Bar;
|
||||
|
||||
impl<'a> std::ops::Fn<(&'a Foo,), ()> for Bar {
|
||||
fn call(&self, _: (&'a Foo,)) {}
|
||||
}
|
||||
|
||||
struct Baz;
|
||||
|
||||
impl Foo for Baz {}
|
||||
|
||||
fn main() {
|
||||
let bar = Bar;
|
||||
let baz = &Baz;
|
||||
bar(baz);
|
||||
}
|
||||
|
|
@ -13,9 +13,7 @@ use std::task::TaskBuilder;
|
|||
static generations: uint = 1024+256+128+49;
|
||||
|
||||
fn spawn(f: proc():Send) {
|
||||
let mut t = TaskBuilder::new();
|
||||
t.opts.stack_size = Some(32 * 1024);
|
||||
t.spawn(f);
|
||||
TaskBuilder::new().stack_size(32 * 1024).spawn(f)
|
||||
}
|
||||
|
||||
fn child_no(x: uint) -> proc():Send {
|
||||
|
|
|
|||
|
|
@ -12,5 +12,5 @@ use std::io;
|
|||
|
||||
pub fn main() {
|
||||
let stdout = &mut io::stdout() as &mut io::Writer;
|
||||
stdout.write(bytes!("Hello!"));
|
||||
stdout.write(b"Hello!");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
// except according to those terms.
|
||||
|
||||
use std::task;
|
||||
use std::task::TaskBuilder;
|
||||
|
||||
pub fn main() { test00(); }
|
||||
|
||||
|
|
@ -17,9 +16,7 @@ fn start(_task_number: int) { println!("Started / Finished task."); }
|
|||
|
||||
fn test00() {
|
||||
let i: int = 0;
|
||||
let mut builder = TaskBuilder::new();
|
||||
let mut result = builder.future_result();
|
||||
builder.spawn(proc() {
|
||||
let mut result = task::try_future(proc() {
|
||||
start(i)
|
||||
});
|
||||
|
||||
|
|
@ -31,7 +28,7 @@ fn test00() {
|
|||
}
|
||||
|
||||
// Try joining tasks that have already finished.
|
||||
result.recv();
|
||||
result.unwrap();
|
||||
|
||||
println!("Joined task.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
extern crate debug;
|
||||
|
||||
use std::task::TaskBuilder;
|
||||
use std::task;
|
||||
|
||||
pub fn main() { println!("===== WITHOUT THREADS ====="); test00(); }
|
||||
|
||||
|
|
@ -39,14 +39,12 @@ fn test00() {
|
|||
let mut results = Vec::new();
|
||||
while i < number_of_tasks {
|
||||
let tx = tx.clone();
|
||||
let mut builder = TaskBuilder::new();
|
||||
results.push(builder.future_result());
|
||||
builder.spawn({
|
||||
results.push(task::try_future({
|
||||
let i = i;
|
||||
proc() {
|
||||
test00_start(&tx, i, number_of_messages)
|
||||
}
|
||||
});
|
||||
}));
|
||||
i = i + 1;
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +60,7 @@ fn test00() {
|
|||
}
|
||||
|
||||
// Join spawned tasks...
|
||||
for r in results.iter() { r.recv(); }
|
||||
for r in results.mut_iter() { r.get_ref(); }
|
||||
|
||||
println!("Completed: Final number is: ");
|
||||
println!("{:?}", sum);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
extern crate debug;
|
||||
|
||||
use std::task::TaskBuilder;
|
||||
use std::task;
|
||||
|
||||
pub fn main() { test00(); }
|
||||
|
||||
|
|
@ -25,9 +25,7 @@ fn test00() {
|
|||
let (tx, rx) = channel();
|
||||
let number_of_messages: int = 10;
|
||||
|
||||
let mut builder = TaskBuilder::new();
|
||||
let result = builder.future_result();
|
||||
builder.spawn(proc() {
|
||||
let result = task::try_future(proc() {
|
||||
test00_start(&tx, number_of_messages);
|
||||
});
|
||||
|
||||
|
|
@ -38,7 +36,7 @@ fn test00() {
|
|||
i += 1;
|
||||
}
|
||||
|
||||
result.recv();
|
||||
result.unwrap();
|
||||
|
||||
assert_eq!(sum, number_of_messages * (number_of_messages - 1) / 2);
|
||||
}
|
||||
|
|
|
|||
26
src/test/run-pass/task-stderr.rs
Normal file
26
src/test/run-pass/task-stderr.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// 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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::io::{ChanReader, ChanWriter};
|
||||
use std::task::TaskBuilder;
|
||||
|
||||
fn main() {
|
||||
let (tx, rx) = channel();
|
||||
let mut reader = ChanReader::new(rx);
|
||||
let stderr = ChanWriter::new(tx);
|
||||
|
||||
let res = TaskBuilder::new().stderr(box stderr as Box<Writer + Send>).try(proc() -> () {
|
||||
fail!("Hello, world!")
|
||||
});
|
||||
assert!(res.is_err());
|
||||
|
||||
let output = reader.read_to_str().unwrap();
|
||||
assert!(output.as_slice().contains("Hello, world!"));
|
||||
}
|
||||
|
|
@ -60,9 +60,7 @@ fn main() {
|
|||
let (tx, rx) = channel();
|
||||
for _ in range(0, 1000) {
|
||||
let tx = tx.clone();
|
||||
let mut builder = TaskBuilder::new();
|
||||
builder.opts.stack_size = Some(64 * 1024);
|
||||
builder.spawn(proc() {
|
||||
TaskBuilder::new().stack_size(64 * 1024).spawn(proc() {
|
||||
let host = addr.ip.to_str();
|
||||
let port = addr.port;
|
||||
match TcpStream::connect(host.as_slice(), port) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ fn test_tempdir() {
|
|||
let path = {
|
||||
let p = TempDir::new_in(&Path::new("."), "foobar").unwrap();
|
||||
let p = p.path();
|
||||
assert!(p.as_vec().ends_with(bytes!("foobar")));
|
||||
assert!(p.as_vec().ends_with(b"foobar"));
|
||||
p.clone()
|
||||
};
|
||||
assert!(!path.exists());
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ impl Trait for Struct {
|
|||
}
|
||||
|
||||
fn foo(mut a: Box<Writer>) {
|
||||
a.write(bytes!("Hello\n"));
|
||||
a.write(b"Hello\n");
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
|||
|
|
@ -9,18 +9,15 @@
|
|||
// except according to those terms.
|
||||
|
||||
use std::task;
|
||||
use std::task::TaskBuilder;
|
||||
|
||||
pub fn main() {
|
||||
let mut builder = TaskBuilder::new();
|
||||
let mut result = builder.future_result();
|
||||
builder.spawn(child);
|
||||
let mut result = task::try_future(child);
|
||||
println!("1");
|
||||
task::deschedule();
|
||||
println!("2");
|
||||
task::deschedule();
|
||||
println!("3");
|
||||
result.recv();
|
||||
result.unwrap();
|
||||
}
|
||||
|
||||
fn child() {
|
||||
|
|
|
|||
|
|
@ -9,15 +9,12 @@
|
|||
// except according to those terms.
|
||||
|
||||
use std::task;
|
||||
use std::task::TaskBuilder;
|
||||
|
||||
pub fn main() {
|
||||
let mut builder = TaskBuilder::new();
|
||||
let mut result = builder.future_result();
|
||||
builder.spawn(child);
|
||||
let mut result = task::try_future(child);
|
||||
println!("1");
|
||||
task::deschedule();
|
||||
result.recv();
|
||||
result.unwrap();
|
||||
}
|
||||
|
||||
fn child() { println!("2"); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue