auto merge of #5092 : brson/rust/legacy, r=brson
This commit is contained in:
commit
1a132b3721
@ -9,11 +9,10 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
struct X { mut x: int }
|
||||
|
||||
fn f1(a: X, b: &mut int, -c: int) -> int {
|
||||
fn f1(a: &mut X, b: &mut int, -c: int) -> int {
|
||||
let r = a.x + *b + c;
|
||||
a.x = 0;
|
||||
*b = 10;
|
||||
@ -24,7 +23,7 @@ fn f2(a: int, f: fn(int)) -> int { f(1); return a; }
|
||||
|
||||
pub fn main() {
|
||||
let mut a = X {mut x: 1}, b = 2, c = 3;
|
||||
assert (f1(a, &mut b, c) == 6);
|
||||
assert (f1(&mut a, &mut b, c) == 6);
|
||||
assert (a.x == 0);
|
||||
assert (b == 10);
|
||||
assert (f2(a.x, |x| a.x = 50 ) == 0);
|
||||
|
@ -9,16 +9,15 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
fn iter_vec<T>(v: ~[T], f: fn(T)) { for v.each |x| { f(*x); } }
|
||||
fn iter_vec<T>(v: ~[T], f: fn(&T)) { for v.each |x| { f(x); } }
|
||||
|
||||
pub fn main() {
|
||||
let v = ~[1, 2, 3, 4, 5, 6, 7];
|
||||
let mut odds = 0;
|
||||
iter_vec(v, |i| {
|
||||
log(error, i);
|
||||
if i % 2 == 1 {
|
||||
if *i % 2 == 1 {
|
||||
odds += 1;
|
||||
}
|
||||
log(error, odds);
|
||||
|
@ -9,17 +9,16 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
fn iter_vec<T>(v: ~[T], f: fn(T)) { for v.each |x| { f(*x); } }
|
||||
fn iter_vec<T>(v: ~[T], f: fn(&T)) { for v.each |x| { f(x); } }
|
||||
|
||||
pub fn main() {
|
||||
let v = ~[1, 2, 3, 4, 5];
|
||||
let mut sum = 0;
|
||||
iter_vec(copy v, |i| {
|
||||
iter_vec(copy v, |j| {
|
||||
log(error, i * j);
|
||||
sum += i * j;
|
||||
log(error, *i * *j);
|
||||
sum += *i * *j;
|
||||
});
|
||||
});
|
||||
log(error, sum);
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
fn foo(i: int) -> int { i + 1 }
|
||||
|
||||
|
@ -11,8 +11,6 @@
|
||||
// xfail-fast
|
||||
// -*- rust -*-
|
||||
|
||||
#[legacy_modes];
|
||||
|
||||
type compare<T> = fn@(T, T) -> bool;
|
||||
|
||||
fn test_generic<T:Copy>(expected: T, eq: compare<T>) {
|
||||
@ -21,7 +19,7 @@ fn test_generic<T:Copy>(expected: T, eq: compare<T>) {
|
||||
}
|
||||
|
||||
fn test_vec() {
|
||||
fn compare_box(&&v1: @int, &&v2: @int) -> bool { return v1 == v2; }
|
||||
fn compare_box(v1: @int, v2: @int) -> bool { return v1 == v2; }
|
||||
test_generic::<@int>(@1, compare_box);
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,6 @@
|
||||
// xfail-fast
|
||||
// -*- rust -*-
|
||||
|
||||
#[legacy_modes];
|
||||
|
||||
type compare<T> = fn@(T, T) -> bool;
|
||||
|
||||
fn test_generic<T:Copy>(expected: T, eq: compare<T>) {
|
||||
@ -24,7 +22,7 @@ fn test_generic<T:Copy>(expected: T, eq: compare<T>) {
|
||||
}
|
||||
|
||||
fn test_vec() {
|
||||
fn compare_box(&&v1: ~int, &&v2: ~int) -> bool { return v1 == v2; }
|
||||
fn compare_box(v1: ~int, v2: ~int) -> bool { return v1 == v2; }
|
||||
test_generic::<~int>(~1, compare_box);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
// xfail-fast
|
||||
// -*- rust -*-
|
||||
#[legacy_modes];
|
||||
|
||||
type compare<T> = fn@(T, T) -> bool;
|
||||
|
||||
@ -20,7 +19,7 @@ fn test_generic<T:Copy>(expected: T, eq: compare<T>) {
|
||||
}
|
||||
|
||||
fn test_bool() {
|
||||
fn compare_bool(&&b1: bool, &&b2: bool) -> bool { return b1 == b2; }
|
||||
fn compare_bool(b1: bool, b2: bool) -> bool { return b1 == b2; }
|
||||
test_generic::<bool>(true, compare_bool);
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
// Tests for standalone blocks as expressions with dynamic type sizes
|
||||
type compare<T> = fn@(T, T) -> bool;
|
||||
@ -22,7 +21,7 @@ fn test_generic<T:Copy>(expected: T, eq: compare<T>) {
|
||||
}
|
||||
|
||||
fn test_bool() {
|
||||
fn compare_bool(&&b1: bool, &&b2: bool) -> bool { return b1 == b2; }
|
||||
fn compare_bool(b1: bool, b2: bool) -> bool { return b1 == b2; }
|
||||
test_generic::<bool>(true, compare_bool);
|
||||
}
|
||||
|
||||
|
@ -9,9 +9,8 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
fn f(arg: A) {
|
||||
fn f(arg: &A) {
|
||||
arg.a = 100;
|
||||
}
|
||||
|
||||
@ -19,9 +18,9 @@ struct A { mut a: int }
|
||||
|
||||
pub fn main() {
|
||||
let x = A {a: 10};
|
||||
f(x);
|
||||
f(&x);
|
||||
assert x.a == 100;
|
||||
x.a = 20;
|
||||
f(copy x);
|
||||
f(© x);
|
||||
assert x.a == 20;
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
// xfail-fast
|
||||
// -*- rust -*-
|
||||
#[legacy_modes];
|
||||
|
||||
// Tests for if as expressions with dynamic type sizes
|
||||
type compare<T> = fn@(T, T) -> bool;
|
||||
@ -21,7 +20,7 @@ fn test_generic<T:Copy>(expected: T, not_expected: T, eq: compare<T>) {
|
||||
}
|
||||
|
||||
fn test_bool() {
|
||||
fn compare_bool(&&b1: bool, &&b2: bool) -> bool { return b1 == b2; }
|
||||
fn compare_bool(b1: bool, b2: bool) -> bool { return b1 == b2; }
|
||||
test_generic::<bool>(true, false, compare_bool);
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
fn fix_help<A, B>(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B {
|
||||
return f( |a| fix_help(f, a), x);
|
||||
@ -19,7 +18,7 @@ fn fix<A, B>(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B {
|
||||
return |a| fix_help(f, a);
|
||||
}
|
||||
|
||||
fn fact_(f: fn@(&&v: int) -> int, &&n: int) -> int {
|
||||
fn fact_(f: fn@(v: int) -> int, n: int) -> int {
|
||||
// fun fact 0 = 1
|
||||
return if n == 0 { 1 } else { n * f(n - 1) };
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
fn fix_help<A:&static,B:Owned>(f: extern fn(fn@(A) -> B, A) -> B, x: A) -> B {
|
||||
return f(|a| fix_help(f, a), x);
|
||||
@ -19,7 +18,7 @@ fn fix<A:&static,B:Owned>(f: extern fn(fn@(A) -> B, A) -> B) -> fn@(A) -> B {
|
||||
return |a| fix_help(f, a);
|
||||
}
|
||||
|
||||
fn fact_(f: fn@(&&v: int) -> int, &&n: int) -> int {
|
||||
fn fact_(f: fn@(v: int) -> int, n: int) -> int {
|
||||
// fun fact 0 = 1
|
||||
return if n == 0 { 1 } else { n * f(n - 1) };
|
||||
}
|
||||
|
@ -9,11 +9,10 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
fn mk() -> int { return 1; }
|
||||
|
||||
fn chk(&&a: int) { log(debug, a); assert (a == 1); }
|
||||
fn chk(a: int) { log(debug, a); assert (a == 1); }
|
||||
|
||||
fn apply<T>(produce: extern fn() -> T,
|
||||
consume: extern fn(T)) {
|
||||
@ -22,6 +21,6 @@ fn apply<T>(produce: extern fn() -> T,
|
||||
|
||||
pub fn main() {
|
||||
let produce: extern fn() -> int = mk;
|
||||
let consume: extern fn(&&v: int) = chk;
|
||||
let consume: extern fn(v: int) = chk;
|
||||
apply::<int>(produce, consume);
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
// However, the condition it was testing seemed complex enough to
|
||||
// warrant still having a test, so I inlined the old definitions.
|
||||
|
||||
#[legacy_modes];
|
||||
|
||||
trait iterable<A> {
|
||||
fn iter(blk: fn(A));
|
||||
}
|
||||
@ -34,7 +32,7 @@ fn filter<A,IA:iterable<A>>(self: IA, prd: fn@(A) -> bool, blk: fn(A)) {
|
||||
}
|
||||
}
|
||||
|
||||
fn foldl<A,B,IA:iterable<A>>(self: IA, +b0: B, blk: fn(B, A) -> B) -> B {
|
||||
fn foldl<A,B,IA:iterable<A>>(self: IA, b0: B, blk: fn(B, A) -> B) -> B {
|
||||
let mut b = b0;
|
||||
do self.iter |a| {
|
||||
b = blk(b, a);
|
||||
@ -52,7 +50,7 @@ fn range(lo: uint, hi: uint, it: fn(uint)) {
|
||||
|
||||
pub fn main() {
|
||||
let range: fn@(fn&(uint)) = |a| range(0u, 1000u, a);
|
||||
let filt: fn@(fn&(&&v: uint)) = |a| filter(
|
||||
let filt: fn@(fn&(v: uint)) = |a| filter(
|
||||
range,
|
||||
|&&n: uint| n % 3u != 0u && n % 5u != 0u,
|
||||
a);
|
||||
|
@ -9,42 +9,41 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
trait vec_monad<A> {
|
||||
fn bind<B:Copy>(f: fn(A) -> ~[B]) -> ~[B];
|
||||
fn bind<B:Copy>(f: fn(&A) -> ~[B]) -> ~[B];
|
||||
}
|
||||
|
||||
impl<A> vec_monad<A> for ~[A] {
|
||||
fn bind<B:Copy>(f: fn(A) -> ~[B]) -> ~[B] {
|
||||
fn bind<B:Copy>(f: fn(&A) -> ~[B]) -> ~[B] {
|
||||
let mut r = ~[];
|
||||
for self.each |elt| { r += f(*elt); }
|
||||
for self.each |elt| { r += f(elt); }
|
||||
r
|
||||
}
|
||||
}
|
||||
|
||||
trait option_monad<A> {
|
||||
fn bind<B>(f: fn(A) -> Option<B>) -> Option<B>;
|
||||
fn bind<B>(f: fn(&A) -> Option<B>) -> Option<B>;
|
||||
}
|
||||
|
||||
impl<A> option_monad<A> for Option<A> {
|
||||
fn bind<B>(f: fn(A) -> Option<B>) -> Option<B> {
|
||||
fn bind<B>(f: fn(&A) -> Option<B>) -> Option<B> {
|
||||
match self {
|
||||
Some(ref a) => { f(*a) }
|
||||
Some(ref a) => { f(a) }
|
||||
None => { None }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn transform(x: Option<int>) -> Option<~str> {
|
||||
x.bind(|n| Some(n + 1) ).bind(|n| Some(int::str(n)) )
|
||||
x.bind(|n| Some(*n + 1) ).bind(|n| Some(int::str(*n)) )
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
assert transform(Some(10)) == Some(~"11");
|
||||
assert transform(None) == None;
|
||||
assert (~[~"hi"])
|
||||
.bind(|x| ~[copy x, x + ~"!"] )
|
||||
.bind(|x| ~[copy x, x + ~"?"] ) ==
|
||||
.bind(|x| ~[copy *x, *x + ~"!"] )
|
||||
.bind(|x| ~[copy *x, *x + ~"?"] ) ==
|
||||
~[~"hi", ~"hi?", ~"hi!", ~"hi!?"];
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
struct Point {
|
||||
x: int,
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
use core::bool;
|
||||
use intrinsic::{TyDesc, get_tydesc, visit_tydesc, TyVisitor};
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
fn region_identity(x: &r/uint) -> &r/uint { x }
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
struct Arg<T> {val: T, fin: extern fn(T)}
|
||||
|
||||
@ -31,7 +30,7 @@ fn finish<T:Copy>(arg: Arg<T>) -> finish<T> {
|
||||
|
||||
pub fn main() {
|
||||
let box = @mut 10;
|
||||
fn dec_box(&&i: @mut int) { *i -= 1; }
|
||||
fn dec_box(i: @mut int) { *i -= 1; }
|
||||
|
||||
{ let _i = finish(Arg{val: box, fin: dec_box}); }
|
||||
assert (*box == 9);
|
||||
|
@ -9,14 +9,13 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
use cmp::Eq;
|
||||
|
||||
fn iter<T>(v: ~[T], it: fn(T) -> bool) {
|
||||
fn iter<T>(v: ~[T], it: fn(&T) -> bool) {
|
||||
let mut i = 0u, l = v.len();
|
||||
while i < l {
|
||||
if !it(v[i]) { break; }
|
||||
if !it(&v[i]) { break; }
|
||||
i += 1u;
|
||||
}
|
||||
}
|
||||
@ -24,7 +23,7 @@ fn iter<T>(v: ~[T], it: fn(T) -> bool) {
|
||||
fn find_pos<T:Eq + Copy>(n: T, h: ~[T]) -> Option<uint> {
|
||||
let mut i = 0u;
|
||||
for iter(copy h) |e| {
|
||||
if e == n { return Some(i); }
|
||||
if *e == n { return Some(i); }
|
||||
i += 1u;
|
||||
}
|
||||
None
|
||||
@ -33,9 +32,9 @@ fn find_pos<T:Eq + Copy>(n: T, h: ~[T]) -> Option<uint> {
|
||||
fn bail_deep(x: ~[~[bool]]) {
|
||||
let mut seen = false;
|
||||
for iter(copy x) |x| {
|
||||
for iter(copy x) |x| {
|
||||
for iter(copy *x) |x| {
|
||||
assert !seen;
|
||||
if x { seen = true; return; }
|
||||
if *x { seen = true; return; }
|
||||
}
|
||||
}
|
||||
assert !seen;
|
||||
@ -44,7 +43,7 @@ fn bail_deep(x: ~[~[bool]]) {
|
||||
fn ret_deep() -> ~str {
|
||||
for iter(~[1, 2]) |e| {
|
||||
for iter(~[3, 4]) |x| {
|
||||
if e + x > 4 { return ~"hi"; }
|
||||
if *e + *x > 4 { return ~"hi"; }
|
||||
}
|
||||
}
|
||||
return ~"bye";
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
pub fn main() { test05(); }
|
||||
|
||||
@ -19,23 +18,23 @@ fn make_generic_record<A:Copy,B:Copy>(a: A, b: B) -> Pair<A,B> {
|
||||
return Pair {a: a, b: b};
|
||||
}
|
||||
|
||||
fn test05_start(&&f: fn~(&&v: float, &&v: ~str) -> Pair<float, ~str>) {
|
||||
let p = f(22.22f, ~"Hi");
|
||||
fn test05_start(f: &~fn(v: float, v: ~str) -> Pair<float, ~str>) {
|
||||
let p = (*f)(22.22f, ~"Hi");
|
||||
log(debug, copy p);
|
||||
assert p.a == 22.22f;
|
||||
assert p.b == ~"Hi";
|
||||
|
||||
let q = f(44.44f, ~"Ho");
|
||||
let q = (*f)(44.44f, ~"Ho");
|
||||
log(debug, copy q);
|
||||
assert q.a == 44.44f;
|
||||
assert q.b == ~"Ho";
|
||||
}
|
||||
|
||||
fn spawn<A:Copy,B:Copy>(f: extern fn(fn~(A,B)->Pair<A,B>)) {
|
||||
fn spawn<A:Copy,B:Copy>(f: extern fn(&~fn(A,B)->Pair<A,B>)) {
|
||||
let arg = fn~(a: A, b: B) -> Pair<A,B> {
|
||||
return make_generic_record(a, b);
|
||||
};
|
||||
task::spawn(|| f(arg) );
|
||||
task::spawn(|| f(&arg) );
|
||||
}
|
||||
|
||||
fn test05() {
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
fn test(f: fn(uint) -> uint) -> uint {
|
||||
return f(22u);
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
pub trait plus {
|
||||
fn plus() -> int;
|
||||
@ -40,16 +39,16 @@ impl uint_utils for uint {
|
||||
|
||||
trait vec_utils<T> {
|
||||
fn length_() -> uint;
|
||||
fn iter_(f: fn(T));
|
||||
fn map_<U:Copy>(f: fn(T) -> U) -> ~[U];
|
||||
fn iter_(f: fn(&T));
|
||||
fn map_<U:Copy>(f: fn(&T) -> U) -> ~[U];
|
||||
}
|
||||
|
||||
impl<T> vec_utils<T> for ~[T] {
|
||||
fn length_() -> uint { vec::len(self) }
|
||||
fn iter_(f: fn(T)) { for self.each |x| { f(*x); } }
|
||||
fn map_<U:Copy>(f: fn(T) -> U) -> ~[U] {
|
||||
fn iter_(f: fn(&T)) { for self.each |x| { f(x); } }
|
||||
fn map_<U:Copy>(f: fn(&T) -> U) -> ~[U] {
|
||||
let mut r = ~[];
|
||||
for self.each |elt| { r += ~[f(*elt)]; }
|
||||
for self.each |elt| { r += ~[f(elt)]; }
|
||||
r
|
||||
}
|
||||
}
|
||||
@ -59,8 +58,8 @@ pub fn main() {
|
||||
assert (~"hi").plus() == 200;
|
||||
|
||||
assert (~[1]).length_().str() == ~"1";
|
||||
assert (~[3, 4]).map_(|a| a + 4 )[0] == 7;
|
||||
assert (~[3, 4]).map_::<uint>(|a| a as uint + 4u )[0] == 7u;
|
||||
assert (~[3, 4]).map_(|a| *a + 4 )[0] == 7;
|
||||
assert (~[3, 4]).map_::<uint>(|a| *a as uint + 4u )[0] == 7u;
|
||||
let mut x = 0u;
|
||||
10u.multi(|_n| x += 2u );
|
||||
assert x == 20u;
|
||||
|
@ -9,11 +9,10 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
extern mod std;
|
||||
|
||||
fn start(c: comm::Chan<comm::Chan<~str>>) {
|
||||
fn start(c: &comm::Chan<comm::Chan<~str>>) {
|
||||
let (p, ch) = comm::stream();
|
||||
c.send(ch);
|
||||
|
||||
@ -29,7 +28,7 @@ fn start(c: comm::Chan<comm::Chan<~str>>) {
|
||||
|
||||
pub fn main() {
|
||||
let (p, ch) = comm::stream();
|
||||
let child = task::spawn(|| start(ch) );
|
||||
let child = task::spawn(|| start(&ch) );
|
||||
|
||||
let c = p.recv();
|
||||
c.send(~"A");
|
||||
|
@ -9,17 +9,16 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
extern mod std;
|
||||
|
||||
fn start(c: comm::Chan<comm::Chan<int>>) {
|
||||
fn start(c: &comm::Chan<comm::Chan<int>>) {
|
||||
let (p, ch) = comm::stream();
|
||||
c.send(ch);
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let (p, ch) = comm::stream();
|
||||
let child = task::spawn(|| start(ch) );
|
||||
let child = task::spawn(|| start(&ch) );
|
||||
let c = p.recv();
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
pub fn main() {
|
||||
let po = comm::PortSet();
|
||||
@ -20,7 +19,7 @@ pub fn main() {
|
||||
log(debug, i);
|
||||
let (p, ch) = comm::stream();
|
||||
po.add(p);
|
||||
task::spawn({let i = i; || child(i, ch)});
|
||||
task::spawn({let i = i; || child(i, &ch)});
|
||||
i = i - 1;
|
||||
}
|
||||
|
||||
@ -37,7 +36,7 @@ pub fn main() {
|
||||
debug!("main thread exiting");
|
||||
}
|
||||
|
||||
fn child(x: int, ch: comm::Chan<int>) {
|
||||
fn child(x: int, ch: &comm::Chan<int>) {
|
||||
log(debug, x);
|
||||
ch.send(x);
|
||||
}
|
||||
|
@ -10,11 +10,10 @@
|
||||
|
||||
// xfail-fast
|
||||
// xfail-win32
|
||||
#[legacy_modes];
|
||||
|
||||
extern mod std;
|
||||
|
||||
fn start(c: comm::Chan<int>, i0: int) {
|
||||
fn start(c: &comm::Chan<int>, i0: int) {
|
||||
let mut i = i0;
|
||||
while i > 0 {
|
||||
c.send(0);
|
||||
@ -28,6 +27,6 @@ pub fn main() {
|
||||
// the child's point of view the receiver may die. We should
|
||||
// drop messages on the floor in this case, and not crash!
|
||||
let (p, ch) = comm::stream();
|
||||
task::spawn(|| start(ch, 10));
|
||||
task::spawn(|| start(&ch, 10));
|
||||
p.recv();
|
||||
}
|
||||
|
@ -9,14 +9,13 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
extern mod std;
|
||||
use core::comm::Chan;
|
||||
|
||||
pub fn main() { debug!("===== WITHOUT THREADS ====="); test00(); }
|
||||
|
||||
fn test00_start(ch: Chan<int>, message: int, count: int) {
|
||||
fn test00_start(ch: &Chan<int>, message: int, count: int) {
|
||||
debug!("Starting test00_start");
|
||||
let mut i: int = 0;
|
||||
while i < count {
|
||||
@ -45,7 +44,7 @@ fn test00() {
|
||||
results.push(r);
|
||||
}).spawn({
|
||||
let i = i;
|
||||
|| test00_start(ch, i, number_of_messages)
|
||||
|| test00_start(&ch, i, number_of_messages)
|
||||
});
|
||||
i = i + 1;
|
||||
}
|
||||
|
@ -9,13 +9,12 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
extern mod std;
|
||||
|
||||
pub fn main() { test00(); }
|
||||
|
||||
fn test00_start(c: comm::Chan<int>, number_of_messages: int) {
|
||||
fn test00_start(c: &comm::Chan<int>, number_of_messages: int) {
|
||||
let mut i: int = 0;
|
||||
while i < number_of_messages { c.send(i + 0); i += 1; }
|
||||
}
|
||||
@ -30,7 +29,7 @@ fn test00() {
|
||||
let mut result = None;
|
||||
do task::task().future_result(|+r| { result = Some(r); }).spawn
|
||||
|| {
|
||||
test00_start(ch, number_of_messages);
|
||||
test00_start(&ch, number_of_messages);
|
||||
}
|
||||
|
||||
let mut i: int = 0;
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
trait to_str {
|
||||
fn to_str() -> ~str;
|
||||
@ -25,12 +24,12 @@ impl to_str for () {
|
||||
}
|
||||
|
||||
trait map<T> {
|
||||
fn map<U:Copy>(f: fn(T) -> U) -> ~[U];
|
||||
fn map<U:Copy>(f: fn(&T) -> U) -> ~[U];
|
||||
}
|
||||
impl<T> map<T> for ~[T] {
|
||||
fn map<U:Copy>(f: fn(T) -> U) -> ~[U] {
|
||||
fn map<U:Copy>(f: fn(&T) -> U) -> ~[U] {
|
||||
let mut r = ~[];
|
||||
for self.each |x| { r += ~[f(*x)]; }
|
||||
for self.each |x| { r += ~[f(x)]; }
|
||||
r
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
// except according to those terms.
|
||||
|
||||
// xfail-fast
|
||||
#[legacy_modes];
|
||||
|
||||
fn p_foo<T>(pinned: T) { }
|
||||
fn s_foo<T:Copy>(shared: T) { }
|
||||
|
Loading…
x
Reference in New Issue
Block a user