diff options
| author | bors <bors@rust-lang.org> | 2016-10-31 10:56:25 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-31 10:56:25 -0700 |
| commit | f26eedb571c8e3f55385f3933be256689deed277 (patch) | |
| tree | 3ecbcebf7c5c6fddb41bbe2b341c264bf9accd04 /src/test | |
| parent | bf5b824c1cb1fa5ec9b060f9b552cf7fd7465f01 (diff) | |
| parent | ef6a07221d66bff1ef8edac4f9ffc39013abf256 (diff) | |
| download | rust-f26eedb571c8e3f55385f3933be256689deed277.tar.gz rust-f26eedb571c8e3f55385f3933be256689deed277.zip | |
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
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/span/issue-24690.rs | 22 | ||||
| -rw-r--r-- | src/test/ui/span/issue-24690.stderr | 32 |
2 files changed, 54 insertions, 0 deletions
diff --git a/src/test/ui/span/issue-24690.rs b/src/test/ui/span/issue-24690.rs new file mode 100644 index 00000000000..def0d9aced3 --- /dev/null +++ b/src/test/ui/span/issue-24690.rs @@ -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); +} diff --git a/src/test/ui/span/issue-24690.stderr b/src/test/ui/span/issue-24690.stderr new file mode 100644 index 00000000000..0d2a2ef7516 --- /dev/null +++ b/src/test/ui/span/issue-24690.stderr @@ -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 + |
