2018-12-02 16:49:12 -06:00
|
|
|
// run-pass
|
|
|
|
#![feature(specialization)]
|
2020-06-16 03:06:35 -05:00
|
|
|
//~^ WARN the feature `specialization` is incomplete
|
2018-12-02 16:49:12 -06:00
|
|
|
|
|
|
|
pub trait Foo {
|
|
|
|
fn abc() -> u32;
|
|
|
|
fn def() -> u32;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub trait Marker {}
|
|
|
|
|
|
|
|
impl Marker for () {}
|
|
|
|
|
|
|
|
impl<T> Foo for T {
|
|
|
|
default fn abc() -> u32 { 16 }
|
|
|
|
default fn def() -> u32 { 42 }
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<T: Marker> Foo for T {
|
|
|
|
fn def() -> u32 {
|
|
|
|
Self::abc()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_eq!(<()>::def(), 16);
|
|
|
|
assert_eq!(<i32>::def(), 42);
|
|
|
|
}
|