rust/tests/run-pass/specialization.rs
2016-04-22 20:09:00 +02:00

24 lines
412 B
Rust

#![feature(custom_attribute, specialization)]
#![allow(dead_code, unused_attributes)]
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 }
}
#[miri_run]
fn specialization() -> (bool, bool) {
(i32::is_unit(), <()>::is_unit())
}
fn main() {
assert_eq!(specialization(), (false, true));
}