Skip to content

Commit 89f4193

Browse files
committed
auto merge of #6115 : jbclements/rust/test-case-fixes, r=jbclements
In developing the grammar a few weeks ago, I fixed up a bunch of test cases that had rotted to the point that they didn't parse.
2 parents c1ea72d + ab1d8ea commit 89f4193

25 files changed

+141
-299
lines changed

src/test/auxiliary/issue-2196-a.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/test/auxiliary/issue-2196-b.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/test/auxiliary/issue-2196-c.rc

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/test/auxiliary/issue-2196-d.rs

Whitespace-only changes.

src/test/auxiliary/issue2378a.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#[link (name = "issue2378a")];
12+
#[crate_type = "lib"];
13+
1114
enum maybe<T> { just(T), nothing }
1215

13-
impl copy> for maybe<T> for methods<T {
14-
fn ~[](idx: uint) -> T {
16+
impl <T:Copy> Index<uint,T> for maybe<T> {
17+
fn index(&self, idx: &uint) -> T {
1518
match self {
16-
just(t) { t }
17-
nothing { fail!(); }
19+
&just(ref t) => copy *t,
20+
&nothing => { fail!(); }
1821
}
1922
}
2023
}

src/test/auxiliary/issue2378b.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use issue2378a;
11+
#[link (name = "issue2378b")];
12+
#[crate_type = "lib"];
13+
14+
extern mod issue2378a;
1215

1316
use issue2378a::maybe;
14-
use issue2378a::methods;
1517

16-
type two_maybes<T> = {a: maybe<T>, b: maybe<T>};
18+
struct two_maybes<T> {a: maybe<T>, b: maybe<T>}
1719

18-
impl copy> for two_maybes<T> for methods<T {
19-
fn ~[](idx: uint) -> (T, T) {
20-
(self.a[idx], self.b[idx])
20+
impl <T:Copy> Index<uint,(T,T)> for two_maybes<T> {
21+
fn index(&self, idx: &uint) -> (T, T) {
22+
(self.a[*idx], self.b[*idx])
2123
}
2224
}
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -8,7 +8,13 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use b::d;
1211

13-
type t = uint;
1412

13+
// error-pattern:unresolved enum variant
14+
15+
fn main() {
16+
let z = match 3 {
17+
x() => x
18+
};
19+
assert_eq!(z,3);
20+
}

src/test/run-pass/issue-1466.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/test/run-pass/issue-1989.rs

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/test/run-pass/issue-2185.rs

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,46 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// xfail-test FIXME #2263
11+
// does the second one subsume the first?
12+
// xfail-test
1213
// xfail-fast
14+
15+
// notes on this test case:
16+
// On Thu, Apr 18, 2013 at 6:30 PM, John Clements <[email protected]> wrote:
17+
// the "issue-2185.rs" test was xfailed with a ref to #2263. Issue #2263 is now fixed, so I tried it again, and after adding some &self parameters, I got this error:
18+
//
19+
// Running /usr/local/bin/rustc:
20+
// issue-2185.rs:24:0: 26:1 error: conflicting implementations for a trait
21+
// issue-2185.rs:24 impl iterable<uint> for @fn(&fn(uint)) {
22+
// issue-2185.rs:25 fn iter(&self, blk: &fn(v: uint)) { self( |i| blk(i) ) }
23+
// issue-2185.rs:26 }
24+
// issue-2185.rs:20:0: 22:1 note: note conflicting implementation here
25+
// issue-2185.rs:20 impl<A> iterable<A> for @fn(&fn(A)) {
26+
// issue-2185.rs:21 fn iter(&self, blk: &fn(A)) { self(blk); }
27+
// issue-2185.rs:22 }
28+
//
29+
// … so it looks like it's just not possible to implement both the generic iterable<uint> and iterable<A> for the type iterable<uint>. Is it okay if I just remove this test?
30+
//
31+
// but Niko responded:
32+
// think it's fine to remove this test, just because it's old and cruft and not hard to reproduce. *However* it should eventually be possible to implement the same interface for the same type multiple times with different type parameters, it's just that our current trait implementation has accidental limitations.
33+
34+
// so I'm leaving it in.
35+
// actually, it looks like this is related to bug #3429. I'll rename this bug.
36+
1337
// This test had to do with an outdated version of the iterable trait.
1438
// However, the condition it was testing seemed complex enough to
1539
// warrant still having a test, so I inlined the old definitions.
1640

1741
trait iterable<A> {
18-
fn iter(blk: &fn(A));
42+
fn iter(&self, blk: &fn(A));
1943
}
2044

2145
impl<A> iterable<A> for @fn(&fn(A)) {
22-
fn iter(blk: &fn(A)) { self(blk); }
46+
fn iter(&self, blk: &fn(A)) { self(blk); }
2347
}
2448

2549
impl iterable<uint> for @fn(&fn(uint)) {
26-
fn iter(blk: &fn(&&v: uint)) { self( |i| blk(i) ) }
50+
fn iter(&self, blk: &fn(v: uint)) { self( |i| blk(i) ) }
2751
}
2852

2953
fn filter<A,IA:iterable<A>>(self: IA, prd: @fn(A) -> bool, blk: &fn(A)) {

src/test/run-pass/issue-2196.rs

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/test/run-pass/issue-2869.rs

Lines changed: 0 additions & 24 deletions
This file was deleted.
File renamed without changes.

src/test/run-pass/issue-3480.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/test/run-pass/issue-3979-generics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl Positioned<int> for Point {
3232
}
3333
}
3434

35-
impl Point: Movable<int, int>;
35+
impl Movable<int, int> for Point;
3636

3737
pub fn main() {
3838
let p = Point{ x: 1, y: 2};

src/test/run-pass/issue2378c.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// xfail-test -- #2378 unfixed
1211
// aux-build:issue2378a.rs
1312
// aux-build:issue2378b.rs
13+
// xfail-fast - check-fast doesn't understand aux-build
1414

15-
use issue2378a;
16-
use issue2378b;
15+
extern mod issue2378a;
16+
extern mod issue2378b;
1717

18-
use issue2378a::{just, methods};
19-
use issue2378b::{methods};
18+
use issue2378a::{just};
19+
use issue2378b::{two_maybes};
2020

2121
pub fn main() {
22-
let x = {a: just(3), b: just(5)};
22+
let x = two_maybes{a: just(3), b: just(5)};
2323
assert!(x[0u] == (3, 5));
2424
}

src/test/run-pass/mlist-cycle.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@
1010

1111
// xfail-test
1212
// -*- rust -*-
13-
extern mod std;
13+
extern mod core;
14+
use core::gc;
15+
use core::gc::rustrt;
1416

15-
type cell = {c: @list};
17+
struct cell {c: @list}
1618

1719
enum list { link(@mut cell), nil, }
1820

1921
pub fn main() {
20-
let first: @cell = @mut {c: @nil()};
21-
let second: @cell = @mut {c: @link(first)};
22+
let first: @cell = @mut cell{c: @nil()};
23+
let second: @cell = @mut cell{c: @link(first)};
2224
first._0 = @link(second);
23-
sys.rustrt.gc();
24-
let third: @cell = @mut {c: @nil()};
25+
rustrt::gc();
26+
let third: @cell = @mut cell{c: @nil()};
2527
}

src/test/run-pass/preempt.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
fn starve_main(alive: chan<int>) {
1515
debug!("signalling main");
16-
alive <| 1;
16+
alive.recv(1);
1717
debug!("starving main");
1818
let i: int = 0;
1919
loop { i += 1; }
@@ -22,10 +22,12 @@ fn starve_main(alive: chan<int>) {
2222
pub fn main() {
2323
let alive: port<int> = port();
2424
debug!("main started");
25-
let s: task = spawn starve_main(chan(alive));
25+
let s: task = do task::spawn {
26+
starve_main(chan(alive));
27+
};
2628
let i: int;
2729
debug!("main waiting for alive signal");
28-
alive |> i;
30+
alive.send(i);
2931
debug!("main got alive signal");
3032
while i < 50 { debug!("main iterated"); i += 1; }
3133
debug!("main completed");

src/test/run-pass/regions-fn-subtyping-2.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,18 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// xfail-test
12-
1311
// Issue #2263.
1412

1513
// Here, `f` is a function that takes a pointer `x` and a function
1614
// `g`, where `g` requires its argument `y` to be in the same region
1715
// that `x` is in.
18-
fn has_same_region(f: &fn(x: &a.int, g: &fn(y: &a.int))) {
16+
fn has_same_region(f: &fn<'a>(x: &'a int, g: &fn(y: &'a int))) {
1917
// `f` should be the type that `wants_same_region` wants, but
2018
// right now the compiler complains that it isn't.
2119
wants_same_region(f);
2220
}
2321

24-
fn wants_same_region(_f: &fn(x: &b.int, g: &fn(y: &b.int))) {
22+
fn wants_same_region(_f: &fn<'b>(x: &'b int, g: &fn(y: &'b int))) {
2523
}
2624

2725
pub fn main() {

0 commit comments

Comments
 (0)