test: Fix check-fast for resolve changes. rs=bustage
This commit is contained in:
parent
16ec9aa6e7
commit
fcc470c0ee
45 changed files with 197 additions and 187 deletions
|
@ -14,7 +14,7 @@
|
||||||
enum t { make_t(@int), clam, }
|
enum t { make_t(@int), clam, }
|
||||||
|
|
||||||
fn foo(s: @int) {
|
fn foo(s: @int) {
|
||||||
let count = core::sys::refcount(s);
|
let count = ::core::sys::refcount(s);
|
||||||
let x: t = make_t(s); // ref up
|
let x: t = make_t(s); // ref up
|
||||||
|
|
||||||
match x {
|
match x {
|
||||||
|
@ -24,20 +24,20 @@ fn foo(s: @int) {
|
||||||
}
|
}
|
||||||
_ => { debug!("?"); fail; }
|
_ => { debug!("?"); fail; }
|
||||||
}
|
}
|
||||||
log(debug, core::sys::refcount(s));
|
log(debug, ::core::sys::refcount(s));
|
||||||
assert (core::sys::refcount(s) == count + 1u);
|
assert (::core::sys::refcount(s) == count + 1u);
|
||||||
let _ = core::sys::refcount(s); // don't get bitten by last-use.
|
let _ = ::core::sys::refcount(s); // don't get bitten by last-use.
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let s: @int = @0; // ref up
|
let s: @int = @0; // ref up
|
||||||
|
|
||||||
let count = core::sys::refcount(s);
|
let count = ::core::sys::refcount(s);
|
||||||
|
|
||||||
foo(s); // ref up then down
|
foo(s); // ref up then down
|
||||||
|
|
||||||
log(debug, core::sys::refcount(s));
|
log(debug, ::core::sys::refcount(s));
|
||||||
let count2 = core::sys::refcount(s);
|
let count2 = ::core::sys::refcount(s);
|
||||||
let _ = core::sys::refcount(s); // don't get bitten by last-use.
|
let _ = ::core::sys::refcount(s); // don't get bitten by last-use.
|
||||||
assert count == count2;
|
assert count == count2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,25 +10,25 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
|
||||||
fn a(c: core::oldcomm::Chan<int>) { core::oldcomm::send(c, 10); }
|
fn a(c: ::core::oldcomm::Chan<int>) { ::core::oldcomm::send(c, 10); }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let p = core::oldcomm::Port();
|
let p = ::core::oldcomm::Port();
|
||||||
let ch = core::oldcomm::Chan(&p);
|
let ch = ::core::oldcomm::Chan(&p);
|
||||||
task::spawn(|| a(ch) );
|
task::spawn(|| a(ch) );
|
||||||
task::spawn(|| a(ch) );
|
task::spawn(|| a(ch) );
|
||||||
let mut n: int = 0;
|
let mut n: int = 0;
|
||||||
n = core::oldcomm::recv(p);
|
n = ::core::oldcomm::recv(p);
|
||||||
n = core::oldcomm::recv(p);
|
n = ::core::oldcomm::recv(p);
|
||||||
// debug!("Finished.");
|
// debug!("Finished.");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn b(c: core::oldcomm::Chan<int>) {
|
fn b(c: ::core::oldcomm::Chan<int>) {
|
||||||
// debug!("task b0");
|
// debug!("task b0");
|
||||||
// debug!("task b1");
|
// debug!("task b1");
|
||||||
// debug!("task b2");
|
// debug!("task b2");
|
||||||
// debug!("task b3");
|
// debug!("task b3");
|
||||||
// debug!("task b4");
|
// debug!("task b4");
|
||||||
// debug!("task b5");
|
// debug!("task b5");
|
||||||
core::oldcomm::send(c, 10);
|
::core::oldcomm::send(c, 10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,28 +10,28 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
|
||||||
fn a(c: core::oldcomm::Chan<int>) {
|
fn a(c: ::core::oldcomm::Chan<int>) {
|
||||||
debug!("task a0");
|
debug!("task a0");
|
||||||
debug!("task a1");
|
debug!("task a1");
|
||||||
core::oldcomm::send(c, 10);
|
::core::oldcomm::send(c, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let p = core::oldcomm::Port();
|
let p = ::core::oldcomm::Port();
|
||||||
let ch = core::oldcomm::Chan(&p);
|
let ch = ::core::oldcomm::Chan(&p);
|
||||||
task::spawn(|| a(ch) );
|
task::spawn(|| a(ch) );
|
||||||
task::spawn(|| b(ch) );
|
task::spawn(|| b(ch) );
|
||||||
let mut n: int = 0;
|
let mut n: int = 0;
|
||||||
n = core::oldcomm::recv(p);
|
n = ::core::oldcomm::recv(p);
|
||||||
n = core::oldcomm::recv(p);
|
n = ::core::oldcomm::recv(p);
|
||||||
debug!("Finished.");
|
debug!("Finished.");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn b(c: core::oldcomm::Chan<int>) {
|
fn b(c: ::core::oldcomm::Chan<int>) {
|
||||||
debug!("task b0");
|
debug!("task b0");
|
||||||
debug!("task b1");
|
debug!("task b1");
|
||||||
debug!("task b2");
|
debug!("task b2");
|
||||||
debug!("task b2");
|
debug!("task b2");
|
||||||
debug!("task b3");
|
debug!("task b3");
|
||||||
core::oldcomm::send(c, 10);
|
::core::oldcomm::send(c, 10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
|
||||||
fn a(c: core::oldcomm::Chan<int>) {
|
fn a(c: ::core::oldcomm::Chan<int>) {
|
||||||
if true {
|
if true {
|
||||||
debug!("task a");
|
debug!("task a");
|
||||||
debug!("task a");
|
debug!("task a");
|
||||||
|
@ -18,7 +18,7 @@ fn a(c: core::oldcomm::Chan<int>) {
|
||||||
debug!("task a");
|
debug!("task a");
|
||||||
debug!("task a");
|
debug!("task a");
|
||||||
}
|
}
|
||||||
core::oldcomm::send(c, 10);
|
::core::oldcomm::send(c, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn k(x: int) -> int { return 15; }
|
fn k(x: int) -> int { return 15; }
|
||||||
|
@ -34,18 +34,18 @@ fn main() {
|
||||||
let mut n: int = 2 + 3 * 7;
|
let mut n: int = 2 + 3 * 7;
|
||||||
let s: ~str = ~"hello there";
|
let s: ~str = ~"hello there";
|
||||||
let p = oldcomm::Port();
|
let p = oldcomm::Port();
|
||||||
let ch = core::oldcomm::Chan(&p);
|
let ch = ::core::oldcomm::Chan(&p);
|
||||||
task::spawn(|| a(ch) );
|
task::spawn(|| a(ch) );
|
||||||
task::spawn(|| b(ch) );
|
task::spawn(|| b(ch) );
|
||||||
let mut x: int = 10;
|
let mut x: int = 10;
|
||||||
x = g(n, s);
|
x = g(n, s);
|
||||||
log(debug, x);
|
log(debug, x);
|
||||||
n = core::oldcomm::recv(p);
|
n = ::core::oldcomm::recv(p);
|
||||||
n = core::oldcomm::recv(p);
|
n = ::core::oldcomm::recv(p);
|
||||||
debug!("children finished, root finishing");
|
debug!("children finished, root finishing");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn b(c: core::oldcomm::Chan<int>) {
|
fn b(c: ::core::oldcomm::Chan<int>) {
|
||||||
if true {
|
if true {
|
||||||
debug!("task b");
|
debug!("task b");
|
||||||
debug!("task b");
|
debug!("task b");
|
||||||
|
@ -54,5 +54,5 @@ fn b(c: core::oldcomm::Chan<int>) {
|
||||||
debug!("task b");
|
debug!("task b");
|
||||||
debug!("task b");
|
debug!("task b");
|
||||||
}
|
}
|
||||||
core::oldcomm::send(c, 10);
|
::core::oldcomm::send(c, 10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,9 +63,9 @@ fn test_box() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_ptr() unsafe {
|
fn test_ptr() unsafe {
|
||||||
let p1: *u8 = core::cast::reinterpret_cast(&0);
|
let p1: *u8 = ::core::cast::reinterpret_cast(&0);
|
||||||
let p2: *u8 = core::cast::reinterpret_cast(&0);
|
let p2: *u8 = ::core::cast::reinterpret_cast(&0);
|
||||||
let p3: *u8 = core::cast::reinterpret_cast(&1);
|
let p3: *u8 = ::core::cast::reinterpret_cast(&1);
|
||||||
|
|
||||||
assert p1 == p2;
|
assert p1 == p2;
|
||||||
assert p1 != p3;
|
assert p1 != p3;
|
||||||
|
@ -110,8 +110,8 @@ fn test_class() {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
error!("q = %x, r = %x",
|
error!("q = %x, r = %x",
|
||||||
(core::cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&q))),
|
(::core::cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&q))),
|
||||||
(core::cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&r))));
|
(::core::cast::reinterpret_cast::<*p, uint>(&ptr::addr_of(&r))));
|
||||||
}
|
}
|
||||||
assert(q == r);
|
assert(q == r);
|
||||||
r.y = 17;
|
r.y = 17;
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
// course preferable, as the value itself is
|
// course preferable, as the value itself is
|
||||||
// irrelevant).
|
// irrelevant).
|
||||||
|
|
||||||
fn foo(&&x: ()) -> core::oldcomm::Port<()> {
|
fn foo(&&x: ()) -> ::core::oldcomm::Port<()> {
|
||||||
let p = core::oldcomm::Port();
|
let p = ::core::oldcomm::Port();
|
||||||
let c = core::oldcomm::Chan(&p);
|
let c = ::core::oldcomm::Chan(&p);
|
||||||
do task::spawn() |copy c, copy x| {
|
do task::spawn() |copy c, copy x| {
|
||||||
c.send(x);
|
c.send(x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
extern mod cci_capture_clause;
|
extern mod cci_capture_clause;
|
||||||
|
|
||||||
use core::oldcomm::recv;
|
use ::core::oldcomm::recv;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
cci_capture_clause::foo(()).recv()
|
cci_capture_clause::foo(()).recv()
|
||||||
|
|
|
@ -10,32 +10,32 @@
|
||||||
|
|
||||||
// Issue #763
|
// Issue #763
|
||||||
|
|
||||||
enum request { quit, close(core::oldcomm::Chan<bool>), }
|
enum request { quit, close(::core::oldcomm::Chan<bool>), }
|
||||||
|
|
||||||
type ctx = core::oldcomm::Chan<request>;
|
type ctx = ::core::oldcomm::Chan<request>;
|
||||||
|
|
||||||
fn request_task(c: core::oldcomm::Chan<ctx>) {
|
fn request_task(c: ::core::oldcomm::Chan<ctx>) {
|
||||||
let p = core::oldcomm::Port();
|
let p = ::core::oldcomm::Port();
|
||||||
core::oldcomm::send(c, core::oldcomm::Chan(&p));
|
::core::oldcomm::send(c, ::core::oldcomm::Chan(&p));
|
||||||
let mut req: request;
|
let mut req: request;
|
||||||
req = core::oldcomm::recv(p);
|
req = ::core::oldcomm::recv(p);
|
||||||
// Need to drop req before receiving it again
|
// Need to drop req before receiving it again
|
||||||
req = core::oldcomm::recv(p);
|
req = ::core::oldcomm::recv(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_cx() -> ctx {
|
fn new_cx() -> ctx {
|
||||||
let p = core::oldcomm::Port();
|
let p = ::core::oldcomm::Port();
|
||||||
let ch = core::oldcomm::Chan(&p);
|
let ch = ::core::oldcomm::Chan(&p);
|
||||||
let t = task::spawn(|| request_task(ch) );
|
let t = task::spawn(|| request_task(ch) );
|
||||||
let mut cx: ctx;
|
let mut cx: ctx;
|
||||||
cx = core::oldcomm::recv(p);
|
cx = ::core::oldcomm::recv(p);
|
||||||
return cx;
|
return cx;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let cx = new_cx();
|
let cx = new_cx();
|
||||||
|
|
||||||
let p = core::oldcomm::Port::<bool>();
|
let p = ::core::oldcomm::Port::<bool>();
|
||||||
core::oldcomm::send(cx, close(core::oldcomm::Chan(&p)));
|
::core::oldcomm::send(cx, close(::core::oldcomm::Chan(&p)));
|
||||||
core::oldcomm::send(cx, quit);
|
::core::oldcomm::send(cx, quit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// xfail-fast
|
// xfail-fast
|
||||||
// aux-build:cci_class_cast.rs
|
// aux-build:cci_class_cast.rs
|
||||||
extern mod cci_class_cast;
|
extern mod cci_class_cast;
|
||||||
use core::to_str::ToStr;
|
use ::core::to_str::ToStr;
|
||||||
use cci_class_cast::kitty::*;
|
use cci_class_cast::kitty::*;
|
||||||
|
|
||||||
fn print_out<T: ToStr>(thing: T, expected: ~str) {
|
fn print_out<T: ToStr>(thing: T, expected: ~str) {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// xfail-fast
|
// xfail-fast
|
||||||
use core::to_str::*;
|
use ::core::to_str::*;
|
||||||
|
|
||||||
struct cat {
|
struct cat {
|
||||||
priv mut meows : uint,
|
priv mut meows : uint,
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
enum x { foo }
|
enum x { foo }
|
||||||
impl x : core::cmp::Eq {
|
impl x : ::core::cmp::Eq {
|
||||||
pure fn eq(&self, other: &x) -> bool {
|
pure fn eq(&self, other: &x) -> bool {
|
||||||
(*self) as int == (*other) as int
|
(*self) as int == (*other) as int
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,16 +12,16 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let p = oldcomm::Port();
|
let p = oldcomm::Port();
|
||||||
let ch = core::oldcomm::Chan(&p);
|
let ch = ::core::oldcomm::Chan(&p);
|
||||||
let t = task::spawn(|| child(ch) );
|
let t = task::spawn(|| child(ch) );
|
||||||
let y = core::oldcomm::recv(p);
|
let y = ::core::oldcomm::recv(p);
|
||||||
error!("received");
|
error!("received");
|
||||||
log(error, y);
|
log(error, y);
|
||||||
assert (y == 10);
|
assert (y == 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn child(c: core::oldcomm::Chan<int>) {
|
fn child(c: ::core::oldcomm::Chan<int>) {
|
||||||
error!("sending");
|
error!("sending");
|
||||||
core::oldcomm::send(c, 10);
|
::core::oldcomm::send(c, 10);
|
||||||
error!("value sent");
|
error!("value sent");
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,5 +14,5 @@ fn main() {
|
||||||
|
|
||||||
let digits: uint = 10 as uint;
|
let digits: uint = 10 as uint;
|
||||||
|
|
||||||
core::io::println(float::to_str(f64::sqrt(42.0f64) as float, digits));
|
::core::io::println(float::to_str(f64::sqrt(42.0f64) as float, digits));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let po = core::oldcomm::Port();
|
let po = ::core::oldcomm::Port();
|
||||||
let ch = core::oldcomm::Chan(&po);
|
let ch = ::core::oldcomm::Chan(&po);
|
||||||
core::oldcomm::send(ch, 10);
|
::core::oldcomm::send(ch, 10);
|
||||||
let i = core::oldcomm::recv(po);
|
let i = ::core::oldcomm::recv(po);
|
||||||
assert (i == 10);
|
assert (i == 10);
|
||||||
core::oldcomm::send(ch, 11);
|
::core::oldcomm::send(ch, 11);
|
||||||
let j = core::oldcomm::recv(po);
|
let j = ::core::oldcomm::recv(po);
|
||||||
assert (j == 11);
|
assert (j == 11);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// xfail-fast
|
||||||
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// xfail-fast
|
||||||
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// xfail-fast
|
||||||
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -12,7 +12,7 @@ struct S<T> {
|
||||||
x: T
|
x: T
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> S<T> : core::ops::Drop {
|
impl<T> S<T> : ::core::ops::Drop {
|
||||||
fn finalize(&self) {
|
fn finalize(&self) {
|
||||||
io::println("bye");
|
io::println("bye");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// xfail-fast
|
||||||
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -23,7 +23,7 @@ extern mod zed {
|
||||||
extern mod libc {
|
extern mod libc {
|
||||||
#[legacy_exports];
|
#[legacy_exports];
|
||||||
fn write(fd: int, buf: *u8,
|
fn write(fd: int, buf: *u8,
|
||||||
count: core::libc::size_t) -> core::libc::ssize_t;
|
count: ::core::libc::size_t) -> ::core::libc::ssize_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[abi = "cdecl"]
|
#[abi = "cdecl"]
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
|
|
||||||
extern mod std;
|
extern mod std;
|
||||||
use core::vec::*;
|
use ::core::vec::*;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut v = from_elem(0u, 0);
|
let mut v = from_elem(0u, 0);
|
||||||
|
|
|
@ -10,9 +10,9 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use core::cast;
|
use ::core::cast;
|
||||||
use core::libc::{c_double, c_int};
|
use ::core::libc::{c_double, c_int};
|
||||||
use core::f64::*;
|
use ::core::f64::*;
|
||||||
|
|
||||||
fn to_c_int(v: &mut int) -> &mut c_int unsafe {
|
fn to_c_int(v: &mut int) -> &mut c_int unsafe {
|
||||||
cast::reinterpret_cast(&v)
|
cast::reinterpret_cast(&v)
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
// tjc: I don't know why
|
// tjc: I don't know why
|
||||||
pub mod pipes {
|
pub mod pipes {
|
||||||
use core::cast::{forget, transmute};
|
use ::core::cast::{forget, transmute};
|
||||||
|
|
||||||
pub enum state {
|
pub enum state {
|
||||||
empty,
|
empty,
|
||||||
|
@ -50,7 +50,7 @@ pub mod pipes {
|
||||||
pub fn atomic_xchg_rel(_dst: &mut int, _src: int) -> int { fail; }
|
pub fn atomic_xchg_rel(_dst: &mut int, _src: int) -> int { fail; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// We should consider moving this to core::unsafe, although I
|
// We should consider moving this to ::core::unsafe, although I
|
||||||
// suspect graydon would want us to use void pointers instead.
|
// suspect graydon would want us to use void pointers instead.
|
||||||
pub unsafe fn uniquify<T>(+x: *T) -> ~T {
|
pub unsafe fn uniquify<T>(+x: *T) -> ~T {
|
||||||
unsafe { cast::transmute(move x) }
|
unsafe { cast::transmute(move x) }
|
||||||
|
@ -212,8 +212,8 @@ pub mod pipes {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod pingpong {
|
pub mod pingpong {
|
||||||
use core::cast;
|
use ::core::cast;
|
||||||
use core::ptr;
|
use ::core::ptr;
|
||||||
|
|
||||||
pub enum ping = ::pipes::send_packet<pong>;
|
pub enum ping = ::pipes::send_packet<pong>;
|
||||||
pub enum pong = ::pipes::send_packet<ping>;
|
pub enum pong = ::pipes::send_packet<ping>;
|
||||||
|
@ -241,7 +241,7 @@ pub mod pingpong {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod client {
|
pub mod client {
|
||||||
use core::option;
|
use ::core::option;
|
||||||
use pingpong;
|
use pingpong;
|
||||||
|
|
||||||
pub type ping = ::pipes::send_packet<pingpong::ping>;
|
pub type ping = ::pipes::send_packet<pingpong::ping>;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// rustc --test map_to_str.rs && ./map_to_str
|
// rustc --test map_to_str.rs && ./map_to_str
|
||||||
extern mod std;
|
extern mod std;
|
||||||
|
|
||||||
use core::io::{WriterUtil};
|
use ::core::io::{WriterUtil};
|
||||||
use std::map::*;
|
use std::map::*;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// Incorrect struct size computation in the FFI, because of not taking
|
// Incorrect struct size computation in the FFI, because of not taking
|
||||||
// the alignment of elements into account.
|
// the alignment of elements into account.
|
||||||
|
|
||||||
use core::libc::*;
|
use ::core::libc::*;
|
||||||
|
|
||||||
struct KEYGEN {
|
struct KEYGEN {
|
||||||
hash_algorithm: [c_uint * 2],
|
hash_algorithm: [c_uint * 2],
|
||||||
|
|
|
@ -15,19 +15,19 @@
|
||||||
https://github.com/graydon/rust/issues/507
|
https://github.com/graydon/rust/issues/507
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fn grandchild(c: core::oldcomm::Chan<int>) { core::oldcomm::send(c, 42); }
|
fn grandchild(c: ::core::oldcomm::Chan<int>) { ::core::oldcomm::send(c, 42); }
|
||||||
|
|
||||||
fn child(c: core::oldcomm::Chan<int>) {
|
fn child(c: ::core::oldcomm::Chan<int>) {
|
||||||
task::spawn(|| grandchild(c) )
|
task::spawn(|| grandchild(c) )
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let p = core::oldcomm::Port();
|
let p = ::core::oldcomm::Port();
|
||||||
let ch = core::oldcomm::Chan(&p);
|
let ch = ::core::oldcomm::Chan(&p);
|
||||||
|
|
||||||
task::spawn(|| child(ch) );
|
task::spawn(|| child(ch) );
|
||||||
|
|
||||||
let x: int = core::oldcomm::recv(p);
|
let x: int = ::core::oldcomm::recv(p);
|
||||||
|
|
||||||
log(debug, x);
|
log(debug, x);
|
||||||
|
|
||||||
|
|
|
@ -10,18 +10,18 @@
|
||||||
|
|
||||||
enum msg { closed, received(~[u8]), }
|
enum msg { closed, received(~[u8]), }
|
||||||
|
|
||||||
fn producer(c: core::oldcomm::Chan<~[u8]>) {
|
fn producer(c: ::core::oldcomm::Chan<~[u8]>) {
|
||||||
core::oldcomm::send(c, ~[1u8, 2u8, 3u8, 4u8]);
|
::core::oldcomm::send(c, ~[1u8, 2u8, 3u8, 4u8]);
|
||||||
let empty: ~[u8] = ~[];
|
let empty: ~[u8] = ~[];
|
||||||
core::oldcomm::send(c, empty);
|
::core::oldcomm::send(c, empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn packager(cb: core::oldcomm::Chan<core::oldcomm::Chan<~[u8]>>, msg: core::oldcomm::Chan<msg>) {
|
fn packager(cb: ::core::oldcomm::Chan<::core::oldcomm::Chan<~[u8]>>, msg: ::core::oldcomm::Chan<msg>) {
|
||||||
let p: core::oldcomm::Port<~[u8]> = core::oldcomm::Port();
|
let p: ::core::oldcomm::Port<~[u8]> = ::core::oldcomm::Port();
|
||||||
core::oldcomm::send(cb, core::oldcomm::Chan(&p));
|
::core::oldcomm::send(cb, ::core::oldcomm::Chan(&p));
|
||||||
loop {
|
loop {
|
||||||
debug!("waiting for bytes");
|
debug!("waiting for bytes");
|
||||||
let data = core::oldcomm::recv(p);
|
let data = ::core::oldcomm::recv(p);
|
||||||
debug!("got bytes");
|
debug!("got bytes");
|
||||||
if vec::len(data) == 0u {
|
if vec::len(data) == 0u {
|
||||||
debug!("got empty bytes, quitting");
|
debug!("got empty bytes, quitting");
|
||||||
|
@ -29,26 +29,26 @@ fn packager(cb: core::oldcomm::Chan<core::oldcomm::Chan<~[u8]>>, msg: core::oldc
|
||||||
}
|
}
|
||||||
debug!("sending non-empty buffer of length");
|
debug!("sending non-empty buffer of length");
|
||||||
log(debug, vec::len(data));
|
log(debug, vec::len(data));
|
||||||
core::oldcomm::send(msg, received(data));
|
::core::oldcomm::send(msg, received(data));
|
||||||
debug!("sent non-empty buffer");
|
debug!("sent non-empty buffer");
|
||||||
}
|
}
|
||||||
debug!("sending closed message");
|
debug!("sending closed message");
|
||||||
core::oldcomm::send(msg, closed);
|
::core::oldcomm::send(msg, closed);
|
||||||
debug!("sent closed message");
|
debug!("sent closed message");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let p: core::oldcomm::Port<msg> = core::oldcomm::Port();
|
let p: ::core::oldcomm::Port<msg> = ::core::oldcomm::Port();
|
||||||
let ch = core::oldcomm::Chan(&p);
|
let ch = ::core::oldcomm::Chan(&p);
|
||||||
let recv_reader: core::oldcomm::Port<core::oldcomm::Chan<~[u8]>> = core::oldcomm::Port();
|
let recv_reader: ::core::oldcomm::Port<::core::oldcomm::Chan<~[u8]>> = ::core::oldcomm::Port();
|
||||||
let recv_reader_chan = core::oldcomm::Chan(&recv_reader);
|
let recv_reader_chan = ::core::oldcomm::Chan(&recv_reader);
|
||||||
let pack = task::spawn(|| packager(recv_reader_chan, ch) );
|
let pack = task::spawn(|| packager(recv_reader_chan, ch) );
|
||||||
|
|
||||||
let source_chan: core::oldcomm::Chan<~[u8]> = core::oldcomm::recv(recv_reader);
|
let source_chan: ::core::oldcomm::Chan<~[u8]> = ::core::oldcomm::recv(recv_reader);
|
||||||
let prod = task::spawn(|| producer(source_chan) );
|
let prod = task::spawn(|| producer(source_chan) );
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let msg = core::oldcomm::recv(p);
|
let msg = ::core::oldcomm::recv(p);
|
||||||
match msg {
|
match msg {
|
||||||
closed => { debug!("Got close message"); break; }
|
closed => { debug!("Got close message"); break; }
|
||||||
received(data) => {
|
received(data) => {
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
|
|
||||||
fn a() {
|
fn a() {
|
||||||
fn doit() {
|
fn doit() {
|
||||||
fn b(c: core::oldcomm::Chan<core::oldcomm::Chan<int>>) {
|
fn b(c: ::core::oldcomm::Chan<::core::oldcomm::Chan<int>>) {
|
||||||
let p = core::oldcomm::Port();
|
let p = ::core::oldcomm::Port();
|
||||||
core::oldcomm::send(c, core::oldcomm::Chan(&p));
|
::core::oldcomm::send(c, ::core::oldcomm::Chan(&p));
|
||||||
}
|
}
|
||||||
let p = core::oldcomm::Port();
|
let p = ::core::oldcomm::Port();
|
||||||
let ch = core::oldcomm::Chan(&p);
|
let ch = ::core::oldcomm::Chan(&p);
|
||||||
task::spawn(|| b(ch) );
|
task::spawn(|| b(ch) );
|
||||||
core::oldcomm::recv(p);
|
::core::oldcomm::recv(p);
|
||||||
}
|
}
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while i < 100 {
|
while i < 100 {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
fn producer(c: core::oldcomm::Chan<~[u8]>) {
|
fn producer(c: ::core::oldcomm::Chan<~[u8]>) {
|
||||||
core::oldcomm::send(c,
|
::core::oldcomm::send(c,
|
||||||
~[1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8, 8u8, 9u8, 10u8, 11u8, 12u8,
|
~[1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8, 8u8, 9u8, 10u8, 11u8, 12u8,
|
||||||
13u8]);
|
13u8]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let p: core::oldcomm::Port<~[u8]> = core::oldcomm::Port();
|
let p: ::core::oldcomm::Port<~[u8]> = ::core::oldcomm::Port();
|
||||||
let ch = core::oldcomm::Chan(&p);
|
let ch = ::core::oldcomm::Chan(&p);
|
||||||
let prod = task::spawn(|| producer(ch) );
|
let prod = task::spawn(|| producer(ch) );
|
||||||
|
|
||||||
let data: ~[u8] = core::oldcomm::recv(p);
|
let data: ~[u8] = ::core::oldcomm::recv(p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,21 +10,21 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let p = core::oldcomm::Port();
|
let p = ::core::oldcomm::Port();
|
||||||
let ch = core::oldcomm::Chan(&p);
|
let ch = ::core::oldcomm::Chan(&p);
|
||||||
let mut y: int;
|
let mut y: int;
|
||||||
|
|
||||||
task::spawn(|| child(ch) );
|
task::spawn(|| child(ch) );
|
||||||
y = core::oldcomm::recv(p);
|
y = ::core::oldcomm::recv(p);
|
||||||
debug!("received 1");
|
debug!("received 1");
|
||||||
log(debug, y);
|
log(debug, y);
|
||||||
assert (y == 10);
|
assert (y == 10);
|
||||||
|
|
||||||
task::spawn(|| child(ch) );
|
task::spawn(|| child(ch) );
|
||||||
y = core::oldcomm::recv(p);
|
y = ::core::oldcomm::recv(p);
|
||||||
debug!("received 2");
|
debug!("received 2");
|
||||||
log(debug, y);
|
log(debug, y);
|
||||||
assert (y == 10);
|
assert (y == 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn child(c: core::oldcomm::Chan<int>) { core::oldcomm::send(c, 10); }
|
fn child(c: ::core::oldcomm::Chan<int>) { ::core::oldcomm::send(c, 10); }
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
mod m {
|
mod m {
|
||||||
#[legacy_exports];
|
#[legacy_exports];
|
||||||
use core::vec;
|
use ::core::vec;
|
||||||
fn f() -> ~[int] { vec::from_elem(1u, 0) }
|
fn f() -> ~[int] { vec::from_elem(1u, 0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
// This was generated initially by the pipe compiler, but it's been
|
// This was generated initially by the pipe compiler, but it's been
|
||||||
// modified in hopefully straightforward ways.
|
// modified in hopefully straightforward ways.
|
||||||
mod pingpong {
|
mod pingpong {
|
||||||
use core::pipes::*;
|
use ::core::pipes::*;
|
||||||
use core::ptr;
|
use ::core::ptr;
|
||||||
|
|
||||||
pub type packets = {
|
pub type packets = {
|
||||||
ping: Packet<ping>,
|
ping: Packet<ping>,
|
||||||
|
@ -43,7 +43,7 @@ mod pingpong {
|
||||||
pub enum ping = server::pong;
|
pub enum ping = server::pong;
|
||||||
pub enum pong = client::ping;
|
pub enum pong = client::ping;
|
||||||
pub mod client {
|
pub mod client {
|
||||||
use core::ptr;
|
use ::core::ptr;
|
||||||
|
|
||||||
pub fn ping(+pipe: ping) -> pong {
|
pub fn ping(+pipe: ping) -> pong {
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ mod pingpong {
|
||||||
::pingpong::packets>;
|
::pingpong::packets>;
|
||||||
}
|
}
|
||||||
pub mod server {
|
pub mod server {
|
||||||
use core::ptr;
|
use ::core::ptr;
|
||||||
|
|
||||||
pub type ping = pipes::RecvPacketBuffered<::pingpong::ping,
|
pub type ping = pipes::RecvPacketBuffered<::pingpong::ping,
|
||||||
::pingpong::packets>;
|
::pingpong::packets>;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
// An example to make sure the protocol parsing syntax extension works.
|
// An example to make sure the protocol parsing syntax extension works.
|
||||||
|
|
||||||
use core::option;
|
use ::core::option;
|
||||||
|
|
||||||
proto! pingpong (
|
proto! pingpong (
|
||||||
ping:send {
|
ping:send {
|
||||||
|
@ -25,7 +25,7 @@ proto! pingpong (
|
||||||
)
|
)
|
||||||
|
|
||||||
mod test {
|
mod test {
|
||||||
use core::pipes::recv;
|
use ::core::pipes::recv;
|
||||||
use pingpong::{ping, pong};
|
use pingpong::{ping, pong};
|
||||||
|
|
||||||
pub fn client(-chan: ::pingpong::client::ping) {
|
pub fn client(-chan: ::pingpong::client::ping) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// Regression tests for circular_buffer when using a unit
|
// Regression tests for circular_buffer when using a unit
|
||||||
// that has a size that is not a power of two
|
// that has a size that is not a power of two
|
||||||
|
|
||||||
// A 12-byte unit to core::oldcomm::send over the channel
|
// A 12-byte unit to ::core::oldcomm::send over the channel
|
||||||
type record = {val1: u32, val2: u32, val3: u32};
|
type record = {val1: u32, val2: u32, val3: u32};
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,52 +22,52 @@ type record = {val1: u32, val2: u32, val3: u32};
|
||||||
// power of two so needs to be rounded up. Don't trigger any
|
// power of two so needs to be rounded up. Don't trigger any
|
||||||
// assertions.
|
// assertions.
|
||||||
fn test_init() {
|
fn test_init() {
|
||||||
let myport = core::oldcomm::Port();
|
let myport = ::core::oldcomm::Port();
|
||||||
let mychan = core::oldcomm::Chan(&myport);
|
let mychan = ::core::oldcomm::Chan(&myport);
|
||||||
let val: record = {val1: 0u32, val2: 0u32, val3: 0u32};
|
let val: record = {val1: 0u32, val2: 0u32, val3: 0u32};
|
||||||
core::oldcomm::send(mychan, val);
|
::core::oldcomm::send(mychan, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Dump lots of items into the channel so it has to grow.
|
// Dump lots of items into the channel so it has to grow.
|
||||||
// Don't trigger any assertions.
|
// Don't trigger any assertions.
|
||||||
fn test_grow() {
|
fn test_grow() {
|
||||||
let myport = core::oldcomm::Port();
|
let myport = ::core::oldcomm::Port();
|
||||||
let mychan = core::oldcomm::Chan(&myport);
|
let mychan = ::core::oldcomm::Chan(&myport);
|
||||||
for uint::range(0u, 100u) |i| {
|
for uint::range(0u, 100u) |i| {
|
||||||
let val: record = {val1: 0u32, val2: 0u32, val3: 0u32};
|
let val: record = {val1: 0u32, val2: 0u32, val3: 0u32};
|
||||||
core::oldcomm::send(mychan, val);
|
::core::oldcomm::send(mychan, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Don't allow the buffer to shrink below it's original size
|
// Don't allow the buffer to shrink below it's original size
|
||||||
fn test_shrink1() {
|
fn test_shrink1() {
|
||||||
let myport = core::oldcomm::Port();
|
let myport = ::core::oldcomm::Port();
|
||||||
let mychan = core::oldcomm::Chan(&myport);
|
let mychan = ::core::oldcomm::Chan(&myport);
|
||||||
core::oldcomm::send(mychan, 0i8);
|
::core::oldcomm::send(mychan, 0i8);
|
||||||
let x = core::oldcomm::recv(myport);
|
let x = ::core::oldcomm::recv(myport);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_shrink2() {
|
fn test_shrink2() {
|
||||||
let myport = core::oldcomm::Port();
|
let myport = ::core::oldcomm::Port();
|
||||||
let mychan = core::oldcomm::Chan(&myport);
|
let mychan = ::core::oldcomm::Chan(&myport);
|
||||||
for uint::range(0u, 100u) |_i| {
|
for uint::range(0u, 100u) |_i| {
|
||||||
let val: record = {val1: 0u32, val2: 0u32, val3: 0u32};
|
let val: record = {val1: 0u32, val2: 0u32, val3: 0u32};
|
||||||
core::oldcomm::send(mychan, val);
|
::core::oldcomm::send(mychan, val);
|
||||||
}
|
}
|
||||||
for uint::range(0u, 100u) |_i| { let x = core::oldcomm::recv(myport); }
|
for uint::range(0u, 100u) |_i| { let x = ::core::oldcomm::recv(myport); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Test rotating the buffer when the unit size is not a power of two
|
// Test rotating the buffer when the unit size is not a power of two
|
||||||
fn test_rotate() {
|
fn test_rotate() {
|
||||||
let myport = core::oldcomm::Port();
|
let myport = ::core::oldcomm::Port();
|
||||||
let mychan = core::oldcomm::Chan(&myport);
|
let mychan = ::core::oldcomm::Chan(&myport);
|
||||||
for uint::range(0u, 100u) |i| {
|
for uint::range(0u, 100u) |i| {
|
||||||
let val = {val1: i as u32, val2: i as u32, val3: i as u32};
|
let val = {val1: i as u32, val2: i as u32, val3: i as u32};
|
||||||
core::oldcomm::send(mychan, val);
|
::core::oldcomm::send(mychan, val);
|
||||||
let x = core::oldcomm::recv(myport);
|
let x = ::core::oldcomm::recv(myport);
|
||||||
assert (x.val1 == i as u32);
|
assert (x.val1 == i as u32);
|
||||||
assert (x.val2 == i as u32);
|
assert (x.val2 == i as u32);
|
||||||
assert (x.val3 == i as u32);
|
assert (x.val3 == i as u32);
|
||||||
|
@ -78,16 +78,16 @@ fn test_rotate() {
|
||||||
// Test rotating and growing the buffer when
|
// Test rotating and growing the buffer when
|
||||||
// the unit size is not a power of two
|
// the unit size is not a power of two
|
||||||
fn test_rotate_grow() {
|
fn test_rotate_grow() {
|
||||||
let myport = core::oldcomm::Port::<record>();
|
let myport = ::core::oldcomm::Port::<record>();
|
||||||
let mychan = core::oldcomm::Chan(&myport);
|
let mychan = ::core::oldcomm::Chan(&myport);
|
||||||
for uint::range(0u, 10u) |j| {
|
for uint::range(0u, 10u) |j| {
|
||||||
for uint::range(0u, 10u) |i| {
|
for uint::range(0u, 10u) |i| {
|
||||||
let val: record =
|
let val: record =
|
||||||
{val1: i as u32, val2: i as u32, val3: i as u32};
|
{val1: i as u32, val2: i as u32, val3: i as u32};
|
||||||
core::oldcomm::send(mychan, val);
|
::core::oldcomm::send(mychan, val);
|
||||||
}
|
}
|
||||||
for uint::range(0u, 10u) |i| {
|
for uint::range(0u, 10u) |i| {
|
||||||
let x = core::oldcomm::recv(myport);
|
let x = ::core::oldcomm::recv(myport);
|
||||||
assert (x.val1 == i as u32);
|
assert (x.val1 == i as u32);
|
||||||
assert (x.val2 == i as u32);
|
assert (x.val2 == i as u32);
|
||||||
assert (x.val3 == i as u32);
|
assert (x.val3 == i as u32);
|
||||||
|
|
|
@ -23,12 +23,12 @@ fn test(f: int) -> test {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let p = core::oldcomm::Port();
|
let p = ::core::oldcomm::Port();
|
||||||
let c = core::oldcomm::Chan(&p);
|
let c = ::core::oldcomm::Chan(&p);
|
||||||
|
|
||||||
do task::spawn() {
|
do task::spawn() {
|
||||||
let p = core::oldcomm::Port();
|
let p = ::core::oldcomm::Port();
|
||||||
c.send(core::oldcomm::Chan(&p));
|
c.send(::core::oldcomm::Chan(&p));
|
||||||
|
|
||||||
let _r = p.recv();
|
let _r = p.recv();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
extern mod mycore(name ="static_fn_inline_xc_aux");
|
extern mod mycore(name ="static_fn_inline_xc_aux");
|
||||||
|
|
||||||
use mycore::num;
|
use my::core::num;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _1:float = num::Num2::from_int2(1i);
|
let _1:float = num::Num2::from_int2(1i);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
extern mod mycore(name ="static_fn_trait_xc_aux");
|
extern mod mycore(name ="static_fn_trait_xc_aux");
|
||||||
|
|
||||||
use mycore::num;
|
use my::core::num;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let _1:float = num::Num2::from_int2(1i);
|
let _1:float = num::Num2::from_int2(1i);
|
||||||
|
|
|
@ -17,12 +17,12 @@ fn main() {
|
||||||
test06();
|
test06();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test00_start(ch: core::oldcomm::Chan<int>, message: int, count: int) {
|
fn test00_start(ch: ::core::oldcomm::Chan<int>, message: int, count: int) {
|
||||||
debug!("Starting test00_start");
|
debug!("Starting test00_start");
|
||||||
let mut i: int = 0;
|
let mut i: int = 0;
|
||||||
while i < count {
|
while i < count {
|
||||||
debug!("Sending Message");
|
debug!("Sending Message");
|
||||||
core::oldcomm::send(ch, message + 0);
|
::core::oldcomm::send(ch, message + 0);
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
debug!("Ending test00_start");
|
debug!("Ending test00_start");
|
||||||
|
@ -33,8 +33,8 @@ fn test00() {
|
||||||
let number_of_messages: int = 4;
|
let number_of_messages: int = 4;
|
||||||
debug!("Creating tasks");
|
debug!("Creating tasks");
|
||||||
|
|
||||||
let po = core::oldcomm::Port();
|
let po = ::core::oldcomm::Port();
|
||||||
let ch = core::oldcomm::Chan(&po);
|
let ch = ::core::oldcomm::Chan(&po);
|
||||||
|
|
||||||
let mut i: int = 0;
|
let mut i: int = 0;
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ fn test00() {
|
||||||
let mut sum: int = 0;
|
let mut sum: int = 0;
|
||||||
for results.each |r| {
|
for results.each |r| {
|
||||||
i = 0;
|
i = 0;
|
||||||
while i < number_of_messages { sum += core::oldcomm::recv(po); i = i + 1; }
|
while i < number_of_messages { sum += ::core::oldcomm::recv(po); i = i + 1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
for results.each |r| { r.recv(); }
|
for results.each |r| { r.recv(); }
|
||||||
|
@ -63,19 +63,19 @@ fn test00() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test01() {
|
fn test01() {
|
||||||
let p = core::oldcomm::Port();
|
let p = ::core::oldcomm::Port();
|
||||||
debug!("Reading from a port that is never written to.");
|
debug!("Reading from a port that is never written to.");
|
||||||
let value: int = core::oldcomm::recv(p);
|
let value: int = ::core::oldcomm::recv(p);
|
||||||
log(debug, value);
|
log(debug, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test02() {
|
fn test02() {
|
||||||
let p = core::oldcomm::Port();
|
let p = ::core::oldcomm::Port();
|
||||||
let c = core::oldcomm::Chan(&p);
|
let c = ::core::oldcomm::Chan(&p);
|
||||||
debug!("Writing to a local task channel.");
|
debug!("Writing to a local task channel.");
|
||||||
core::oldcomm::send(c, 42);
|
::core::oldcomm::send(c, 42);
|
||||||
debug!("Reading from a local task port.");
|
debug!("Reading from a local task port.");
|
||||||
let value: int = core::oldcomm::recv(p);
|
let value: int = ::core::oldcomm::recv(p);
|
||||||
log(debug, value);
|
log(debug, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,22 +93,22 @@ fn test04() {
|
||||||
debug!("Finishing up.");
|
debug!("Finishing up.");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test05_start(ch: core::oldcomm::Chan<int>) {
|
fn test05_start(ch: ::core::oldcomm::Chan<int>) {
|
||||||
core::oldcomm::send(ch, 10);
|
::core::oldcomm::send(ch, 10);
|
||||||
core::oldcomm::send(ch, 20);
|
::core::oldcomm::send(ch, 20);
|
||||||
core::oldcomm::send(ch, 30);
|
::core::oldcomm::send(ch, 30);
|
||||||
core::oldcomm::send(ch, 30);
|
::core::oldcomm::send(ch, 30);
|
||||||
core::oldcomm::send(ch, 30);
|
::core::oldcomm::send(ch, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test05() {
|
fn test05() {
|
||||||
let po = core::oldcomm::Port();
|
let po = ::core::oldcomm::Port();
|
||||||
let ch = core::oldcomm::Chan(&po);
|
let ch = ::core::oldcomm::Chan(&po);
|
||||||
task::spawn(|| test05_start(ch) );
|
task::spawn(|| test05_start(ch) );
|
||||||
let mut value: int;
|
let mut value: int;
|
||||||
value = core::oldcomm::recv(po);
|
value = ::core::oldcomm::recv(po);
|
||||||
value = core::oldcomm::recv(po);
|
value = ::core::oldcomm::recv(po);
|
||||||
value = core::oldcomm::recv(po);
|
value = ::core::oldcomm::recv(po);
|
||||||
log(debug, value);
|
log(debug, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// xfail-fast
|
||||||
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
extern mod core;
|
extern mod core;
|
||||||
|
|
||||||
use core::{str, int, vec};
|
use ::core::{str, int, vec};
|
||||||
|
|
||||||
trait to_str {
|
trait to_str {
|
||||||
fn to_str() -> ~str;
|
fn to_str() -> ~str;
|
||||||
|
|
|
@ -16,12 +16,12 @@ extern mod zed(name = "core");
|
||||||
extern mod bar(name = "core", vers = "0.6");
|
extern mod bar(name = "core", vers = "0.6");
|
||||||
|
|
||||||
|
|
||||||
use core::str;
|
use ::core::str;
|
||||||
use x = zed::str;
|
use x = zed::str;
|
||||||
mod baz {
|
mod baz {
|
||||||
#[legacy_exports];
|
#[legacy_exports];
|
||||||
use bar::str;
|
use bar::str;
|
||||||
use x = core::str;
|
use x = ::core::str;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = @[1, 2, 3];
|
let x = @[1, 2, 3];
|
||||||
match x {
|
match x {
|
||||||
[2, .._] => core::util::unreachable(),
|
[2, .._] => ::core::util::unreachable(),
|
||||||
[1, ..tail] => {
|
[1, ..tail] => {
|
||||||
assert tail == [2, 3];
|
assert tail == [2, 3];
|
||||||
}
|
}
|
||||||
[_] => core::util::unreachable(),
|
[_] => ::core::util::unreachable(),
|
||||||
[] => core::util::unreachable()
|
[] => ::core::util::unreachable()
|
||||||
}
|
}
|
||||||
|
|
||||||
let y = (~[(1, true), (2, false)], 0.5);
|
let y = (~[(1, true), (2, false)], 0.5);
|
||||||
match y {
|
match y {
|
||||||
([_, _, _], 0.5) => core::util::unreachable(),
|
([_, _, _], 0.5) => ::core::util::unreachable(),
|
||||||
([(1, a), (b, false), ..tail], _) => {
|
([(1, a), (b, false), ..tail], _) => {
|
||||||
assert a == true;
|
assert a == true;
|
||||||
assert b == 2;
|
assert b == 2;
|
||||||
assert tail.is_empty();
|
assert tail.is_empty();
|
||||||
}
|
}
|
||||||
([..tail], _) => core::util::unreachable()
|
([..tail], _) => ::core::util::unreachable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ fn main() {
|
||||||
if !x.is_empty() {
|
if !x.is_empty() {
|
||||||
let el = match x {
|
let el = match x {
|
||||||
[1, ..ref tail] => &tail[0],
|
[1, ..ref tail] => &tail[0],
|
||||||
_ => core::util::unreachable()
|
_ => ::core::util::unreachable()
|
||||||
};
|
};
|
||||||
io::println(fmt!("%d", *el));
|
io::println(fmt!("%d", *el));
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ fn main() {
|
||||||
let x = [1, 2, 3, 4, 5];
|
let x = [1, 2, 3, 4, 5];
|
||||||
match x {
|
match x {
|
||||||
[a, b, c, d, e, f] => {
|
[a, b, c, d, e, f] => {
|
||||||
core::util::unreachable();
|
::core::util::unreachable();
|
||||||
}
|
}
|
||||||
[a, b, c, d, e] => {
|
[a, b, c, d, e] => {
|
||||||
assert a == 1;
|
assert a == 1;
|
||||||
|
@ -24,7 +24,7 @@ fn main() {
|
||||||
assert e == 5;
|
assert e == 5;
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
core::util::unreachable();
|
::core::util::unreachable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,19 +17,19 @@ fn main() {
|
||||||
|
|
||||||
match tail {
|
match tail {
|
||||||
[Foo { _ }, _, Foo { _ }, ..tail] => {
|
[Foo { _ }, _, Foo { _ }, ..tail] => {
|
||||||
core::util::unreachable();
|
::core::util::unreachable();
|
||||||
}
|
}
|
||||||
[Foo { string: a }, Foo { string: b }] => {
|
[Foo { string: a }, Foo { string: b }] => {
|
||||||
assert a == ~"bar";
|
assert a == ~"bar";
|
||||||
assert b == ~"baz";
|
assert b == ~"baz";
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
core::util::unreachable();
|
::core::util::unreachable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
core::util::unreachable();
|
::core::util::unreachable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue