summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/unknown-lints
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /tests/ui/lint/unknown-lints
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/lint/unknown-lints')
-rw-r--r--tests/ui/lint/unknown-lints/allow-in-other-module.rs26
-rw-r--r--tests/ui/lint/unknown-lints/other.rs10
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/ui/lint/unknown-lints/allow-in-other-module.rs b/tests/ui/lint/unknown-lints/allow-in-other-module.rs
new file mode 100644
index 000000000..20bf0d7af
--- /dev/null
+++ b/tests/ui/lint/unknown-lints/allow-in-other-module.rs
@@ -0,0 +1,26 @@
+// check-pass
+
+// Tests that the unknown_lints lint doesn't fire for an unknown lint loaded from a separate file.
+// The key part is that the stderr output should be empty.
+// Reported in https://github.com/rust-lang/rust/issues/84936
+// Fixed incidentally by https://github.com/rust-lang/rust/pull/97266
+
+// This `allow` should apply to submodules, whether they are inline or loaded from a file.
+#![allow(unknown_lints)]
+#![allow(dead_code)]
+// no warning
+#![allow(not_a_real_lint)]
+
+mod other;
+
+// no warning
+#[allow(not_a_real_lint)]
+fn m() {}
+
+mod mm {
+ // no warning
+ #[allow(not_a_real_lint)]
+ fn m() {}
+}
+
+fn main() {}
diff --git a/tests/ui/lint/unknown-lints/other.rs b/tests/ui/lint/unknown-lints/other.rs
new file mode 100644
index 000000000..a5111c00a
--- /dev/null
+++ b/tests/ui/lint/unknown-lints/other.rs
@@ -0,0 +1,10 @@
+// ignore-test
+
+// Companion to allow-in-other-module.rs
+
+// This should not warn.
+#![allow(not_a_real_lint)]
+
+// This should not warn, either.
+#[allow(not_a_real_lint)]
+fn m() {}