diff options
Diffstat (limited to 'tests/ui/specialization/min_specialization/specialize_on_spec_trait.rs')
-rw-r--r-- | tests/ui/specialization/min_specialization/specialize_on_spec_trait.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/specialization/min_specialization/specialize_on_spec_trait.rs b/tests/ui/specialization/min_specialization/specialize_on_spec_trait.rs new file mode 100644 index 000000000..abbab5c23 --- /dev/null +++ b/tests/ui/specialization/min_specialization/specialize_on_spec_trait.rs @@ -0,0 +1,27 @@ +// Test that specializing on a `rustc_specialization_trait` trait is allowed. + +// check-pass + +#![feature(min_specialization)] +#![feature(rustc_attrs)] + +#[rustc_specialization_trait] +trait SpecTrait { + fn g(&self); +} + +trait X { + fn f(&self); +} + +impl<T> X for T { + default fn f(&self) {} +} + +impl<T: SpecTrait> X for T { + fn f(&self) { + self.g(); + } +} + +fn main() {} |