From 0216123eb5cf4b1f1257b0478ba09e1a44dbc59e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 2 Mar 2024 23:15:54 +0100 Subject: [PATCH] Add feature gate test for `pattern_complexity` attribute --- .../feature-gates/feature-gate-pattern-complexity.rs | 6 ++++++ .../feature-gate-pattern-complexity.stderr | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/ui/feature-gates/feature-gate-pattern-complexity.rs create mode 100644 tests/ui/feature-gates/feature-gate-pattern-complexity.stderr diff --git a/tests/ui/feature-gates/feature-gate-pattern-complexity.rs b/tests/ui/feature-gates/feature-gate-pattern-complexity.rs new file mode 100644 index 0000000000000..43e9a00c9a7ef --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-pattern-complexity.rs @@ -0,0 +1,6 @@ +// check that `pattern_complexity` is feature-gated + +#![pattern_complexity = "42"] +//~^ ERROR: the `#[pattern_complexity]` attribute is just used for rustc unit tests + +fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-pattern-complexity.stderr b/tests/ui/feature-gates/feature-gate-pattern-complexity.stderr new file mode 100644 index 0000000000000..beab48347283a --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-pattern-complexity.stderr @@ -0,0 +1,12 @@ +error[E0658]: the `#[pattern_complexity]` attribute is just used for rustc unit tests and will never be stable + --> $DIR/feature-gate-pattern_complexity.rs:3:1 + | +LL | #![pattern_complexity = "42"] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0658`.