2014-11-03 20:52:52 -06:00
|
|
|
// Test interaction between unboxed closure sugar and default type
|
|
|
|
// parameters (should be exactly as if angle brackets were used).
|
|
|
|
|
2015-01-05 00:36:00 -06:00
|
|
|
#![feature(unboxed_closures)]
|
2014-11-03 20:52:52 -06:00
|
|
|
#![allow(dead_code)]
|
|
|
|
|
2015-01-12 09:27:25 -06:00
|
|
|
trait Foo<T,V=T> {
|
|
|
|
type Output;
|
|
|
|
fn dummy(&self, t: T, v: V);
|
2014-11-03 20:52:52 -06:00
|
|
|
}
|
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
trait Eq<X: ?Sized> { fn same_types(&self, x: &X) -> bool { true } }
|
2015-01-05 15:16:49 -06:00
|
|
|
impl<X: ?Sized> Eq<X> for X { }
|
|
|
|
fn eq<A: ?Sized,B: ?Sized>() where A : Eq<B> { }
|
2014-11-03 20:52:52 -06:00
|
|
|
|
|
|
|
fn test<'a,'b>() {
|
|
|
|
// Parens are equivalent to omitting default in angle.
|
2015-01-12 09:27:25 -06:00
|
|
|
eq::< Foo<(isize,),Output=()>, Foo(isize) >();
|
2014-11-03 20:52:52 -06:00
|
|
|
|
|
|
|
// In angle version, we supply something other than the default
|
2015-01-12 09:27:25 -06:00
|
|
|
eq::< Foo<(isize,),isize,Output=()>, Foo(isize) >();
|
2016-03-29 12:12:31 -05:00
|
|
|
//~^ ERROR E0277
|
2014-11-03 20:52:52 -06:00
|
|
|
|
|
|
|
// Supply default explicitly.
|
2015-01-12 09:27:25 -06:00
|
|
|
eq::< Foo<(isize,),(isize,),Output=()>, Foo(isize) >();
|
2014-11-03 20:52:52 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|