about summary refs log tree commit diff
path: root/tests/ui/deriving/deriving-with-helper.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/deriving/deriving-with-helper.rs')
-rw-r--r--tests/ui/deriving/deriving-with-helper.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/ui/deriving/deriving-with-helper.rs b/tests/ui/deriving/deriving-with-helper.rs
new file mode 100644
index 00000000000..1c30b0b6fba
--- /dev/null
+++ b/tests/ui/deriving/deriving-with-helper.rs
@@ -0,0 +1,36 @@
+// check-pass
+// compile-flags: --crate-type=lib
+
+#![feature(decl_macro)]
+#![feature(lang_items)]
+#![feature(no_core)]
+#![feature(rustc_attrs)]
+
+#![no_core]
+
+#[rustc_builtin_macro]
+macro derive() {}
+
+#[rustc_builtin_macro(Default, attributes(default))]
+macro Default() {}
+
+mod default {
+    pub trait Default {
+        fn default() -> Self;
+    }
+
+    impl Default for u8 {
+        fn default() -> u8 {
+            0
+        }
+    }
+}
+
+#[lang = "sized"]
+trait Sized {}
+
+#[derive(Default)]
+enum S {
+    #[default] // OK
+    Foo,
+}