Skip to content

Commit 7a846b8

Browse files
committed
Update tests for () notation to use traits not structs
1 parent 5a28d17 commit 7a846b8

6 files changed

+23
-21
lines changed

src/test/compile-fail/unboxed-closure-sugar-default.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
#![feature(default_type_params, unboxed_closures)]
1515
#![allow(dead_code)]
1616

17-
struct Foo<T,U,V=T> {
18-
t: T, u: U
17+
trait Foo<T,U,V=T> {
18+
fn dummy(&self, t: T, u: U, v: V);
1919
}
2020

21-
trait Eq<X> { }
22-
impl<X> Eq<X> for X { }
23-
fn eq<A,B:Eq<A>>() { }
21+
trait Eq<Sized? X> for Sized? { }
22+
impl<Sized? X> Eq<X> for X { }
23+
fn eq<Sized? A,Sized? B>() where A : Eq<B> { }
2424

2525
fn test<'a,'b>() {
2626
// Parens are equivalent to omitting default in angle.

src/test/compile-fail/unboxed-closure-sugar-region.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717

1818
use std::kinds::marker;
1919

20-
struct Foo<'a,T,U> {
21-
t: T,
22-
u: U,
23-
m: marker::InvariantLifetime<'a>
20+
trait Foo<'a,T,U> {
21+
fn dummy(&'a self) -> &'a (T,U);
2422
}
2523

26-
trait Eq<X> { }
27-
impl<X> Eq<X> for X { }
28-
fn eq<A,B:Eq<A>>() { }
24+
trait Eq<Sized? X> for Sized? { }
25+
impl<Sized? X> Eq<X> for X { }
26+
fn eq<Sized? A,Sized? B:Eq<A>>() { }
27+
2928
fn same_type<A,B:Eq<A>>(a: A, b: B) { }
3029

3130
fn test<'a,'b>() {
@@ -34,10 +33,10 @@ fn test<'a,'b>() {
3433

3534
// Here we specify 'static explicitly in angle-bracket version.
3635
// Parenthesized winds up getting inferred.
37-
eq::< Foo<'static, (int,),()>, Foo(int) >();
36+
eq::< Foo<'static, (int,),()>, Foo(int) >();
3837
}
3938

40-
fn test2(x: Foo<(int,),()>, y: Foo(int)) {
39+
fn test2(x: &Foo<(int,),()>, y: &Foo(int)) {
4140
// Here, the omitted lifetimes are expanded to distinct things.
4241
same_type(x, y) //~ ERROR cannot infer
4342
}

src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs

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

11-
struct One<A>;
1211
#![feature(unboxed_closures)]
1312

14-
fn foo(_: One()) //~ ERROR wrong number of type arguments
13+
trait One<A> { fn foo(&self) -> A; }
14+
15+
fn foo(_: &One()) //~ ERROR wrong number of type arguments
1516
{}
1617

1718
fn main() { }

src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs

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

11-
struct Three<A,B,C>;
1211
#![feature(unboxed_closures)]
1312

14-
fn foo(_: Three()) //~ ERROR wrong number of type arguments
13+
trait Three<A,B,C> { fn dummy(&self) -> (A,B,C); }
14+
15+
fn foo(_: &Three()) //~ ERROR wrong number of type arguments
1516
{}
1617

1718
fn main() { }

src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters.rs

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

11-
struct Zero;
1211
#![feature(unboxed_closures)]
1312

13+
trait Zero { fn dummy(&self); }
14+
1415
fn foo(_: Zero()) //~ ERROR wrong number of type arguments
1516
{}
1617

src/test/run-pass/unboxed-closures-sugar-1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
#![allow(dead_code)]
1717

18-
struct Foo<T,U> {
19-
t: T, u: U
18+
trait Foo<T,U> {
19+
fn dummy(&self) -> (T,U);
2020
}
2121

2222
trait Eq<X> { }

0 commit comments

Comments
 (0)