Skip to content

Remove legacy_modes from some test cases #5092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/test/run-pass/argument-passing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions src/test/run-pass/block-iter-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 3 additions & 4 deletions src/test/run-pass/block-iter-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/closure-inference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

// xfail-fast
#[legacy_modes];

fn foo(i: int) -> int { i + 1 }

Expand Down
4 changes: 1 addition & 3 deletions src/test/run-pass/expr-alt-generic-box2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>) {
Expand All @@ -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);
}

Expand Down
4 changes: 1 addition & 3 deletions src/test/run-pass/expr-alt-generic-unique2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>) {
Expand All @@ -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);
}

Expand Down
3 changes: 1 addition & 2 deletions src/test/run-pass/expr-alt-generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

// xfail-fast
// -*- rust -*-
#[legacy_modes];

type compare<T> = fn@(T, T) -> bool;

Expand All @@ -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);
}

Expand Down
3 changes: 1 addition & 2 deletions src/test/run-pass/expr-block-generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down
7 changes: 3 additions & 4 deletions src/test/run-pass/expr-copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@
// except according to those terms.

// xfail-fast
#[legacy_modes];

fn f(arg: A) {
fn f(arg: &A) {
arg.a = 100;
}

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(&copy x);
assert x.a == 20;
}
3 changes: 1 addition & 2 deletions src/test/run-pass/expr-if-generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down
3 changes: 1 addition & 2 deletions src/test/run-pass/fixed-point-bind-box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) };
}
Expand Down
3 changes: 1 addition & 2 deletions src/test/run-pass/fixed-point-bind-unique.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) };
}
Expand Down
5 changes: 2 additions & 3 deletions src/test/run-pass/generic-temporary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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);
}
6 changes: 2 additions & 4 deletions src/test/run-pass/issue-2185.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -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);
Expand All @@ -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);
Expand Down
19 changes: 9 additions & 10 deletions src/test/run-pass/monad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!?"];
}
1 change: 0 additions & 1 deletion src/test/run-pass/operator-overloading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

// xfail-fast
#[legacy_modes];

struct Point {
x: int,
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/reflect-visit-data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

// xfail-fast
#[legacy_modes];

use core::bool;
use intrinsic::{TyDesc, get_tydesc, visit_tydesc, TyVisitor};
Expand Down
1 change: 0 additions & 1 deletion src/test/run-pass/regions-params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

// xfail-fast
#[legacy_modes];

fn region_identity(x: &r/uint) -> &r/uint { x }

Expand Down
3 changes: 1 addition & 2 deletions src/test/run-pass/resource-generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

// xfail-fast
#[legacy_modes];

struct Arg<T> {val: T, fin: extern fn(T)}

Expand All @@ -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);
Expand Down
Loading