Skip to content
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

#![allow(unknown_lints)] does not work if there is a unknow lint at the same level since nightly-2017-08-11-x86_64-unknown-linux-gnu #43809

Closed
overvenus opened this issue Aug 11, 2017 · 3 comments
Labels
C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@overvenus
Copy link
Contributor

The following snippet works fine before nightly-2017-08-11-x86_64-unknown-linux-gnu

#![allow(unknown_lints)]
#![allow(clippy)]

but now it reports a warning:

warning: unknown lint: `clippy`
 --> /home/poc/src/../a/b.rs:2:10
  |
2 | #![allow(clippy)]
  |          ^^^^^^
  |
  = note: #[warn(unknown_lints)] on by default

Steps to reproduce:

  1. clone https://github.com/overvenus/poc.git
  2. rustup override set nightly-2017-08-11
  3. cargo test

Is this an expected behavior, or a bug? Thank you!

@Mark-Simulacrum Mark-Simulacrum added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 11, 2017
@Mark-Simulacrum
Copy link
Member

cc @alexcrichton -- probably related to the new lint implementation

@alexcrichton
Copy link
Member

Yes this was caused by #43522. The bug is on this line of code. The check for whether allow_lints is in scope is not checking the current set of attributes being linted.

For example this does not warn:

#![allow(unknown_lints)]

#[allow(clippy)]
fn main() {}

but this warns:

#![allow(unknown_lints)]
#![allow(clippy)]

fn main() {}

(as you've noticed)

The fix is to just take the local variable specs into account which has the up-to-that-point set of lint attributes collected.

@alexcrichton
Copy link
Member

I've opened a PR for this at #43841

alexcrichton added a commit to alexcrichton/rust that referenced this issue Aug 13, 2017
The lint refactoring in rust-lang#43522 didn't account for `#[allow(unknown_lints)]`
happening at the same node as an unknown lint itself, so this commit updates the
handling to ensure that the local set of lint configuration being built is
queried before looking at the chain of lint levels.

Closes rust-lang#43809
bors added a commit that referenced this issue Aug 16, 2017
rustc: Fix `unknown_lints` next to an unknown lint

The lint refactoring in #43522 didn't account for `#[allow(unknown_lints)]`
happening at the same node as an unknown lint itself, so this commit updates the
handling to ensure that the local set of lint configuration being built is
queried before looking at the chain of lint levels.

Closes #43809
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants