about summary refs log tree commit diff
path: root/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn-pass.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn-pass.rs')
-rw-r--r--src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn-pass.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn-pass.rs b/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn-pass.rs
new file mode 100644
index 00000000000..ba3fec0882b
--- /dev/null
+++ b/src/test/ui/rfc-2632-const-trait-impl/impl-with-default-fn-pass.rs
@@ -0,0 +1,34 @@
+// check-pass
+
+#![feature(const_trait_impl)]
+#![feature(const_fn_trait_bound)]
+
+trait Tr {
+    fn req(&self);
+
+    fn prov(&self) {
+        println!("lul");
+        self.req();
+    }
+
+    #[default_method_body_is_const]
+    fn default() {}
+}
+
+impl const Tr for u8 {
+    fn req(&self) {}
+    fn prov(&self) {}
+}
+
+macro_rules! impl_tr {
+    ($ty: ty) => {
+        impl const Tr for $ty {
+            fn req(&self) {}
+            fn prov(&self) {}
+        }
+    }
+}
+
+impl_tr!(u64);
+
+fn main() {}