Skip to content

Add test for unknown_lints from another file. #114820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions tests/ui/lint/unknown-lints/allow-in-other-module.rs
Original file line number Diff line number Diff line change
@@ -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() {}
10 changes: 10 additions & 0 deletions tests/ui/lint/unknown-lints/other.rs
Original file line number Diff line number Diff line change
@@ -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() {}