提交 7a846b86 编写于 作者: N Niko Matsakis

Update tests for `()` notation to use traits not structs

上级 5a28d178
......@@ -14,13 +14,13 @@
#![feature(default_type_params, unboxed_closures)]
#![allow(dead_code)]
struct Foo<T,U,V=T> {
t: T, u: U
trait Foo<T,U,V=T> {
fn dummy(&self, t: T, u: U, v: V);
}
trait Eq<X> { }
impl<X> Eq<X> for X { }
fn eq<A,B:Eq<A>>() { }
trait Eq<Sized? X> for Sized? { }
impl<Sized? X> Eq<X> for X { }
fn eq<Sized? A,Sized? B>() where A : Eq<B> { }
fn test<'a,'b>() {
// Parens are equivalent to omitting default in angle.
......
......@@ -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<X> { }
impl<X> Eq<X> for X { }
fn eq<A,B:Eq<A>>() { }
trait Eq<Sized? X> for Sized? { }
impl<Sized? X> Eq<X> for X { }
fn eq<Sized? A,Sized? B:Eq<A>>() { }
fn same_type<A,B:Eq<A>>(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
}
......
......@@ -8,10 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
struct One<A>;
#![feature(unboxed_closures)]
fn foo(_: One()) //~ ERROR wrong number of type arguments
trait One<A> { fn foo(&self) -> A; }
fn foo(_: &One()) //~ ERROR wrong number of type arguments
{}
fn main() { }
......@@ -8,10 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
struct Three<A,B,C>;
#![feature(unboxed_closures)]
fn foo(_: Three()) //~ ERROR wrong number of type arguments
trait Three<A,B,C> { fn dummy(&self) -> (A,B,C); }
fn foo(_: &Three()) //~ ERROR wrong number of type arguments
{}
fn main() { }
......@@ -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
{}
......
......@@ -15,8 +15,8 @@
#![allow(dead_code)]
struct Foo<T,U> {
t: T, u: U
trait Foo<T,U> {
fn dummy(&self) -> (T,U);
}
trait Eq<X> { }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册