2020-07-25 12:41:53 +00:00
|
|
|
//@ build-fail
|
|
|
|
//~^ ERROR overflow evaluating the requirement `i32: Check`
|
|
|
|
|
2018-01-11 02:57:56 +00:00
|
|
|
#![feature(specialization)]
|
2020-06-16 08:06:35 +00:00
|
|
|
//~^ WARN the feature `specialization` is incomplete
|
2018-01-11 02:57:56 +00:00
|
|
|
|
|
|
|
trait Iterate<'a> {
|
|
|
|
type Ty: Valid;
|
|
|
|
fn iterate(self);
|
|
|
|
}
|
2020-07-25 12:41:53 +00:00
|
|
|
impl<'a, T> Iterate<'a> for T
|
|
|
|
where
|
|
|
|
T: Check,
|
|
|
|
{
|
2018-01-11 02:57:56 +00:00
|
|
|
default type Ty = ();
|
|
|
|
default fn iterate(self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Check {}
|
|
|
|
impl<'a, T> Check for T where <T as Iterate<'a>>::Ty: Valid {}
|
|
|
|
|
|
|
|
trait Valid {}
|
|
|
|
|
2020-06-28 11:41:46 +00:00
|
|
|
impl Valid for () {}
|
|
|
|
|
2018-01-11 02:57:56 +00:00
|
|
|
fn main() {
|
|
|
|
Iterate::iterate(0);
|
|
|
|
}
|