about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2022-01-11 03:39:43 +0300
committerMaybe Waffle <waffle.lapkin@gmail.com>2022-01-11 03:39:43 +0300
commit4ccfa97021abbe228dbf9dcc36c76ce7489b08b3 (patch)
treee0985ef359db9edf93014f2765746a6afdf90272
parentf64daff0c6e400819c997c888ac2aca32168dd53 (diff)
downloadrust-4ccfa97021abbe228dbf9dcc36c76ce7489b08b3.tar.gz
rust-4ccfa97021abbe228dbf9dcc36c76ce7489b08b3.zip
Add a test for ungated `#[rustc_must_implement_one_of]`
This test checks that `#[rustc_must_implement_one_of]` is gated behind
`#![feature(rustc_attrs)]`.
-rw-r--r--src/test/ui/traits/default-method/rustc_must_implement_one_of_gated.rs13
-rw-r--r--src/test/ui/traits/default-method/rustc_must_implement_one_of_gated.stderr11
2 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/traits/default-method/rustc_must_implement_one_of_gated.rs b/src/test/ui/traits/default-method/rustc_must_implement_one_of_gated.rs
new file mode 100644
index 00000000000..ec2995872de
--- /dev/null
+++ b/src/test/ui/traits/default-method/rustc_must_implement_one_of_gated.rs
@@ -0,0 +1,13 @@
+#[rustc_must_implement_one_of(eq, neq)]
+//~^ the `#[rustc_must_implement_one_of]` attribute is used to change minimal complete definition of a trait, it's currently in experimental form and should be changed before being exposed outside of the std
+trait Equal {
+    fn eq(&self, other: &Self) -> bool {
+        !self.neq(other)
+    }
+
+    fn neq(&self, other: &Self) -> bool {
+        !self.eq(other)
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/traits/default-method/rustc_must_implement_one_of_gated.stderr b/src/test/ui/traits/default-method/rustc_must_implement_one_of_gated.stderr
new file mode 100644
index 00000000000..228bc3e35c2
--- /dev/null
+++ b/src/test/ui/traits/default-method/rustc_must_implement_one_of_gated.stderr
@@ -0,0 +1,11 @@
+error[E0658]: the `#[rustc_must_implement_one_of]` attribute is used to change minimal complete definition of a trait, it's currently in experimental form and should be changed before being exposed outside of the std
+  --> $DIR/rustc_must_implement_one_of_gated.rs:1:1
+   |
+LL | #[rustc_must_implement_one_of(eq, neq)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.