about summary refs log tree commit diff
path: root/src/tools/miri/tests/pass/specialization.rs
blob: 428dea073eb53c5af24c2ec7cec0ed41af7cd0d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#![allow(incomplete_features)]
#![feature(specialization)]

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())
}

fn main() {
    assert_eq!(specialization(), (false, true));
}