From 71b94c9a5d68bcbb4667efb6edc054eda8be5665 Mon Sep 17 00:00:00 2001 From: Scott Olson Date: Mon, 28 Mar 2016 17:59:48 -0600 Subject: [PATCH] Add a basic test for specialization. --- test/specialization.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 test/specialization.rs diff --git a/test/specialization.rs b/test/specialization.rs new file mode 100755 index 00000000000..ac510ec4cb4 --- /dev/null +++ b/test/specialization.rs @@ -0,0 +1,19 @@ +#![feature(custom_attribute, specialization)] +#![allow(dead_code, unused_attributes)] + +trait IsUnit { + fn is_unit() -> bool; +} + +impl 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()) +} -- 2.44.0