summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-ui/check-cfg
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
commit837b550238aa671a591ccf282dddeab29cadb206 (patch)
tree914b6b8862bace72bd3245ca184d374b08d8a672 /tests/rustdoc-ui/check-cfg
parentAdding debian version 1.70.0+dfsg2-1. (diff)
downloadrustc-837b550238aa671a591ccf282dddeab29cadb206.tar.xz
rustc-837b550238aa671a591ccf282dddeab29cadb206.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc-ui/check-cfg')
-rw-r--r--tests/rustdoc-ui/check-cfg/check-cfg-test.stderr11
-rw-r--r--tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs2
-rw-r--r--tests/rustdoc-ui/check-cfg/check-cfg-unstable.stderr2
-rw-r--r--tests/rustdoc-ui/check-cfg/check-cfg.rs7
-rw-r--r--tests/rustdoc-ui/check-cfg/check-cfg.stderr10
5 files changed, 32 insertions, 0 deletions
diff --git a/tests/rustdoc-ui/check-cfg/check-cfg-test.stderr b/tests/rustdoc-ui/check-cfg/check-cfg-test.stderr
new file mode 100644
index 000000000..9770be2f1
--- /dev/null
+++ b/tests/rustdoc-ui/check-cfg/check-cfg-test.stderr
@@ -0,0 +1,11 @@
+warning: unexpected `cfg` condition value
+ --> $DIR/check-cfg-test.rs:9:7
+ |
+LL | #[cfg(feature = "invalid")]
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: expected values for `feature` are: test
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs
new file mode 100644
index 000000000..5c500ce6c
--- /dev/null
+++ b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs
@@ -0,0 +1,2 @@
+// check-fail
+// compile-flags: --check-cfg=names()
diff --git a/tests/rustdoc-ui/check-cfg/check-cfg-unstable.stderr b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.stderr
new file mode 100644
index 000000000..9b27c2bc0
--- /dev/null
+++ b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.stderr
@@ -0,0 +1,2 @@
+error: the `-Z unstable-options` flag must also be passed to enable the flag `check-cfg`
+
diff --git a/tests/rustdoc-ui/check-cfg/check-cfg.rs b/tests/rustdoc-ui/check-cfg/check-cfg.rs
new file mode 100644
index 000000000..fa8789ad3
--- /dev/null
+++ b/tests/rustdoc-ui/check-cfg/check-cfg.rs
@@ -0,0 +1,7 @@
+// check-pass
+// compile-flags: --check-cfg=names() -Z unstable-options
+
+/// uniz is nor a builtin nor pass as arguments so is unexpected
+#[cfg(uniz)]
+//~^ WARNING unexpected `cfg` condition name
+pub struct Bar;
diff --git a/tests/rustdoc-ui/check-cfg/check-cfg.stderr b/tests/rustdoc-ui/check-cfg/check-cfg.stderr
new file mode 100644
index 000000000..03fb6f96f
--- /dev/null
+++ b/tests/rustdoc-ui/check-cfg/check-cfg.stderr
@@ -0,0 +1,10 @@
+warning: unexpected `cfg` condition name
+ --> $DIR/check-cfg.rs:5:7
+ |
+LL | #[cfg(uniz)]
+ | ^^^^ help: there is a config with a similar name: `unix`
+ |
+ = note: `#[warn(unexpected_cfgs)]` on by default
+
+warning: 1 warning emitted
+