Auto merge of #30804 - shssoichiro:deny-warnings-msg, r=nrc
Show clearer error message when #![deny(warnings)] escalates a warning Addresses #30730
This commit is contained in:
commit
4b868411af
@ -489,9 +489,14 @@ pub trait LintContext: Sized {
|
||||
|
||||
fn level_src(&self, lint: &'static Lint) -> Option<LevelSource> {
|
||||
self.lints().levels.get(&LintId::of(lint)).map(|ls| match ls {
|
||||
&(Warn, src) => {
|
||||
&(Warn, _) => {
|
||||
let lint_id = LintId::of(builtin::WARNINGS);
|
||||
(self.lints().get_level_source(lint_id).0, src)
|
||||
let warn_src = self.lints().get_level_source(lint_id);
|
||||
if warn_src.0 != Warn {
|
||||
warn_src
|
||||
} else {
|
||||
*ls
|
||||
}
|
||||
}
|
||||
_ => *ls
|
||||
})
|
||||
|
13
src/test/compile-fail/issue-30730.rs
Normal file
13
src/test/compile-fail/issue-30730.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(warnings)] //~ NOTE: lint level defined here
|
||||
use std::thread; //~ ERROR: unused import
|
||||
fn main() {}
|
Loading…
x
Reference in New Issue
Block a user