rust/tests/run-pass/specialization.rs

22 lines
342 B
Rust
Raw Normal View History

2016-06-20 12:33:54 +02:00
#![feature(specialization)]
2016-03-28 17:59:48 -06:00
trait IsUnit {
fn is_unit() -> bool;
}
impl<T> IsUnit for T {
default fn is_unit() -> bool { false }
}
impl IsUnit for () {
fn is_unit() -> bool { true }
}
fn specialization() -> (bool, bool) {
(i32::is_unit(), <()>::is_unit())
}
2016-04-22 10:34:14 +02:00
2016-04-22 14:38:46 +02:00
fn main() {
assert_eq!(specialization(), (false, true));
}