summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-ui/check-cfg
diff options
context:
space:
mode:
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
+