diff options
Diffstat (limited to 'tests/ui/specialization/min_specialization/implcit-well-formed-bounds.rs')
-rw-r--r-- | tests/ui/specialization/min_specialization/implcit-well-formed-bounds.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/ui/specialization/min_specialization/implcit-well-formed-bounds.rs b/tests/ui/specialization/min_specialization/implcit-well-formed-bounds.rs new file mode 100644 index 000000000..98d7f9194 --- /dev/null +++ b/tests/ui/specialization/min_specialization/implcit-well-formed-bounds.rs @@ -0,0 +1,30 @@ +// Test that specializing on the well-formed predicates of the trait and +// self-type of an impl is allowed. + +// check-pass + +#![feature(min_specialization)] + +struct OrdOnly<T: Ord>(T); + +trait SpecTrait<U> { + fn f(); +} + +impl<T, U> SpecTrait<U> for T { + default fn f() {} +} + +impl<T: Ord> SpecTrait<()> for OrdOnly<T> { + fn f() {} +} + +impl<T: Ord> SpecTrait<OrdOnly<T>> for () { + fn f() {} +} + +impl<T: Ord, U: Ord, V: Ord> SpecTrait<(OrdOnly<T>, OrdOnly<U>)> for &[OrdOnly<V>] { + fn f() {} +} + +fn main() {} |