summaryrefslogtreecommitdiffstats
path: root/src/test/ui/rfc-2632-const-trait-impl/specializing-constness.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/rfc-2632-const-trait-impl/specializing-constness.rs')
-rw-r--r--src/test/ui/rfc-2632-const-trait-impl/specializing-constness.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/rfc-2632-const-trait-impl/specializing-constness.rs b/src/test/ui/rfc-2632-const-trait-impl/specializing-constness.rs
new file mode 100644
index 000000000..ff0cd489d
--- /dev/null
+++ b/src/test/ui/rfc-2632-const-trait-impl/specializing-constness.rs
@@ -0,0 +1,26 @@
+#![feature(const_trait_impl, min_specialization, rustc_attrs)]
+
+#[rustc_specialization_trait]
+#[const_trait]
+pub trait Sup {}
+
+impl const Sup for () {}
+
+#[const_trait]
+pub trait A {
+ fn a() -> u32;
+}
+
+impl<T: ~const Default> const A for T {
+ default fn a() -> u32 {
+ 2
+ }
+}
+
+impl<T: Default + Sup> A for T { //~ ERROR: cannot specialize
+ fn a() -> u32 {
+ 3
+ }
+}
+
+fn main() {}