Add a basic test for specialization.
This commit is contained in:
parent
1861dbc2ab
commit
71b94c9a5d
1 changed files with 19 additions and 0 deletions
19
test/specialization.rs
Executable file
19
test/specialization.rs
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#![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())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue