From 4ccfa97021abbe228dbf9dcc36c76ce7489b08b3 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Tue, 11 Jan 2022 03:39:43 +0300 Subject: [PATCH] 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)]`. --- .../rustc_must_implement_one_of_gated.rs | 13 +++++++++++++ .../rustc_must_implement_one_of_gated.stderr | 11 +++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/test/ui/traits/default-method/rustc_must_implement_one_of_gated.rs create mode 100644 src/test/ui/traits/default-method/rustc_must_implement_one_of_gated.stderr 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 000000000000..ec2995872de0 --- /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 000000000000..228bc3e35c21 --- /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`.