summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/unknown-lints/allow-in-other-module.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/lint/unknown-lints/allow-in-other-module.rs')
-rw-r--r--tests/ui/lint/unknown-lints/allow-in-other-module.rs26
1 files changed, 26 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() {}