-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #37191 - zackmdavis:we_heard_you_the_first_time_really,…
… r=nikomatsakis introing one-time diagnostics: only emit "lint level defined here" once This is a revised resubmission of PR #34084 (which was closed due to inactivity on account of time constraints on the author's part). --- We introduce a new `one_time_diagnostics` field on `rustc::session::Session` to hold a hashset of diagnostic messages we've set once but don't want to see again (as uniquified by span and message text), "lint level defined here" being the motivating example dealt with here. This is in the matter of #24690. --- r? @nikomatsakis
- Loading branch information
Showing
4 changed files
with
90 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// 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. | ||
|
||
//! A test to ensure that helpful `note` messages aren't emitted more often | ||
//! than necessary. | ||
|
||
// Although there are three errors, we should only get two "lint level defined | ||
// here" notes pointing at the `warnings` span, one for each error type. | ||
#![deny(warnings)] | ||
|
||
fn main() { | ||
let theTwo = 2; | ||
let theOtherTwo = 2; | ||
println!("{}", theTwo); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
error: unused variable: `theOtherTwo` | ||
--> $DIR/issue-24690.rs:20:9 | ||
| | ||
20 | let theOtherTwo = 2; | ||
| ^^^^^^^^^^^ | ||
| | ||
note: lint level defined here | ||
--> $DIR/issue-24690.rs:16:9 | ||
| | ||
16 | #![deny(warnings)] | ||
| ^^^^^^^^ | ||
|
||
error: variable `theTwo` should have a snake case name such as `the_two` | ||
--> $DIR/issue-24690.rs:19:9 | ||
| | ||
19 | let theTwo = 2; | ||
| ^^^^^^ | ||
| | ||
note: lint level defined here | ||
--> $DIR/issue-24690.rs:16:9 | ||
| | ||
16 | #![deny(warnings)] | ||
| ^^^^^^^^ | ||
|
||
error: variable `theOtherTwo` should have a snake case name such as `the_other_two` | ||
--> $DIR/issue-24690.rs:20:9 | ||
| | ||
20 | let theOtherTwo = 2; | ||
| ^^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|