From 7a846b86a85d4cf30a45fc81eba35c02b0451be3 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Sat, 15 Nov 2014 19:10:08 -0500 Subject: [PATCH] Update tests for `()` notation to use traits not structs --- .../unboxed-closure-sugar-default.rs | 10 +++++----- .../unboxed-closure-sugar-region.rs | 17 ++++++++--------- ...gar-wrong-number-number-type-parameters-1.rs | 5 +++-- ...gar-wrong-number-number-type-parameters-3.rs | 5 +++-- ...sugar-wrong-number-number-type-parameters.rs | 3 ++- src/test/run-pass/unboxed-closures-sugar-1.rs | 4 ++-- 6 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/test/compile-fail/unboxed-closure-sugar-default.rs b/src/test/compile-fail/unboxed-closure-sugar-default.rs index d015f8195c5..06a93406392 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-default.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-default.rs @@ -14,13 +14,13 @@ #![feature(default_type_params, unboxed_closures)] #![allow(dead_code)] -struct Foo { - t: T, u: U +trait Foo { + fn dummy(&self, t: T, u: U, v: V); } -trait Eq { } -impl Eq for X { } -fn eq>() { } +trait Eq for Sized? { } +impl Eq for X { } +fn eq() where A : Eq { } fn test<'a,'b>() { // Parens are equivalent to omitting default in angle. diff --git a/src/test/compile-fail/unboxed-closure-sugar-region.rs b/src/test/compile-fail/unboxed-closure-sugar-region.rs index 9cef2d951bf..a938f126c16 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-region.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-region.rs @@ -17,15 +17,14 @@ use std::kinds::marker; -struct Foo<'a,T,U> { - t: T, - u: U, - m: marker::InvariantLifetime<'a> +trait Foo<'a,T,U> { + fn dummy(&'a self) -> &'a (T,U); } -trait Eq { } -impl Eq for X { } -fn eq>() { } +trait Eq for Sized? { } +impl Eq for X { } +fn eq>() { } + fn same_type>(a: A, b: B) { } fn test<'a,'b>() { @@ -34,10 +33,10 @@ fn test<'a,'b>() { // Here we specify 'static explicitly in angle-bracket version. // Parenthesized winds up getting inferred. - eq::< Foo<'static, (int,),()>, Foo(int) >(); + eq::< Foo<'static, (int,),()>, Foo(int) >(); } -fn test2(x: Foo<(int,),()>, y: Foo(int)) { +fn test2(x: &Foo<(int,),()>, y: &Foo(int)) { // Here, the omitted lifetimes are expanded to distinct things. same_type(x, y) //~ ERROR cannot infer } diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs b/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs index 5e3ebc70b86..d9efab974d8 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs @@ -8,10 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct One; #![feature(unboxed_closures)] -fn foo(_: One()) //~ ERROR wrong number of type arguments +trait One { fn foo(&self) -> A; } + +fn foo(_: &One()) //~ ERROR wrong number of type arguments {} fn main() { } diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs b/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs index c34f55ed4f9..dcfcb7d4772 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs @@ -8,10 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Three; #![feature(unboxed_closures)] -fn foo(_: Three()) //~ ERROR wrong number of type arguments +trait Three { fn dummy(&self) -> (A,B,C); } + +fn foo(_: &Three()) //~ ERROR wrong number of type arguments {} fn main() { } diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters.rs b/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters.rs index f7ff53310b0..a8ac62444aa 100644 --- a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters.rs +++ b/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters.rs @@ -8,9 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Zero; #![feature(unboxed_closures)] +trait Zero { fn dummy(&self); } + fn foo(_: Zero()) //~ ERROR wrong number of type arguments {} diff --git a/src/test/run-pass/unboxed-closures-sugar-1.rs b/src/test/run-pass/unboxed-closures-sugar-1.rs index b358e7ce288..edcb85006ca 100644 --- a/src/test/run-pass/unboxed-closures-sugar-1.rs +++ b/src/test/run-pass/unboxed-closures-sugar-1.rs @@ -15,8 +15,8 @@ #![allow(dead_code)] -struct Foo { - t: T, u: U +trait Foo { + fn dummy(&self) -> (T,U); } trait Eq { }