about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-03-02 23:15:54 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-03-03 13:10:15 +0100
commitf04c5c51120eabf969c75381ee6151b4539313f4 (patch)
treeec86be85d94dcf4b821de9128edcc6a741022574 /tests
parentf04b7ee130b51bb6281a23788107b2df5aae283d (diff)
downloadrust-f04c5c51120eabf969c75381ee6151b4539313f4.tar.gz
rust-f04c5c51120eabf969c75381ee6151b4539313f4.zip
Add feature gate test for `pattern_complexity` attribute
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/feature-gates/feature-gate-pattern-complexity.rs6
-rw-r--r--tests/ui/feature-gates/feature-gate-pattern-complexity.stderr12
2 files changed, 18 insertions, 0 deletions
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 00000000000..43e9a00c9a7
--- /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 00000000000..c05e6abb017
--- /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`.