about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-02-05 01:22:54 +0000
committerbors <bors@rust-lang.org>2017-02-05 01:22:54 +0000
commitd7777ae682d498ff43e3d6b65a7a8d0b2361fa0b (patch)
treeb73bfb7da0b98aff3851fc91481774ad38470a3a /src/test
parentea7a6486a26af085862cd7a5596bb69e83d85e12 (diff)
parent72af42e8974f521e3fed753feac3d0638ad61025 (diff)
downloadrust-d7777ae682d498ff43e3d6b65a7a8d0b2361fa0b.tar.gz
rust-d7777ae682d498ff43e3d6b65a7a8d0b2361fa0b.zip
Auto merge of #38103 - zackmdavis:lint_errors_resulting_from_lint_groups_or_warnings_meta-lint_obscure_the_original_lint_name, r=nikomatsakis
note individual lint name in messages set via lint group attribute

![lint_errors_resulting_from_lint_groups_obscure](https://cloud.githubusercontent.com/assets/1076988/20783614/c107d5c8-b749-11e6-85de-eada7f67c986.png)

Resolves #36846.

r? @jonathandturner

-----

***Update*** 16 December (new commits):
![lint_group_makeover_party](https://cloud.githubusercontent.com/assets/1076988/21284540/ff1ae2fc-c3d2-11e6-93be-d0689f5fa7a8.png)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/imports/rfc-1560-warning-cycle.rs1
-rw-r--r--src/test/compile-fail/issue-30730.rs4
-rw-r--r--src/test/compile-fail/lint-group-style.rs41
-rw-r--r--src/test/compile-fail/lint-output-format-2.rs11
-rw-r--r--src/test/run-pass/path-lookahead.rs6
-rw-r--r--src/test/ui/compare-method/proj-outlives-region.stderr3
-rw-r--r--src/test/ui/compare-method/region-unrelated.stderr3
-rw-r--r--src/test/ui/lint/command-line-lint-group-allow.rs15
-rw-r--r--src/test/ui/lint/command-line-lint-group-deny.rs15
-rw-r--r--src/test/ui/lint/command-line-lint-group-deny.stderr10
-rw-r--r--src/test/ui/lint/command-line-lint-group-forbid.rs15
-rw-r--r--src/test/ui/lint/command-line-lint-group-forbid.stderr10
-rw-r--r--src/test/ui/lint/command-line-lint-group-warn.rs15
-rw-r--r--src/test/ui/lint/command-line-lint-group-warn.stderr8
-rw-r--r--src/test/ui/lint/lint-group-style.rs36
-rw-r--r--src/test/ui/lint/lint-group-style.stderr67
-rw-r--r--src/test/ui/span/issue-24690.stderr4
-rw-r--r--src/test/ui/span/multispan-import-lint.stderr4
18 files changed, 217 insertions, 51 deletions
diff --git a/src/test/compile-fail/imports/rfc-1560-warning-cycle.rs b/src/test/compile-fail/imports/rfc-1560-warning-cycle.rs
index eb36129799a..1d67bf3a1cd 100644
--- a/src/test/compile-fail/imports/rfc-1560-warning-cycle.rs
+++ b/src/test/compile-fail/imports/rfc-1560-warning-cycle.rs
@@ -23,6 +23,7 @@ mod bar {
         //~^ WARN `Foo` is ambiguous
         //~| WARN hard error in a future release
         //~| NOTE see issue #38260
+        //~| NOTE #[warn(legacy_imports)] on by default
     }
 }
 
diff --git a/src/test/compile-fail/issue-30730.rs b/src/test/compile-fail/issue-30730.rs
index 82804bb7474..086938334c7 100644
--- a/src/test/compile-fail/issue-30730.rs
+++ b/src/test/compile-fail/issue-30730.rs
@@ -9,5 +9,7 @@
 // except according to those terms.
 
 #![deny(warnings)] //~ NOTE: lint level defined here
-use std::thread; //~ ERROR: unused import
+use std::thread;
+//~^ ERROR: unused import
+//~| NOTE: #[deny(unused_imports)] implied by #[deny(warnings)]
 fn main() {}
diff --git a/src/test/compile-fail/lint-group-style.rs b/src/test/compile-fail/lint-group-style.rs
deleted file mode 100644
index b2e6072c985..00000000000
--- a/src/test/compile-fail/lint-group-style.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2014 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(bad_style)]
-//~^ NOTE lint level defined here
-#![allow(dead_code)]
-
-fn CamelCase() {} //~ ERROR function `CamelCase` should have a snake case name
-
-#[allow(bad_style)]
-mod test {
-    fn CamelCase() {}
-
-    #[forbid(bad_style)]
-    //~^ NOTE lint level defined here
-    //~^^ NOTE lint level defined here
-    mod bad {
-        fn CamelCase() {} //~ ERROR function `CamelCase` should have a snake case name
-
-        static bad: isize = 1; //~ ERROR static variable `bad` should have an upper case name
-    }
-
-    mod warn {
-        #![warn(bad_style)]
-        //~^ NOTE lint level defined here
-        //~| NOTE lint level defined here
-
-        fn CamelCase() {} //~ WARN function `CamelCase` should have a snake case name
-
-        struct snake_case; //~ WARN type `snake_case` should have a camel case name
-    }
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/lint-output-format-2.rs b/src/test/compile-fail/lint-output-format-2.rs
index 2f74325d19c..0e68ff752e5 100644
--- a/src/test/compile-fail/lint-output-format-2.rs
+++ b/src/test/compile-fail/lint-output-format-2.rs
@@ -11,15 +11,20 @@
 // compile-flags: -F unused_features
 // aux-build:lint_output_format.rs
 
-#![feature(foo)] //~ ERROR unused or unknown feature
+#![feature(foo)]
+//~^ ERROR unused or unknown feature
+//~| NOTE requested on the command line with `-F unused-features`
 
 #![feature(test_feature)]
 
 extern crate lint_output_format;
 use lint_output_format::{foo, bar};
-//~^ WARNING use of deprecated item: text,
+//~^ WARNING use of deprecated item: text
+//~| NOTE #[warn(deprecated)] on by default
 
 fn main() {
-    let _x = foo(); //~ WARNING #[warn(deprecated)] on by default
+    let _x = foo();
+    //~^ WARNING use of deprecated item: text
+    //~| NOTE #[warn(deprecated)] on by default
     let _y = bar();
 }
diff --git a/src/test/run-pass/path-lookahead.rs b/src/test/run-pass/path-lookahead.rs
index 017259af190..5c195c8a4c6 100644
--- a/src/test/run-pass/path-lookahead.rs
+++ b/src/test/run-pass/path-lookahead.rs
@@ -10,11 +10,11 @@
 
 // Parser test for #37765
 
-fn with_parens<T: ToString>(arg: T) -> String { //~WARN dead_code
-  return (<T as ToString>::to_string(&arg)); //~WARN unused_parens
+fn with_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `with_parens`
+  return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
 }
 
-fn no_parens<T: ToString>(arg: T) -> String { //~WARN dead_code
+fn no_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `no_parens`
   return <T as ToString>::to_string(&arg);
 }
 
diff --git a/src/test/ui/compare-method/proj-outlives-region.stderr b/src/test/ui/compare-method/proj-outlives-region.stderr
index 021b571fe79..2a707c6eb8b 100644
--- a/src/test/ui/compare-method/proj-outlives-region.stderr
+++ b/src/test/ui/compare-method/proj-outlives-region.stderr
@@ -1,4 +1,4 @@
-error[E0276]: impl has stricter requirements than trait, #[deny(extra_requirement_in_impl)] on by default
+error[E0276]: impl has stricter requirements than trait
   --> $DIR/proj-outlives-region.rs:22:5
    |
 17 |     fn foo() where T: 'a;
@@ -7,6 +7,7 @@ error[E0276]: impl has stricter requirements than trait, #[deny(extra_requiremen
 22 |     fn foo() where U: 'a { } //~ ERROR E0276
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a`
    |
+   = note: #[deny(extra_requirement_in_impl)] on by default
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #37166 <https://github.com/rust-lang/rust/issues/37166>
 
diff --git a/src/test/ui/compare-method/region-unrelated.stderr b/src/test/ui/compare-method/region-unrelated.stderr
index 4df337c5257..9e822bd8b07 100644
--- a/src/test/ui/compare-method/region-unrelated.stderr
+++ b/src/test/ui/compare-method/region-unrelated.stderr
@@ -1,4 +1,4 @@
-error[E0276]: impl has stricter requirements than trait, #[deny(extra_requirement_in_impl)] on by default
+error[E0276]: impl has stricter requirements than trait
   --> $DIR/region-unrelated.rs:22:5
    |
 17 |     fn foo() where T: 'a;
@@ -7,6 +7,7 @@ error[E0276]: impl has stricter requirements than trait, #[deny(extra_requiremen
 22 |     fn foo() where V: 'a { }
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `V: 'a`
    |
+   = note: #[deny(extra_requirement_in_impl)] on by default
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #37166 <https://github.com/rust-lang/rust/issues/37166>
 
diff --git a/src/test/ui/lint/command-line-lint-group-allow.rs b/src/test/ui/lint/command-line-lint-group-allow.rs
new file mode 100644
index 00000000000..cdb9684933d
--- /dev/null
+++ b/src/test/ui/lint/command-line-lint-group-allow.rs
@@ -0,0 +1,15 @@
+// Copyright 2017 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.
+
+// compile-flags: -A bad-style
+
+fn main() {
+    let _InappropriateCamelCasing = true;
+}
diff --git a/src/test/ui/lint/command-line-lint-group-deny.rs b/src/test/ui/lint/command-line-lint-group-deny.rs
new file mode 100644
index 00000000000..1248601c1e4
--- /dev/null
+++ b/src/test/ui/lint/command-line-lint-group-deny.rs
@@ -0,0 +1,15 @@
+// Copyright 2017 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.
+
+// compile-flags: -D bad-style
+
+fn main() {
+    let _InappropriateCamelCasing = true;
+}
diff --git a/src/test/ui/lint/command-line-lint-group-deny.stderr b/src/test/ui/lint/command-line-lint-group-deny.stderr
new file mode 100644
index 00000000000..23fac66cc6c
--- /dev/null
+++ b/src/test/ui/lint/command-line-lint-group-deny.stderr
@@ -0,0 +1,10 @@
+error: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing`
+  --> $DIR/command-line-lint-group-deny.rs:14:9
+   |
+14 |     let _InappropriateCamelCasing = true;
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `-D non-snake-case` implied by `-D bad-style`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lint/command-line-lint-group-forbid.rs b/src/test/ui/lint/command-line-lint-group-forbid.rs
new file mode 100644
index 00000000000..ae16db44864
--- /dev/null
+++ b/src/test/ui/lint/command-line-lint-group-forbid.rs
@@ -0,0 +1,15 @@
+// Copyright 2017 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.
+
+// compile-flags: -F bad-style
+
+fn main() {
+    let _InappropriateCamelCasing = true;
+}
diff --git a/src/test/ui/lint/command-line-lint-group-forbid.stderr b/src/test/ui/lint/command-line-lint-group-forbid.stderr
new file mode 100644
index 00000000000..0babd7f6fe4
--- /dev/null
+++ b/src/test/ui/lint/command-line-lint-group-forbid.stderr
@@ -0,0 +1,10 @@
+error: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing`
+  --> $DIR/command-line-lint-group-forbid.rs:14:9
+   |
+14 |     let _InappropriateCamelCasing = true;
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `-F non-snake-case` implied by `-F bad-style`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lint/command-line-lint-group-warn.rs b/src/test/ui/lint/command-line-lint-group-warn.rs
new file mode 100644
index 00000000000..7d65c802788
--- /dev/null
+++ b/src/test/ui/lint/command-line-lint-group-warn.rs
@@ -0,0 +1,15 @@
+// Copyright 2017 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.
+
+// compile-flags: -W bad-style
+
+fn main() {
+    let _InappropriateCamelCasing = true;
+}
diff --git a/src/test/ui/lint/command-line-lint-group-warn.stderr b/src/test/ui/lint/command-line-lint-group-warn.stderr
new file mode 100644
index 00000000000..998c892c7e3
--- /dev/null
+++ b/src/test/ui/lint/command-line-lint-group-warn.stderr
@@ -0,0 +1,8 @@
+warning: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing`
+  --> $DIR/command-line-lint-group-warn.rs:14:9
+   |
+14 |     let _InappropriateCamelCasing = true;
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `-W non-snake-case` implied by `-W bad-style`
+
diff --git a/src/test/ui/lint/lint-group-style.rs b/src/test/ui/lint/lint-group-style.rs
new file mode 100644
index 00000000000..2bd760e417a
--- /dev/null
+++ b/src/test/ui/lint/lint-group-style.rs
@@ -0,0 +1,36 @@
+// Copyright 2014–2017 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(bad_style)]
+#![allow(dead_code)]
+
+fn CamelCase() {}
+
+#[allow(bad_style)]
+mod test {
+    fn CamelCase() {}
+
+    #[forbid(bad_style)]
+    mod bad {
+        fn CamelCase() {}
+
+        static bad: isize = 1;
+    }
+
+    mod warn {
+        #![warn(bad_style)]
+
+        fn CamelCase() {}
+
+        struct snake_case;
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/lint/lint-group-style.stderr b/src/test/ui/lint/lint-group-style.stderr
new file mode 100644
index 00000000000..9c0f4866af6
--- /dev/null
+++ b/src/test/ui/lint/lint-group-style.stderr
@@ -0,0 +1,67 @@
+error: function `CamelCase` should have a snake case name such as `camel_case`
+  --> $DIR/lint-group-style.rs:14:1
+   |
+14 | fn CamelCase() {}
+   | ^^^^^^^^^^^^^^^^^
+   |
+   = note: #[deny(non_snake_case)] implied by #[deny(bad_style)]
+note: lint level defined here
+  --> $DIR/lint-group-style.rs:11:9
+   |
+11 | #![deny(bad_style)]
+   |         ^^^^^^^^^
+
+error: function `CamelCase` should have a snake case name such as `camel_case`
+  --> $DIR/lint-group-style.rs:22:9
+   |
+22 |         fn CamelCase() {}
+   |         ^^^^^^^^^^^^^^^^^
+   |
+   = note: #[forbid(non_snake_case)] implied by #[forbid(bad_style)]
+note: lint level defined here
+  --> $DIR/lint-group-style.rs:20:14
+   |
+20 |     #[forbid(bad_style)]
+   |              ^^^^^^^^^
+
+error: static variable `bad` should have an upper case name such as `BAD`
+  --> $DIR/lint-group-style.rs:24:9
+   |
+24 |         static bad: isize = 1;
+   |         ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: #[forbid(non_upper_case_globals)] implied by #[forbid(bad_style)]
+note: lint level defined here
+  --> $DIR/lint-group-style.rs:20:14
+   |
+20 |     #[forbid(bad_style)]
+   |              ^^^^^^^^^
+
+warning: function `CamelCase` should have a snake case name such as `camel_case`
+  --> $DIR/lint-group-style.rs:30:9
+   |
+30 |         fn CamelCase() {}
+   |         ^^^^^^^^^^^^^^^^^
+   |
+   = note: #[warn(non_snake_case)] implied by #[warn(bad_style)]
+note: lint level defined here
+  --> $DIR/lint-group-style.rs:28:17
+   |
+28 |         #![warn(bad_style)]
+   |                 ^^^^^^^^^
+
+warning: type `snake_case` should have a camel case name such as `SnakeCase`
+  --> $DIR/lint-group-style.rs:32:9
+   |
+32 |         struct snake_case;
+   |         ^^^^^^^^^^^^^^^^^^
+   |
+   = note: #[warn(non_camel_case_types)] implied by #[warn(bad_style)]
+note: lint level defined here
+  --> $DIR/lint-group-style.rs:28:17
+   |
+28 |         #![warn(bad_style)]
+   |                 ^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/span/issue-24690.stderr b/src/test/ui/span/issue-24690.stderr
index dbe5e31287e..c4f2616f594 100644
--- a/src/test/ui/span/issue-24690.stderr
+++ b/src/test/ui/span/issue-24690.stderr
@@ -4,6 +4,7 @@ error: variable `theTwo` should have a snake case name such as `the_two`
 19 |     let theTwo = 2;
    |         ^^^^^^
    |
+   = note: #[deny(non_snake_case)] implied by #[deny(warnings)]
 note: lint level defined here
   --> $DIR/issue-24690.rs:16:9
    |
@@ -15,6 +16,8 @@ error: variable `theOtherTwo` should have a snake case name such as `the_other_t
    |
 20 |     let theOtherTwo = 2;
    |         ^^^^^^^^^^^
+   |
+   = note: #[deny(non_snake_case)] implied by #[deny(warnings)]
 
 error: unused variable: `theOtherTwo`
   --> $DIR/issue-24690.rs:20:9
@@ -22,6 +25,7 @@ error: unused variable: `theOtherTwo`
 20 |     let theOtherTwo = 2;
    |         ^^^^^^^^^^^
    |
+   = note: #[deny(unused_variables)] implied by #[deny(warnings)]
 note: lint level defined here
   --> $DIR/issue-24690.rs:16:9
    |
diff --git a/src/test/ui/span/multispan-import-lint.stderr b/src/test/ui/span/multispan-import-lint.stderr
index b581584eee7..4b1ca7f98bb 100644
--- a/src/test/ui/span/multispan-import-lint.stderr
+++ b/src/test/ui/span/multispan-import-lint.stderr
@@ -1,6 +1,8 @@
-warning: unused imports: `Eq`, `Ord`, `PartialEq`, `PartialOrd`, #[warn(unused_imports)] on by default
+warning: unused imports: `Eq`, `Ord`, `PartialEq`, `PartialOrd`
   --> $DIR/multispan-import-lint.rs:11:16
    |
 11 | use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd};
    |                ^^  ^^^       ^^^^^^^^^  ^^^^^^^^^^
+   |
+   = note: #[warn(unused_imports)] on by default