2016-03-28 18:59:48 -05:00
|
|
|
#![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())
|
|
|
|
}
|
2016-04-22 03:34:14 -05:00
|
|
|
|
2016-04-23 01:39:38 -05:00
|
|
|
#[miri_run]
|
2016-04-22 07:38:46 -05:00
|
|
|
fn main() {
|
|
|
|
assert_eq!(specialization(), (false, true));
|
|
|
|
}
|