mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-02 06:28:20 +03:00
Add a basic test for specialization.
This commit is contained in:
Executable
+19
@@ -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())
|
||||
}
|
||||
Reference in New Issue
Block a user