Skip to content

Commit cd8de54

Browse files
author
vagrant
committed
Show clearer error message when #![deny(warnings)] escalates a warning
Addresses #30730
1 parent d70ab2b commit cd8de54

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/librustc/lint/context.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,14 @@ pub trait LintContext: Sized {
451451

452452
fn level_src(&self, lint: &'static Lint) -> Option<LevelSource> {
453453
self.lints().levels.get(&LintId::of(lint)).map(|ls| match ls {
454-
&(Warn, src) => {
454+
&(Warn, _) => {
455455
let lint_id = LintId::of(builtin::WARNINGS);
456-
(self.lints().get_level_source(lint_id).0, src)
456+
let warn_src = self.lints().get_level_source(lint_id);
457+
if warn_src.0 != Warn {
458+
warn_src
459+
} else {
460+
*ls
461+
}
457462
}
458463
_ => *ls
459464
})

0 commit comments

Comments
 (0)