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