Skip to content

Commit 9dda6b5

Browse files
committed
Add test for unknown_lints from another file.
1 parent 475be26 commit 9dda6b5

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// check-pass
2+
3+
// Tests that the unknown_lints lint doesn't fire for an unknown lint loaded from a separate file.
4+
// The key part is that the stderr output should be empty.
5+
// Reported in https://github.com/rust-lang/rust/issues/84936
6+
// Fixed incidentally by https://github.com/rust-lang/rust/pull/97266
7+
8+
// This `allow` should apply to submodules, whether they are inline or loaded from a file.
9+
#![allow(unknown_lints)]
10+
#![allow(dead_code)]
11+
// no warning
12+
#![allow(not_a_real_lint)]
13+
14+
mod other;
15+
16+
// no warning
17+
#[allow(not_a_real_lint)]
18+
fn m() {}
19+
20+
mod mm {
21+
// no warning
22+
#[allow(not_a_real_lint)]
23+
fn m() {}
24+
}
25+
26+
fn main() {}

tests/ui/lint/unknown-lints/other.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// ignore-test
2+
3+
// Companion to allow-in-other-module.rs
4+
5+
// This should not warn.
6+
#![allow(not_a_real_lint)]
7+
8+
// This should not warn, either.
9+
#[allow(not_a_real_lint)]
10+
fn m() {}

0 commit comments

Comments
 (0)