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)) {

0 commit comments

Comments
 (0)