From 267fc6dcf6bbd5faa67ddd4e0cf74def77051892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Fri, 8 Nov 2019 00:00:00 +0000 Subject: [PATCH 1/3] Add warning annotations to ignore-stage1 ui-fulldeps tests --- src/test/ui-fulldeps/issue-15778-pass.rs | 2 +- src/test/ui-fulldeps/issue-40001.rs | 2 +- .../ui-fulldeps/lint-plugin-cmdline-allow.rs | 5 ++--- .../lint-plugin-cmdline-allow.stderr | 15 +-------------- src/test/ui-fulldeps/lint-tool-cmdline-allow.rs | 6 +++--- .../ui-fulldeps/lint-tool-cmdline-allow.stderr | 17 ++--------------- src/test/ui-fulldeps/llvm-pass-plugin.rs | 2 +- src/test/ui-fulldeps/lto-syntax-extension.rs | 2 +- src/test/ui-fulldeps/outlive-expansion-phase.rs | 2 +- src/test/ui-fulldeps/plugin-args-1.rs | 2 +- src/test/ui-fulldeps/plugin-args-2.rs | 2 +- src/test/ui-fulldeps/plugin-args-3.rs | 2 +- src/test/ui-fulldeps/roman-numerals-macro.rs | 2 +- 13 files changed, 17 insertions(+), 44 deletions(-) diff --git a/src/test/ui-fulldeps/issue-15778-pass.rs b/src/test/ui-fulldeps/issue-15778-pass.rs index 55f19ab4ee31c..4b3cf07e2830d 100644 --- a/src/test/ui-fulldeps/issue-15778-pass.rs +++ b/src/test/ui-fulldeps/issue-15778-pass.rs @@ -13,7 +13,7 @@ rustc_crate_green, )] -#![plugin(lint_for_crate_rpass)] +#![plugin(lint_for_crate_rpass)] //~ WARNING compiler plugins are deprecated #![rustc_crate_okay] #![rustc_crate_blue] #![rustc_crate_red] diff --git a/src/test/ui-fulldeps/issue-40001.rs b/src/test/ui-fulldeps/issue-40001.rs index 65e188ed1b643..e0dc3d6a45b53 100644 --- a/src/test/ui-fulldeps/issue-40001.rs +++ b/src/test/ui-fulldeps/issue-40001.rs @@ -3,7 +3,7 @@ // ignore-stage1 #![feature(plugin)] -#![plugin(issue_40001_plugin)] +#![plugin(issue_40001_plugin)] //~ WARNING compiler plugins are deprecated #[whitelisted_attr] fn main() {} diff --git a/src/test/ui-fulldeps/lint-plugin-cmdline-allow.rs b/src/test/ui-fulldeps/lint-plugin-cmdline-allow.rs index 8017379ab3d44..1cc16e2fd1c9e 100644 --- a/src/test/ui-fulldeps/lint-plugin-cmdline-allow.rs +++ b/src/test/ui-fulldeps/lint-plugin-cmdline-allow.rs @@ -1,11 +1,10 @@ -// run-pass +// check-pass // aux-build:lint-plugin-test.rs // ignore-stage1 // compile-flags: -A test-lint #![feature(plugin)] -#![warn(unused)] -#![plugin(lint_plugin_test)] +#![plugin(lint_plugin_test)] //~ WARNING compiler plugins are deprecated fn lintme() { } diff --git a/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr b/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr index 5ab3dfb24496f..77265782fa366 100644 --- a/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr +++ b/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr @@ -1,21 +1,8 @@ warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-plugin-cmdline-allow.rs:8:1 + --> $DIR/lint-plugin-cmdline-allow.rs:7:1 | LL | #![plugin(lint_plugin_test)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version | = note: `#[warn(deprecated)]` on by default -warning: function is never used: `lintme` - --> $DIR/lint-plugin-cmdline-allow.rs:10:4 - | -LL | fn lintme() { } - | ^^^^^^ - | -note: lint level defined here - --> $DIR/lint-plugin-cmdline-allow.rs:7:9 - | -LL | #![warn(unused)] - | ^^^^^^ - = note: `#[warn(dead_code)]` implied by `#[warn(unused)]` - diff --git a/src/test/ui-fulldeps/lint-tool-cmdline-allow.rs b/src/test/ui-fulldeps/lint-tool-cmdline-allow.rs index 529f04c6fc4dd..83a8b3e1a7eed 100644 --- a/src/test/ui-fulldeps/lint-tool-cmdline-allow.rs +++ b/src/test/ui-fulldeps/lint-tool-cmdline-allow.rs @@ -1,12 +1,12 @@ -// run-pass +// check-pass // aux-build:lint-tool-test.rs // ignore-stage1 // compile-flags: -A test-lint #![feature(plugin)] -#![warn(unused)] -#![plugin(lint_tool_test)] +#![plugin(lint_tool_test)] //~ WARNING compiler plugins are deprecated fn lintme() {} +//~^ WARNING item is named 'lintme' [clippy::test_lint] pub fn main() {} diff --git a/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr b/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr index 3a9fd7c2867f2..825a341c5d327 100644 --- a/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr +++ b/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr @@ -3,7 +3,7 @@ warning: lint name `test_lint` is deprecated and does not have an effect anymore = note: requested on the command line with `-A test_lint` warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675 - --> $DIR/lint-tool-cmdline-allow.rs:8:1 + --> $DIR/lint-tool-cmdline-allow.rs:7:1 | LL | #![plugin(lint_tool_test)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version @@ -11,23 +11,10 @@ LL | #![plugin(lint_tool_test)] = note: `#[warn(deprecated)]` on by default warning: item is named 'lintme' - --> $DIR/lint-tool-cmdline-allow.rs:10:1 + --> $DIR/lint-tool-cmdline-allow.rs:9:1 | LL | fn lintme() {} | ^^^^^^^^^^^^^^ | = note: `#[warn(clippy::test_lint)]` on by default -warning: function is never used: `lintme` - --> $DIR/lint-tool-cmdline-allow.rs:10:4 - | -LL | fn lintme() {} - | ^^^^^^ - | -note: lint level defined here - --> $DIR/lint-tool-cmdline-allow.rs:7:9 - | -LL | #![warn(unused)] - | ^^^^^^ - = note: `#[warn(dead_code)]` implied by `#[warn(unused)]` - diff --git a/src/test/ui-fulldeps/llvm-pass-plugin.rs b/src/test/ui-fulldeps/llvm-pass-plugin.rs index a9b53fa8c7424..fa5cbc1e80830 100644 --- a/src/test/ui-fulldeps/llvm-pass-plugin.rs +++ b/src/test/ui-fulldeps/llvm-pass-plugin.rs @@ -3,6 +3,6 @@ // ignore-stage1 #![feature(plugin)] -#![plugin(llvm_pass_plugin)] +#![plugin(llvm_pass_plugin)] //~ WARNING compiler plugins are deprecated pub fn main() { } diff --git a/src/test/ui-fulldeps/lto-syntax-extension.rs b/src/test/ui-fulldeps/lto-syntax-extension.rs index 135861dd77282..5964e70f195a8 100644 --- a/src/test/ui-fulldeps/lto-syntax-extension.rs +++ b/src/test/ui-fulldeps/lto-syntax-extension.rs @@ -6,7 +6,7 @@ // no-prefer-dynamic #![feature(plugin)] -#![plugin(lto_syntax_extension_plugin)] +#![plugin(lto_syntax_extension_plugin)] //~ WARNING compiler plugins are deprecated extern crate lto_syntax_extension_lib; diff --git a/src/test/ui-fulldeps/outlive-expansion-phase.rs b/src/test/ui-fulldeps/outlive-expansion-phase.rs index 752f1da7377cd..fb22888d98ab6 100644 --- a/src/test/ui-fulldeps/outlive-expansion-phase.rs +++ b/src/test/ui-fulldeps/outlive-expansion-phase.rs @@ -3,6 +3,6 @@ // ignore-stage1 #![feature(plugin)] -#![plugin(outlive_expansion_phase)] +#![plugin(outlive_expansion_phase)] //~ WARNING compiler plugins are deprecated pub fn main() {} diff --git a/src/test/ui-fulldeps/plugin-args-1.rs b/src/test/ui-fulldeps/plugin-args-1.rs index d6437146775fc..739b6e74b8a0e 100644 --- a/src/test/ui-fulldeps/plugin-args-1.rs +++ b/src/test/ui-fulldeps/plugin-args-1.rs @@ -3,7 +3,7 @@ // ignore-stage1 #![feature(plugin)] -#![plugin(plugin_args)] +#![plugin(plugin_args)] //~ WARNING compiler plugins are deprecated fn main() { assert_eq!(plugin_args!(), ""); diff --git a/src/test/ui-fulldeps/plugin-args-2.rs b/src/test/ui-fulldeps/plugin-args-2.rs index 949f8440379be..5c8be3d2f5087 100644 --- a/src/test/ui-fulldeps/plugin-args-2.rs +++ b/src/test/ui-fulldeps/plugin-args-2.rs @@ -3,7 +3,7 @@ // ignore-stage1 #![feature(plugin)] -#![plugin(plugin_args())] +#![plugin(plugin_args())] //~ WARNING compiler plugins are deprecated fn main() { assert_eq!(plugin_args!(), ""); diff --git a/src/test/ui-fulldeps/plugin-args-3.rs b/src/test/ui-fulldeps/plugin-args-3.rs index efdbcd0bf0d0a..2d72bdf0b1be3 100644 --- a/src/test/ui-fulldeps/plugin-args-3.rs +++ b/src/test/ui-fulldeps/plugin-args-3.rs @@ -3,7 +3,7 @@ // ignore-stage1 #![feature(plugin)] -#![plugin(plugin_args(hello(there), how(are="you")))] +#![plugin(plugin_args(hello(there), how(are="you")))] //~ WARNING compiler plugins are deprecated fn main() { assert_eq!(plugin_args!(), "hello(there), how(are = \"you\")"); diff --git a/src/test/ui-fulldeps/roman-numerals-macro.rs b/src/test/ui-fulldeps/roman-numerals-macro.rs index 5c4ba3158dbd4..b5823ea3047a5 100644 --- a/src/test/ui-fulldeps/roman-numerals-macro.rs +++ b/src/test/ui-fulldeps/roman-numerals-macro.rs @@ -3,7 +3,7 @@ // ignore-stage1 #![feature(plugin)] -#![plugin(roman_numerals)] +#![plugin(roman_numerals)] //~ WARNING compiler plugins are deprecated pub fn main() { assert_eq!(rn!(MMXV), 2015); From 70b146c2cb435880c8a1f05384611e6de50ec2a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Fri, 8 Nov 2019 00:00:00 +0000 Subject: [PATCH 2/3] Add warning annotations to rustdoc-ui tests --- .../rustdoc-ui/intra-links-warning-crlf.rs | 7 ++-- .../intra-links-warning-crlf.stderr | 6 ++-- src/test/rustdoc-ui/intra-links-warning.rs | 33 +++++++++++------- .../rustdoc-ui/intra-links-warning.stderr | 34 +++++++++---------- src/test/rustdoc-ui/invalid-syntax.rs | 13 ++++++- src/test/rustdoc-ui/invalid-syntax.stderr | 20 +++++------ 6 files changed, 67 insertions(+), 46 deletions(-) diff --git a/src/test/rustdoc-ui/intra-links-warning-crlf.rs b/src/test/rustdoc-ui/intra-links-warning-crlf.rs index 67bd9f73eeb5b..ccd2841ff0be3 100644 --- a/src/test/rustdoc-ui/intra-links-warning-crlf.rs +++ b/src/test/rustdoc-ui/intra-links-warning-crlf.rs @@ -1,19 +1,21 @@ // ignore-tidy-cr - -// build-pass (FIXME(62277): could be check-pass?) +// build-pass // This file checks the spans of intra-link warnings in a file with CRLF line endings. The // .gitattributes file in this directory should enforce it. /// [error] pub struct A; +//~^^ WARNING `[error]` cannot be resolved /// /// docs [error1] +//~^ WARNING `[error1]` cannot be resolved /// docs [error2] /// pub struct B; +//~^^^ WARNING `[error2]` cannot be resolved /** * This is a multi-line comment. @@ -21,3 +23,4 @@ pub struct B; * It also has an [error]. */ pub struct C; +//~^^^ WARNING `[error]` cannot be resolved diff --git a/src/test/rustdoc-ui/intra-links-warning-crlf.stderr b/src/test/rustdoc-ui/intra-links-warning-crlf.stderr index 720f2106e3dc2..b4e11c29ed5ac 100644 --- a/src/test/rustdoc-ui/intra-links-warning-crlf.stderr +++ b/src/test/rustdoc-ui/intra-links-warning-crlf.stderr @@ -1,5 +1,5 @@ warning: `[error]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning-crlf.rs:8:6 + --> $DIR/intra-links-warning-crlf.rs:7:6 | LL | /// [error] | ^^^^^ cannot be resolved, ignoring @@ -16,7 +16,7 @@ LL | /// docs [error1] = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[error2]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning-crlf.rs:14:11 + --> $DIR/intra-links-warning-crlf.rs:15:11 | LL | /// docs [error2] | ^^^^^^ cannot be resolved, ignoring @@ -24,7 +24,7 @@ LL | /// docs [error2] = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[error]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning-crlf.rs:21:20 + --> $DIR/intra-links-warning-crlf.rs:23:20 | LL | * It also has an [error]. | ^^^^^ cannot be resolved, ignoring diff --git a/src/test/rustdoc-ui/intra-links-warning.rs b/src/test/rustdoc-ui/intra-links-warning.rs index 20770efa95315..b0c637521f9ae 100644 --- a/src/test/rustdoc-ui/intra-links-warning.rs +++ b/src/test/rustdoc-ui/intra-links-warning.rs @@ -1,30 +1,37 @@ -// build-pass (FIXME(62277): could be check-pass?) +// build-pass //! Test with [Foo::baz], [Bar::foo], ... +//~^ WARNING `[Foo::baz]` cannot be resolved +//~| WARNING `[Bar::foo]` cannot be resolved //! , [Uniooon::X] and [Qux::Z]. +//~^ WARNING `[Uniooon::X]` cannot be resolved +//~| WARNING `[Qux::Z]` cannot be resolved //! //! , [Uniooon::X] and [Qux::Z]. +//~^ WARNING `[Uniooon::X]` cannot be resolved +//~| WARNING `[Qux::Z]` cannot be resolved /// [Qux:Y] +//~^ WARNING `[Qux:Y]` cannot be resolved pub struct Foo { pub bar: usize, } /// Foo -/// bar [BarA] bar +/// bar [BarA] bar //~ WARNING `[BarA]` cannot be resolved /// baz pub fn a() {} /** * Foo - * bar [BarB] bar + * bar [BarB] bar //~ WARNING `[BarB]` cannot be resolved * baz */ pub fn b() {} /** Foo -bar [BarC] bar +bar [BarC] bar //~ WARNING `[BarC]` cannot be resolved baz let bar_c_1 = 0; @@ -35,12 +42,12 @@ baz */ pub fn c() {} -#[doc = "Foo\nbar [BarD] bar\nbaz"] +#[doc = "Foo\nbar [BarD] bar\nbaz"] //~ WARNING `[BarD]` cannot be resolved pub fn d() {} macro_rules! f { ($f:expr) => { - #[doc = $f] + #[doc = $f] //~ WARNING `[BarF]` cannot be resolved pub fn f() {} } } @@ -48,30 +55,30 @@ f!("Foo\nbar [BarF] bar\nbaz"); /** # for example, * - * time to introduce a link [error]*/ + * time to introduce a link [error]*/ //~ WARNING `[error]` cannot be resolved pub struct A; /** * # for example, * - * time to introduce a link [error] + * time to introduce a link [error] //~ WARNING `[error]` cannot be resolved */ pub struct B; -#[doc = "single line [error]"] +#[doc = "single line [error]"] //~ WARNING `[error]` cannot be resolved pub struct C; -#[doc = "single line with \"escaping\" [error]"] +#[doc = "single line with \"escaping\" [error]"] //~ WARNING `[error]` cannot be resolved pub struct D; -/// Item docs. +/// Item docs. //~ WARNING `[error]` cannot be resolved #[doc="Hello there!"] /// [error] pub struct E; /// -/// docs [error1] +/// docs [error1] //~ WARNING `[error1]` cannot be resolved -/// docs [error2] +/// docs [error2] //~ WARNING `[error2]` cannot be resolved /// pub struct F; diff --git a/src/test/rustdoc-ui/intra-links-warning.stderr b/src/test/rustdoc-ui/intra-links-warning.stderr index dac564b304143..27cc3aeb08100 100644 --- a/src/test/rustdoc-ui/intra-links-warning.stderr +++ b/src/test/rustdoc-ui/intra-links-warning.stderr @@ -16,7 +16,7 @@ LL | //! Test with [Foo::baz], [Bar::foo], ... = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[Uniooon::X]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:4:13 + --> $DIR/intra-links-warning.rs:6:13 | LL | //! , [Uniooon::X] and [Qux::Z]. | ^^^^^^^^^^ cannot be resolved, ignoring @@ -24,7 +24,7 @@ LL | //! , [Uniooon::X] and [Qux::Z]. = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[Qux::Z]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:4:30 + --> $DIR/intra-links-warning.rs:6:30 | LL | //! , [Uniooon::X] and [Qux::Z]. | ^^^^^^ cannot be resolved, ignoring @@ -32,7 +32,7 @@ LL | //! , [Uniooon::X] and [Qux::Z]. = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[Uniooon::X]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:6:14 + --> $DIR/intra-links-warning.rs:10:14 | LL | //! , [Uniooon::X] and [Qux::Z]. | ^^^^^^^^^^ cannot be resolved, ignoring @@ -40,7 +40,7 @@ LL | //! , [Uniooon::X] and [Qux::Z]. = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[Qux::Z]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:6:31 + --> $DIR/intra-links-warning.rs:10:31 | LL | //! , [Uniooon::X] and [Qux::Z]. | ^^^^^^ cannot be resolved, ignoring @@ -48,7 +48,7 @@ LL | //! , [Uniooon::X] and [Qux::Z]. = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[Qux:Y]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:8:13 + --> $DIR/intra-links-warning.rs:14:13 | LL | /// [Qux:Y] | ^^^^^ cannot be resolved, ignoring @@ -56,7 +56,7 @@ LL | /// [Qux:Y] = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[error]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:51:30 + --> $DIR/intra-links-warning.rs:58:30 | LL | * time to introduce a link [error]*/ | ^^^^^ cannot be resolved, ignoring @@ -64,7 +64,7 @@ LL | * time to introduce a link [error]*/ = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[error]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:57:30 + --> $DIR/intra-links-warning.rs:64:30 | LL | * time to introduce a link [error] | ^^^^^ cannot be resolved, ignoring @@ -72,7 +72,7 @@ LL | * time to introduce a link [error] = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[error]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:61:1 + --> $DIR/intra-links-warning.rs:68:1 | LL | #[doc = "single line [error]"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -84,7 +84,7 @@ LL | #[doc = "single line [error]"] = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[error]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:64:1 + --> $DIR/intra-links-warning.rs:71:1 | LL | #[doc = "single line with \"escaping\" [error]"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -96,7 +96,7 @@ LL | #[doc = "single line with \"escaping\" [error]"] = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[error]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:67:1 + --> $DIR/intra-links-warning.rs:74:1 | LL | / /// Item docs. LL | | #[doc="Hello there!"] @@ -110,7 +110,7 @@ LL | | /// [error] = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[error1]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:73:11 + --> $DIR/intra-links-warning.rs:80:11 | LL | /// docs [error1] | ^^^^^^ cannot be resolved, ignoring @@ -118,7 +118,7 @@ LL | /// docs [error1] = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[error2]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:75:11 + --> $DIR/intra-links-warning.rs:82:11 | LL | /// docs [error2] | ^^^^^^ cannot be resolved, ignoring @@ -126,7 +126,7 @@ LL | /// docs [error2] = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[BarA]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:14:10 + --> $DIR/intra-links-warning.rs:21:10 | LL | /// bar [BarA] bar | ^^^^ cannot be resolved, ignoring @@ -134,7 +134,7 @@ LL | /// bar [BarA] bar = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[BarB]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:20:9 + --> $DIR/intra-links-warning.rs:27:9 | LL | * bar [BarB] bar | ^^^^ cannot be resolved, ignoring @@ -142,7 +142,7 @@ LL | * bar [BarB] bar = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[BarC]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:27:6 + --> $DIR/intra-links-warning.rs:34:6 | LL | bar [BarC] bar | ^^^^ cannot be resolved, ignoring @@ -150,7 +150,7 @@ LL | bar [BarC] bar = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[BarD]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:38:1 + --> $DIR/intra-links-warning.rs:45:1 | LL | #[doc = "Foo\nbar [BarD] bar\nbaz"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -162,7 +162,7 @@ LL | #[doc = "Foo\nbar [BarD] bar\nbaz"] = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]` warning: `[BarF]` cannot be resolved, ignoring it... - --> $DIR/intra-links-warning.rs:43:9 + --> $DIR/intra-links-warning.rs:50:9 | LL | #[doc = $f] | ^^^^^^^^^^^ diff --git a/src/test/rustdoc-ui/invalid-syntax.rs b/src/test/rustdoc-ui/invalid-syntax.rs index 97a0f4aaec1eb..34e92c421047d 100644 --- a/src/test/rustdoc-ui/invalid-syntax.rs +++ b/src/test/rustdoc-ui/invalid-syntax.rs @@ -1,9 +1,10 @@ -// build-pass (FIXME(62277): could be check-pass?) +// build-pass /// ``` /// \__________pkt->size___________/ \_result->size_/ \__pkt->size__/ /// ``` pub fn foo() {} +//~^^^^ WARNING could not parse code block as Rust code /// ``` /// | @@ -11,6 +12,7 @@ pub fn foo() {} /// | ^^^^^^ did you mean `baz::foobar`? /// ``` pub fn bar() {} +//~^^^^^^ WARNING could not parse code block as Rust code /// ``` /// valid @@ -24,6 +26,7 @@ pub fn bar() {} /// "invalid /// ``` pub fn valid_and_invalid() {} +//~^^^^^^^^ WARNING could not parse code block as Rust code /// This is a normal doc comment, but... /// @@ -35,6 +38,7 @@ pub fn valid_and_invalid() {} /// /// Good thing we tested it! pub fn baz() {} +//~^^^^^^ WARNING could not parse code block as Rust code /// Indented block start /// @@ -43,6 +47,7 @@ pub fn baz() {} /// /// Indented block end pub fn quux() {} +//~^^^^^ could not parse code block as Rust code /// Unclosed fence /// @@ -54,26 +59,31 @@ pub fn xyzzy() {} /// /// ``` pub fn blah() {} +//~^^ WARNING could not parse code block as Rust code /// ```edition2018 /// \_ /// ``` pub fn blargh() {} +//~^^^^ WARNING could not parse code block as Rust code #[doc = "```"] /// \_ #[doc = "```"] pub fn crazy_attrs() {} +//~^^^^ WARNING doc comment contains an invalid Rust code block /// ```rust /// ``` pub fn empty_rust() {} +//~^^^ WARNING Rust code block is empty /// ``` /// /// /// ``` pub fn empty_rust_with_whitespace() {} +//~^^^^^ WARNING Rust code block is empty /// ``` /// let x = 1; @@ -82,3 +92,4 @@ pub fn empty_rust_with_whitespace() {} /// \____/ /// pub fn indent_after_fenced() {} +//~^^^ WARNING could not parse code block as Rust code diff --git a/src/test/rustdoc-ui/invalid-syntax.stderr b/src/test/rustdoc-ui/invalid-syntax.stderr index 84c10028fd1f9..fe5442163ea72 100644 --- a/src/test/rustdoc-ui/invalid-syntax.stderr +++ b/src/test/rustdoc-ui/invalid-syntax.stderr @@ -53,7 +53,7 @@ help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it | ^ warning: could not parse code block as Rust code - --> $DIR/invalid-syntax.rs:8:5 + --> $DIR/invalid-syntax.rs:9:5 | LL | /// ``` | _____^ @@ -75,7 +75,7 @@ error: unknown start of token: \ | ^ warning: could not parse code block as Rust code - --> $DIR/invalid-syntax.rs:19:5 + --> $DIR/invalid-syntax.rs:21:5 | LL | /// ``` | _____^ @@ -95,7 +95,7 @@ error: unknown start of token: \ | ^ warning: could not parse code block as Rust code - --> $DIR/invalid-syntax.rs:32:5 + --> $DIR/invalid-syntax.rs:35:5 | LL | /// ```rust | _____^ @@ -110,7 +110,7 @@ error: unknown start of token: \ | ^ warning: could not parse code block as Rust code - --> $DIR/invalid-syntax.rs:41:9 + --> $DIR/invalid-syntax.rs:45:9 | LL | /// code with bad syntax | _________^ @@ -151,7 +151,7 @@ help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it | ^ warning: could not parse code block as Rust code - --> $DIR/invalid-syntax.rs:55:9 + --> $DIR/invalid-syntax.rs:60:9 | LL | /// ``` | ^^^ @@ -163,7 +163,7 @@ error: unknown start of token: \ | ^ warning: could not parse code block as Rust code - --> $DIR/invalid-syntax.rs:58:5 + --> $DIR/invalid-syntax.rs:64:5 | LL | /// ```edition2018 | _____^ @@ -178,7 +178,7 @@ error: unknown start of token: \ | ^ warning: doc comment contains an invalid Rust code block - --> $DIR/invalid-syntax.rs:63:1 + --> $DIR/invalid-syntax.rs:70:1 | LL | / #[doc = "```"] LL | | /// \_ @@ -188,7 +188,7 @@ LL | | #[doc = "```"] = help: mark blocks that do not contain Rust code as text: ```text warning: Rust code block is empty - --> $DIR/invalid-syntax.rs:68:5 + --> $DIR/invalid-syntax.rs:76:5 | LL | /// ```rust | _____^ @@ -196,7 +196,7 @@ LL | | /// ``` | |_______^ warning: Rust code block is empty - --> $DIR/invalid-syntax.rs:72:5 + --> $DIR/invalid-syntax.rs:81:5 | LL | /// ``` | _____^ @@ -217,7 +217,7 @@ error: unknown start of token: \ | ^ warning: could not parse code block as Rust code - --> $DIR/invalid-syntax.rs:82:9 + --> $DIR/invalid-syntax.rs:92:9 | LL | /// \____/ | ^^^^^^ From 427952e8088233576102a1cc32f67183d22e922b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Wed, 6 Nov 2019 00:00:00 +0000 Subject: [PATCH 3/3] Make error and warning annotations mandatory in UI tests This change makes error and warning annotations mandatory in UI tests. The only exception are tests that use error patterns to match compiler output and don't have any annotations. --- .../ui/associated-type-bounds/dyn-lcsit.rs | 2 +- src/test/ui/associated-type-bounds/lcsit.rs | 2 +- .../ui/associated-type-bounds/type-alias.rs | 26 ++++----- .../issues/issue-54752-async-block.rs | 1 + src/test/ui/block-expr-precedence.rs | 1 + src/test/ui/codemap_tests/unicode_3.rs | 2 +- src/test/ui/consts/const-eval/const_fn_ptr.rs | 8 +-- .../ui/consts/const-eval/const_fn_ptr.stderr | 10 +--- src/test/ui/consts/const-eval/issue-64970.rs | 2 +- .../ui/consts/const-eval/issue-64970.stderr | 8 --- .../miri_unleashed/enum_discriminants.rs | 6 ++- src/test/ui/consts/packed_pattern.rs | 2 +- src/test/ui/consts/packed_pattern2.rs | 2 +- .../ui/deprecation/deprecation-in-future.rs | 1 + src/test/ui/extern/extern-prelude-core.rs | 2 +- src/test/ui/extern/extern-prelude-core.stderr | 8 --- src/test/ui/extern/extern-prelude-std.rs | 1 - src/test/ui/extern/extern-prelude-std.stderr | 8 --- src/test/ui/hygiene/dollar-crate-modern.rs | 2 +- .../ui/hygiene/dollar-crate-modern.stderr | 8 --- src/test/ui/hygiene/generic_params.rs | 1 + src/test/ui/hygiene/hygienic-labels-in-let.rs | 28 ++++++++++ .../ui/hygiene/hygienic-labels-in-let.stderr | 54 +++++++++---------- src/test/ui/hygiene/hygienic-labels.rs | 31 +++++++++++ src/test/ui/hygiene/hygienic-labels.stderr | 53 +++++++++--------- .../hygiene/issue-61574-const-parameters.rs | 2 +- src/test/ui/if-ret.rs | 2 +- .../inference-variable-behind-raw-pointer.rs | 4 +- .../issues/issue-33140-traitobject-crate.rs | 6 +++ .../issue-33140-traitobject-crate.stderr | 7 +-- src/test/ui/issues/issue-39720.rs | 4 +- src/test/ui/issues/issue-52057.rs | 1 - src/test/ui/issues/issue-52057.stderr | 8 --- .../issue-57399-self-return-impl-trait.rs | 2 +- .../issue-57399-self-return-impl-trait.stderr | 8 --- .../ui/lint/command-line-lint-group-warn.rs | 3 +- ...47390-unused-variable-in-struct-pattern.rs | 27 ++++++---- ...0-unused-variable-in-struct-pattern.stderr | 26 ++++----- src/test/ui/lint/must-use-ops.rs | 44 +++++++-------- src/test/ui/lint/not_found.rs | 10 +++- src/test/ui/lint/not_found.stderr | 4 +- src/test/ui/lint/unreachable_pub-pub_crate.rs | 29 +++++----- .../ui/lint/unreachable_pub-pub_crate.stderr | 10 ++-- src/test/ui/lint/unreachable_pub.rs | 28 +++++----- src/test/ui/lint/unreachable_pub.stderr | 26 ++++----- .../lint/unused_import_warning_issue_45268.rs | 1 + .../macros/macro-lifetime-used-with-labels.rs | 2 +- src/test/ui/macros/macro-path-prelude-pass.rs | 4 +- .../ui/macros/macro-path-prelude-pass.stderr | 8 --- src/test/ui/macros/macro-use-all-and-none.rs | 2 +- .../or-patterns/or-patterns-syntactic-pass.rs | 2 +- src/test/ui/removing-extern-crate.fixed | 11 ++-- src/test/ui/removing-extern-crate.rs | 11 ++-- src/test/ui/removing-extern-crate.stderr | 8 +-- .../protect-precedences.rs | 2 +- .../ui/rust-2018/remove-extern-crate.fixed | 4 +- src/test/ui/rust-2018/remove-extern-crate.rs | 4 +- src/test/ui/rust-2018/try-ident.fixed | 4 ++ src/test/ui/rust-2018/try-ident.rs | 4 ++ src/test/ui/rust-2018/try-ident.stderr | 2 +- src/test/ui/rust-2018/try-macro.fixed | 5 +- src/test/ui/rust-2018/try-macro.rs | 5 +- src/test/ui/rust-2018/try-macro.stderr | 2 +- src/test/ui/test-attrs/test-on-macro.rs | 4 +- .../trivial-bounds-inconsistent-copy.rs | 10 ++-- .../trivial-bounds-inconsistent-copy.stderr | 8 +-- .../trivial-bounds-inconsistent-projection.rs | 10 ++-- ...vial-bounds-inconsistent-projection.stderr | 4 +- .../trivial-bounds-inconsistent-sized.rs | 3 ++ .../trivial-bounds-inconsistent-sized.stderr | 4 +- ...trivial-bounds-inconsistent-well-formed.rs | 2 + .../trivial-bounds-inconsistent.rs | 25 +++++---- .../trivial-bounds-inconsistent.stderr | 16 +++--- .../try-block-unreachable-code-lint.rs | 6 +-- src/tools/compiletest/src/runtest.rs | 13 ++++- 75 files changed, 380 insertions(+), 326 deletions(-) delete mode 100644 src/test/ui/consts/const-eval/issue-64970.stderr delete mode 100644 src/test/ui/extern/extern-prelude-core.stderr delete mode 100644 src/test/ui/extern/extern-prelude-std.stderr delete mode 100644 src/test/ui/hygiene/dollar-crate-modern.stderr delete mode 100644 src/test/ui/issues/issue-52057.stderr delete mode 100644 src/test/ui/issues/issue-57399-self-return-impl-trait.stderr delete mode 100644 src/test/ui/macros/macro-path-prelude-pass.stderr diff --git a/src/test/ui/associated-type-bounds/dyn-lcsit.rs b/src/test/ui/associated-type-bounds/dyn-lcsit.rs index 439304fd309c8..c936fe0550ac9 100644 --- a/src/test/ui/associated-type-bounds/dyn-lcsit.rs +++ b/src/test/ui/associated-type-bounds/dyn-lcsit.rs @@ -2,7 +2,7 @@ #![feature(associated_type_bounds)] #![feature(impl_trait_in_bindings)] - +//~^ WARNING `impl_trait_in_bindings` is incomplete #![allow(non_upper_case_globals)] use std::ops::Add; diff --git a/src/test/ui/associated-type-bounds/lcsit.rs b/src/test/ui/associated-type-bounds/lcsit.rs index 85b6e804b4ef6..497205f9f189a 100644 --- a/src/test/ui/associated-type-bounds/lcsit.rs +++ b/src/test/ui/associated-type-bounds/lcsit.rs @@ -2,7 +2,7 @@ #![feature(associated_type_bounds)] #![feature(impl_trait_in_bindings)] - +//~^ WARNING `impl_trait_in_bindings` is incomplete #![allow(non_upper_case_globals)] use std::ops::Add; diff --git a/src/test/ui/associated-type-bounds/type-alias.rs b/src/test/ui/associated-type-bounds/type-alias.rs index 34bc0c9acbf4c..f74c5ff1eddfc 100644 --- a/src/test/ui/associated-type-bounds/type-alias.rs +++ b/src/test/ui/associated-type-bounds/type-alias.rs @@ -1,19 +1,19 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass #![feature(associated_type_bounds)] -type _TaWhere1 where T: Iterator = T; -type _TaWhere2 where T: Iterator = T; -type _TaWhere3 where T: Iterator = T; -type _TaWhere4 where T: Iterator = T; -type _TaWhere5 where T: Iterator Into<&'a u8>> = T; -type _TaWhere6 where T: Iterator> = T; +type _TaWhere1 where T: Iterator = T; //~ WARNING type_alias_bounds +type _TaWhere2 where T: Iterator = T; //~ WARNING type_alias_bounds +type _TaWhere3 where T: Iterator = T; //~ WARNING type_alias_bounds +type _TaWhere4 where T: Iterator = T; //~ WARNING type_alias_bounds +type _TaWhere5 where T: Iterator Into<&'a u8>> = T; //~ WARNING type_alias_bounds +type _TaWhere6 where T: Iterator> = T; //~ WARNING type_alias_bounds -type _TaInline1> = T; -type _TaInline2> = T; -type _TaInline3> = T; -type _TaInline4> = T; -type _TaInline5 Into<&'a u8>>> = T; -type _TaInline6>> = T; +type _TaInline1> = T; //~ WARNING type_alias_bounds +type _TaInline2> = T; //~ WARNING type_alias_bounds +type _TaInline3> = T; //~ WARNING type_alias_bounds +type _TaInline4> = T; //~ WARNING type_alias_bounds +type _TaInline5 Into<&'a u8>>> = T; //~ WARNING type_alias_bounds +type _TaInline6>> = T; //~ WARNING type_alias_bounds fn main() {} diff --git a/src/test/ui/async-await/issues/issue-54752-async-block.rs b/src/test/ui/async-await/issues/issue-54752-async-block.rs index 64f260cfe01b6..c2840d7386f98 100644 --- a/src/test/ui/async-await/issues/issue-54752-async-block.rs +++ b/src/test/ui/async-await/issues/issue-54752-async-block.rs @@ -4,3 +4,4 @@ // pp-exact fn main() { let _a = (async { }); } +//~^ WARNING unnecessary parentheses around assigned value diff --git a/src/test/ui/block-expr-precedence.rs b/src/test/ui/block-expr-precedence.rs index d31eecda9bb3d..13b2fe9c3d1a9 100644 --- a/src/test/ui/block-expr-precedence.rs +++ b/src/test/ui/block-expr-precedence.rs @@ -58,4 +58,5 @@ pub fn main() { if (true) { 12; } {-num}; if (true) { 12; }; {-num}; if (true) { 12; };;; -num; + //~^ WARNING unnecessary trailing semicolons } diff --git a/src/test/ui/codemap_tests/unicode_3.rs b/src/test/ui/codemap_tests/unicode_3.rs index b9bcc1b88a336..3994d3186817d 100644 --- a/src/test/ui/codemap_tests/unicode_3.rs +++ b/src/test/ui/codemap_tests/unicode_3.rs @@ -1,6 +1,6 @@ // build-pass (FIXME(62277): could be check-pass?) fn main() { - let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; while true { break; } + let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; while true { break; } //~ WARNING while_true println!("{}", s); } diff --git a/src/test/ui/consts/const-eval/const_fn_ptr.rs b/src/test/ui/consts/const-eval/const_fn_ptr.rs index 498f801db81b8..9b94b45f52264 100644 --- a/src/test/ui/consts/const-eval/const_fn_ptr.rs +++ b/src/test/ui/consts/const-eval/const_fn_ptr.rs @@ -6,18 +6,18 @@ fn double(x: usize) -> usize { x * 2 } const fn double_const(x: usize) -> usize { x * 2 } const X: fn(usize) -> usize = double; -const X_const: fn(usize) -> usize = double_const; +const X_CONST: fn(usize) -> usize = double_const; const fn bar(x: usize) -> usize { - X(x) + X(x) //~ WARNING skipping const checks } const fn bar_const(x: usize) -> usize { - X_const(x) + X_CONST(x) //~ WARNING skipping const checks } const fn foo(x: fn(usize) -> usize, y: usize) -> usize { - x(y) + x(y) //~ WARNING skipping const checks } fn main() { diff --git a/src/test/ui/consts/const-eval/const_fn_ptr.stderr b/src/test/ui/consts/const-eval/const_fn_ptr.stderr index 2fbb19322442b..19fa39603460b 100644 --- a/src/test/ui/consts/const-eval/const_fn_ptr.stderr +++ b/src/test/ui/consts/const-eval/const_fn_ptr.stderr @@ -7,7 +7,7 @@ LL | X(x) warning: skipping const checks --> $DIR/const_fn_ptr.rs:16:5 | -LL | X_const(x) +LL | X_CONST(x) | ^^^^^^^^^^ warning: skipping const checks @@ -16,11 +16,3 @@ warning: skipping const checks LL | x(y) | ^^^^ -warning: constant `X_const` should have an upper case name - --> $DIR/const_fn_ptr.rs:9:7 - | -LL | const X_const: fn(usize) -> usize = double_const; - | ^^^^^^^ help: convert the identifier to upper case: `X_CONST` - | - = note: `#[warn(non_upper_case_globals)]` on by default - diff --git a/src/test/ui/consts/const-eval/issue-64970.rs b/src/test/ui/consts/const-eval/issue-64970.rs index ede5081c8a5c2..ba530438f9a1d 100644 --- a/src/test/ui/consts/const-eval/issue-64970.rs +++ b/src/test/ui/consts/const-eval/issue-64970.rs @@ -10,6 +10,6 @@ fn foo(mut n: i32) { } if n > 0i32 { - 1i32 / n; + let _ = 1i32 / n; } } diff --git a/src/test/ui/consts/const-eval/issue-64970.stderr b/src/test/ui/consts/const-eval/issue-64970.stderr deleted file mode 100644 index 2c44b68cbd1d1..0000000000000 --- a/src/test/ui/consts/const-eval/issue-64970.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: unused arithmetic operation that must be used - --> $DIR/issue-64970.rs:13:9 - | -LL | 1i32 / n; - | ^^^^^^^^ - | - = note: `#[warn(unused_must_use)]` on by default - diff --git a/src/test/ui/consts/miri_unleashed/enum_discriminants.rs b/src/test/ui/consts/miri_unleashed/enum_discriminants.rs index 9f34fc73953a4..623fa2a1547c8 100644 --- a/src/test/ui/consts/miri_unleashed/enum_discriminants.rs +++ b/src/test/ui/consts/miri_unleashed/enum_discriminants.rs @@ -20,9 +20,9 @@ const OVERFLOW: usize = { C(WithWraparoundInvalidValues), } - let x = Foo::B; + let x = Foo::B; //~ WARNING skipping const checks match x { - Foo::B => 0, + Foo::B => 0, //~ WARNING skipping const checks _ => panic!(), } }; @@ -86,6 +86,8 @@ const MORE_OVERFLOW: usize = { } if let E1::V2 { .. } = (E1::V1 { f: true }) { + //~^ WARNING skipping const checks + //~| WARNING skipping const checks unreachable!() } if let E1::V1 { .. } = (E1::V1 { f: true }) { diff --git a/src/test/ui/consts/packed_pattern.rs b/src/test/ui/consts/packed_pattern.rs index 37ae45b6df7ea..370fec6fbd4be 100644 --- a/src/test/ui/consts/packed_pattern.rs +++ b/src/test/ui/consts/packed_pattern.rs @@ -13,7 +13,7 @@ const FOO: Foo = Foo { fn main() { match FOO { Foo { field: (5, 6, 7, 8) } => {}, - FOO => unreachable!(), + FOO => unreachable!(), //~ WARNING unreachable pattern _ => unreachable!(), } } diff --git a/src/test/ui/consts/packed_pattern2.rs b/src/test/ui/consts/packed_pattern2.rs index 174161fbd9460..ef68d9e513aae 100644 --- a/src/test/ui/consts/packed_pattern2.rs +++ b/src/test/ui/consts/packed_pattern2.rs @@ -21,7 +21,7 @@ const FOO: Bar = Bar { fn main() { match FOO { Bar { a: Foo { field: (5, 6) } } => {}, - FOO => unreachable!(), + FOO => unreachable!(), //~ WARNING unreachable pattern _ => unreachable!(), } } diff --git a/src/test/ui/deprecation/deprecation-in-future.rs b/src/test/ui/deprecation/deprecation-in-future.rs index 464ddcc4cdb94..bfeab49548f0e 100644 --- a/src/test/ui/deprecation/deprecation-in-future.rs +++ b/src/test/ui/deprecation/deprecation-in-future.rs @@ -7,6 +7,7 @@ pub fn deprecated_future() {} fn test() { deprecated_future(); // ok; deprecated_in_future only applies to rustc_deprecated + //~^ WARNING use of deprecated item 'deprecated_future': text [deprecated] } fn main() {} diff --git a/src/test/ui/extern/extern-prelude-core.rs b/src/test/ui/extern/extern-prelude-core.rs index f0d43404b0046..56206425f84c2 100644 --- a/src/test/ui/extern/extern-prelude-core.rs +++ b/src/test/ui/extern/extern-prelude-core.rs @@ -1,5 +1,5 @@ // run-pass -#![feature(extern_prelude, lang_items, start)] +#![feature(lang_items, start)] #![no_std] extern crate std as other; diff --git a/src/test/ui/extern/extern-prelude-core.stderr b/src/test/ui/extern/extern-prelude-core.stderr deleted file mode 100644 index f90eb933d3fd8..0000000000000 --- a/src/test/ui/extern/extern-prelude-core.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable - --> $DIR/extern-prelude-core.rs:2:12 - | -LL | #![feature(extern_prelude, lang_items, start)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(stable_features)]` on by default - diff --git a/src/test/ui/extern/extern-prelude-std.rs b/src/test/ui/extern/extern-prelude-std.rs index 3d28448ee863e..b5627fad960b2 100644 --- a/src/test/ui/extern/extern-prelude-std.rs +++ b/src/test/ui/extern/extern-prelude-std.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(extern_prelude)] mod foo { pub fn test() { diff --git a/src/test/ui/extern/extern-prelude-std.stderr b/src/test/ui/extern/extern-prelude-std.stderr deleted file mode 100644 index 73b1dcfd5e1b8..0000000000000 --- a/src/test/ui/extern/extern-prelude-std.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable - --> $DIR/extern-prelude-std.rs:2:12 - | -LL | #![feature(extern_prelude)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(stable_features)]` on by default - diff --git a/src/test/ui/hygiene/dollar-crate-modern.rs b/src/test/ui/hygiene/dollar-crate-modern.rs index a432fb6eee17a..eb176fed87c00 100644 --- a/src/test/ui/hygiene/dollar-crate-modern.rs +++ b/src/test/ui/hygiene/dollar-crate-modern.rs @@ -3,7 +3,7 @@ // check-pass // aux-build:intercrate.rs -#![feature(decl_macro, crate_in_paths)] +#![feature(decl_macro)] extern crate intercrate; diff --git a/src/test/ui/hygiene/dollar-crate-modern.stderr b/src/test/ui/hygiene/dollar-crate-modern.stderr deleted file mode 100644 index cd40df16ba7d1..0000000000000 --- a/src/test/ui/hygiene/dollar-crate-modern.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer requires an attribute to enable - --> $DIR/dollar-crate-modern.rs:6:24 - | -LL | #![feature(decl_macro, crate_in_paths)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(stable_features)]` on by default - diff --git a/src/test/ui/hygiene/generic_params.rs b/src/test/ui/hygiene/generic_params.rs index 9dc5adfce478a..d319ae6403fc5 100644 --- a/src/test/ui/hygiene/generic_params.rs +++ b/src/test/ui/hygiene/generic_params.rs @@ -4,6 +4,7 @@ // ignore-pretty pretty-printing is unhygienic #![feature(decl_macro, rustc_attrs, const_generics)] +//~^ WARNING the feature `const_generics` is incomplete mod type_params { macro m($T:ident) { diff --git a/src/test/ui/hygiene/hygienic-labels-in-let.rs b/src/test/ui/hygiene/hygienic-labels-in-let.rs index fb9523b547d2e..5d22cf857b7a1 100644 --- a/src/test/ui/hygiene/hygienic-labels-in-let.rs +++ b/src/test/ui/hygiene/hygienic-labels-in-let.rs @@ -13,6 +13,10 @@ macro_rules! loop_x { ($e: expr) => { // $e shouldn't be able to interact with this 'x 'x: loop { $e } + //~^ WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope } } @@ -20,6 +24,11 @@ macro_rules! while_true { ($e: expr) => { // $e shouldn't be able to interact with this 'x 'x: while 1 + 1 == 2 { $e } + //~^ WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope } } @@ -27,6 +36,13 @@ macro_rules! run_once { ($e: expr) => { // ditto 'x: for _ in 0..1 { $e } + //~^ WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope } } @@ -45,6 +61,8 @@ pub fn main() { let k: isize = { 'x: for _ in 0..1 { + //~^ WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope // ditto loop_x!(break 'x); i += 1; @@ -55,6 +73,10 @@ pub fn main() { let l: isize = { 'x: for _ in 0..1 { + //~^ WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope // ditto while_true!(break 'x); i += 1; @@ -65,6 +87,12 @@ pub fn main() { let n: isize = { 'x: for _ in 0..1 { + //~^ WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope // ditto run_once!(continue 'x); i += 1; diff --git a/src/test/ui/hygiene/hygienic-labels-in-let.stderr b/src/test/ui/hygiene/hygienic-labels-in-let.stderr index 9c906749f8c84..d88470f32a3e0 100644 --- a/src/test/ui/hygiene/hygienic-labels-in-let.stderr +++ b/src/test/ui/hygiene/hygienic-labels-in-let.stderr @@ -11,7 +11,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:47:9 + --> $DIR/hygienic-labels-in-let.rs:63:9 | LL | 'x: loop { | -- first declared here @@ -20,7 +20,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:47:9 + --> $DIR/hygienic-labels-in-let.rs:63:9 | LL | 'x: loop { $e } | -- first declared here @@ -60,12 +60,12 @@ LL | 'x: loop { $e } ... LL | 'x: for _ in 0..1 { | -- first declared here -LL | // ditto +... LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:57:9 + --> $DIR/hygienic-labels-in-let.rs:75:9 | LL | 'x: loop { | -- first declared here @@ -74,7 +74,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:57:9 + --> $DIR/hygienic-labels-in-let.rs:75:9 | LL | 'x: loop { $e } | -- first declared here @@ -83,7 +83,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:57:9 + --> $DIR/hygienic-labels-in-let.rs:75:9 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -92,7 +92,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:57:9 + --> $DIR/hygienic-labels-in-let.rs:75:9 | LL | 'x: loop { $e } | -- first declared here @@ -101,7 +101,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:22:9 + --> $DIR/hygienic-labels-in-let.rs:26:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -113,7 +113,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:22:9 + --> $DIR/hygienic-labels-in-let.rs:26:9 | LL | 'x: loop { $e } | -- first declared here @@ -125,7 +125,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:22:9 + --> $DIR/hygienic-labels-in-let.rs:26:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -137,7 +137,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:22:9 + --> $DIR/hygienic-labels-in-let.rs:26:9 | LL | 'x: loop { $e } | -- first declared here @@ -149,19 +149,19 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:22:9 + --> $DIR/hygienic-labels-in-let.rs:26:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope ... LL | 'x: for _ in 0..1 { | -- first declared here -LL | // ditto +... LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:67:9 + --> $DIR/hygienic-labels-in-let.rs:89:9 | LL | 'x: loop { | -- first declared here @@ -170,7 +170,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:67:9 + --> $DIR/hygienic-labels-in-let.rs:89:9 | LL | 'x: loop { $e } | -- first declared here @@ -179,7 +179,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:67:9 + --> $DIR/hygienic-labels-in-let.rs:89:9 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -188,7 +188,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:67:9 + --> $DIR/hygienic-labels-in-let.rs:89:9 | LL | 'x: loop { $e } | -- first declared here @@ -197,7 +197,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:67:9 + --> $DIR/hygienic-labels-in-let.rs:89:9 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -206,7 +206,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:67:9 + --> $DIR/hygienic-labels-in-let.rs:89:9 | LL | 'x: while 1 + 1 == 2 { $e } | -- first declared here @@ -215,7 +215,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:29:9 + --> $DIR/hygienic-labels-in-let.rs:38:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -227,7 +227,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:29:9 + --> $DIR/hygienic-labels-in-let.rs:38:9 | LL | 'x: loop { $e } | -- first declared here @@ -239,7 +239,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:29:9 + --> $DIR/hygienic-labels-in-let.rs:38:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -251,7 +251,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:29:9 + --> $DIR/hygienic-labels-in-let.rs:38:9 | LL | 'x: loop { $e } | -- first declared here @@ -263,7 +263,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:29:9 + --> $DIR/hygienic-labels-in-let.rs:38:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -275,7 +275,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:29:9 + --> $DIR/hygienic-labels-in-let.rs:38:9 | LL | 'x: while 1 + 1 == 2 { $e } | -- first declared here @@ -287,14 +287,14 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:29:9 + --> $DIR/hygienic-labels-in-let.rs:38:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope ... LL | 'x: for _ in 0..1 { | -- first declared here -LL | // ditto +... LL | run_once!(continue 'x); | ----------------------- in this macro invocation diff --git a/src/test/ui/hygiene/hygienic-labels.rs b/src/test/ui/hygiene/hygienic-labels.rs index a364dd9c88752..8eafb4c8d215a 100644 --- a/src/test/ui/hygiene/hygienic-labels.rs +++ b/src/test/ui/hygiene/hygienic-labels.rs @@ -10,6 +10,10 @@ macro_rules! loop_x { ($e: expr) => { // $e shouldn't be able to interact with this 'x 'x: loop { $e } + //~^ WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope } } @@ -17,6 +21,13 @@ macro_rules! run_once { ($e: expr) => { // ditto 'x: for _ in 0..1 { $e } + //~^ WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope } } @@ -24,6 +35,11 @@ macro_rules! while_x { ($e: expr) => { // ditto 'x: while 1 + 1 == 2 { $e } + //~^ WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope } } @@ -35,17 +51,32 @@ pub fn main() { } 'x: loop { + //~^ WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + // ditto loop_x!(break 'x); panic!("break doesn't act hygienically inside infinite loop"); } 'x: while 1 + 1 == 2 { + //~^ WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + while_x!(break 'x); panic!("break doesn't act hygienically inside infinite while loop"); } 'x: for _ in 0..1 { + //~^ WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + //~| WARNING shadows a label name that is already in scope + // ditto run_once!(continue 'x); panic!("continue doesn't act hygienically inside for loop"); diff --git a/src/test/ui/hygiene/hygienic-labels.stderr b/src/test/ui/hygiene/hygienic-labels.stderr index d88dfce540e0e..285e9037e977d 100644 --- a/src/test/ui/hygiene/hygienic-labels.stderr +++ b/src/test/ui/hygiene/hygienic-labels.stderr @@ -11,7 +11,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:37:5 + --> $DIR/hygienic-labels.rs:53:5 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -20,7 +20,7 @@ LL | 'x: loop { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:37:5 + --> $DIR/hygienic-labels.rs:53:5 | LL | 'x: loop { $e } | -- first declared here @@ -60,12 +60,12 @@ LL | 'x: loop { $e } ... LL | 'x: loop { | -- first declared here -LL | // ditto +... LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:43:5 + --> $DIR/hygienic-labels.rs:62:5 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -74,7 +74,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:43:5 + --> $DIR/hygienic-labels.rs:62:5 | LL | 'x: loop { $e } | -- first declared here @@ -83,7 +83,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:43:5 + --> $DIR/hygienic-labels.rs:62:5 | LL | 'x: loop { | -- first declared here @@ -92,7 +92,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:43:5 + --> $DIR/hygienic-labels.rs:62:5 | LL | 'x: loop { $e } | -- first declared here @@ -101,7 +101,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:26:9 + --> $DIR/hygienic-labels.rs:37:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -113,7 +113,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:26:9 + --> $DIR/hygienic-labels.rs:37:9 | LL | 'x: loop { $e } | -- first declared here @@ -125,7 +125,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:26:9 + --> $DIR/hygienic-labels.rs:37:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -137,7 +137,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:26:9 + --> $DIR/hygienic-labels.rs:37:9 | LL | 'x: loop { $e } | -- first declared here @@ -149,18 +149,19 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:26:9 + --> $DIR/hygienic-labels.rs:37:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope ... LL | 'x: while 1 + 1 == 2 { | -- first declared here +... LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:48:5 + --> $DIR/hygienic-labels.rs:72:5 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -169,7 +170,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:48:5 + --> $DIR/hygienic-labels.rs:72:5 | LL | 'x: loop { $e } | -- first declared here @@ -178,7 +179,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:48:5 + --> $DIR/hygienic-labels.rs:72:5 | LL | 'x: loop { | -- first declared here @@ -187,7 +188,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:48:5 + --> $DIR/hygienic-labels.rs:72:5 | LL | 'x: loop { $e } | -- first declared here @@ -196,7 +197,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:48:5 + --> $DIR/hygienic-labels.rs:72:5 | LL | 'x: while 1 + 1 == 2 { | -- first declared here @@ -205,7 +206,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:48:5 + --> $DIR/hygienic-labels.rs:72:5 | LL | 'x: while 1 + 1 == 2 { $e } | -- first declared here @@ -214,7 +215,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:19:9 + --> $DIR/hygienic-labels.rs:23:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -226,7 +227,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:19:9 + --> $DIR/hygienic-labels.rs:23:9 | LL | 'x: loop { $e } | -- first declared here @@ -238,7 +239,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:19:9 + --> $DIR/hygienic-labels.rs:23:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -250,7 +251,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:19:9 + --> $DIR/hygienic-labels.rs:23:9 | LL | 'x: loop { $e } | -- first declared here @@ -262,7 +263,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:19:9 + --> $DIR/hygienic-labels.rs:23:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -274,7 +275,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:19:9 + --> $DIR/hygienic-labels.rs:23:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -286,14 +287,14 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:19:9 + --> $DIR/hygienic-labels.rs:23:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope ... LL | 'x: for _ in 0..1 { | -- first declared here -LL | // ditto +... LL | run_once!(continue 'x); | ----------------------- in this macro invocation diff --git a/src/test/ui/hygiene/issue-61574-const-parameters.rs b/src/test/ui/hygiene/issue-61574-const-parameters.rs index dcfb42287d5cb..81e9b1b36e064 100644 --- a/src/test/ui/hygiene/issue-61574-const-parameters.rs +++ b/src/test/ui/hygiene/issue-61574-const-parameters.rs @@ -3,7 +3,7 @@ // check-pass -#![feature(const_generics)] +#![feature(const_generics)] //~ WARNING `const_generics` is incomplete use std::ops::Add; diff --git a/src/test/ui/if-ret.rs b/src/test/ui/if-ret.rs index e1e795d83bea2..6bb0141848af4 100644 --- a/src/test/ui/if-ret.rs +++ b/src/test/ui/if-ret.rs @@ -3,6 +3,6 @@ #![allow(unused_parens)] // pretty-expanded FIXME #23616 -fn foo() { if (return) { } } +fn foo() { if (return) { } } //~ WARNING unreachable block in `if` expression pub fn main() { foo(); } diff --git a/src/test/ui/inference/inference-variable-behind-raw-pointer.rs b/src/test/ui/inference/inference-variable-behind-raw-pointer.rs index a90b268db8c95..1d508e8e820ce 100644 --- a/src/test/ui/inference/inference-variable-behind-raw-pointer.rs +++ b/src/test/ui/inference/inference-variable-behind-raw-pointer.rs @@ -1,4 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass // tests that the following code compiles, but produces a future-compatibility warning @@ -6,4 +6,6 @@ fn main() { let data = std::ptr::null(); let _ = &data as *const *const (); if data.is_null() {} + //~^ WARNING type annotations needed + //~| WARNING this was previously accepted by the compiler but is being phased out } diff --git a/src/test/ui/issues/issue-33140-traitobject-crate.rs b/src/test/ui/issues/issue-33140-traitobject-crate.rs index 5f6996c6f5218..46b68f1c9fe07 100644 --- a/src/test/ui/issues/issue-33140-traitobject-crate.rs +++ b/src/test/ui/issues/issue-33140-traitobject-crate.rs @@ -83,9 +83,15 @@ unsafe impl Trait for dyn (::std::iter::Iterator) + Send + Sync { } unsafe impl Trait for dyn (::std::marker::Send) + Send { } unsafe impl Trait for dyn (::std::marker::Send) + Sync { } unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { } +//~^ WARNING conflicting implementations of trait `Trait` for type +//~| WARNING this was previously accepted by the compiler but is being phased out unsafe impl Trait for dyn (::std::marker::Sync) + Send { } +//~^ WARNING conflicting implementations of trait `Trait` for type +//~| WARNING this was previously accepted by the compiler but is being phased out unsafe impl Trait for dyn (::std::marker::Sync) + Sync { } unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { } +//~^ WARNING conflicting implementations of trait `Trait` for type +//~| WARNING this was previously accepted by the compiler but is being phased out unsafe impl Trait for dyn (::std::ops::Drop) + Send { } unsafe impl Trait for dyn (::std::ops::Drop) + Sync { } unsafe impl Trait for dyn (::std::ops::Drop) + Send + Sync { } diff --git a/src/test/ui/issues/issue-33140-traitobject-crate.stderr b/src/test/ui/issues/issue-33140-traitobject-crate.stderr index 76db98aa38bb4..f31ea9391ab4b 100644 --- a/src/test/ui/issues/issue-33140-traitobject-crate.stderr +++ b/src/test/ui/issues/issue-33140-traitobject-crate.stderr @@ -15,10 +15,11 @@ LL | #![warn(order_dependent_trait_objects)] = note: for more information, see issue #56484 warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) - --> $DIR/issue-33140-traitobject-crate.rs:86:1 + --> $DIR/issue-33140-traitobject-crate.rs:88:1 | LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { } | ------------------------------------------------------------- first implementation here +... LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` | @@ -26,11 +27,11 @@ LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { } = note: for more information, see issue #56484 warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) - --> $DIR/issue-33140-traitobject-crate.rs:88:1 + --> $DIR/issue-33140-traitobject-crate.rs:92:1 | LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { } | ------------------------------------------------------ first implementation here -LL | unsafe impl Trait for dyn (::std::marker::Sync) + Sync { } +... LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` | diff --git a/src/test/ui/issues/issue-39720.rs b/src/test/ui/issues/issue-39720.rs index a3baa361d575f..1a4775fc9600f 100644 --- a/src/test/ui/issues/issue-39720.rs +++ b/src/test/ui/issues/issue-39720.rs @@ -5,12 +5,12 @@ #![feature(repr_simd, platform_intrinsics)] -#[repr(C)] +#[repr(C)] //~ WARNING conflicting representation hints #[repr(simd)] #[derive(Copy, Clone, Debug)] pub struct char3(pub i8, pub i8, pub i8); -#[repr(C)] +#[repr(C)] //~ WARNING conflicting representation hints #[repr(simd)] #[derive(Copy, Clone, Debug)] pub struct short3(pub i16, pub i16, pub i16); diff --git a/src/test/ui/issues/issue-52057.rs b/src/test/ui/issues/issue-52057.rs index 911983445e6d6..98f49fe8f5507 100644 --- a/src/test/ui/issues/issue-52057.rs +++ b/src/test/ui/issues/issue-52057.rs @@ -7,7 +7,6 @@ pub trait Parser { type Input; - #[inline(always)] fn parse_first(input: &mut Self::Input); } diff --git a/src/test/ui/issues/issue-52057.stderr b/src/test/ui/issues/issue-52057.stderr deleted file mode 100644 index 33b79dba73e0e..0000000000000 --- a/src/test/ui/issues/issue-52057.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: `#[inline]` is ignored on function prototypes - --> $DIR/issue-52057.rs:10:5 - | -LL | #[inline(always)] - | ^^^^^^^^^^^^^^^^^ - | - = note: `#[warn(unused_attributes)]` on by default - diff --git a/src/test/ui/issues/issue-57399-self-return-impl-trait.rs b/src/test/ui/issues/issue-57399-self-return-impl-trait.rs index 23d68263b3a27..c7fe40e7b506c 100644 --- a/src/test/ui/issues/issue-57399-self-return-impl-trait.rs +++ b/src/test/ui/issues/issue-57399-self-return-impl-trait.rs @@ -1,4 +1,4 @@ -// run-pass +// check-pass trait T { type T; diff --git a/src/test/ui/issues/issue-57399-self-return-impl-trait.stderr b/src/test/ui/issues/issue-57399-self-return-impl-trait.stderr deleted file mode 100644 index 5c71410a8275c..0000000000000 --- a/src/test/ui/issues/issue-57399-self-return-impl-trait.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: field is never used: `a` - --> $DIR/issue-57399-self-return-impl-trait.rs:12:5 - | -LL | a: A, - | ^^^^ - | - = note: `#[warn(dead_code)]` on by default - diff --git a/src/test/ui/lint/command-line-lint-group-warn.rs b/src/test/ui/lint/command-line-lint-group-warn.rs index d3a4201ba6070..f4536f9c9e218 100644 --- a/src/test/ui/lint/command-line-lint-group-warn.rs +++ b/src/test/ui/lint/command-line-lint-group-warn.rs @@ -1,6 +1,7 @@ // compile-flags: -W bad-style -// build-pass (FIXME(62277): could be check-pass?) +// check-pass fn main() { let _InappropriateCamelCasing = true; + //~^ WARNING should have a snake case name } diff --git a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.rs b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.rs index e7614355455ae..0ad014e3361b7 100644 --- a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.rs +++ b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.rs @@ -23,7 +23,7 @@ enum Large { struct Tuple(Large, ()); fn main() { - let i_think_continually = 2; + let i_think_continually = 2; //~ WARNING unused variable: `i_think_continually` let who_from_the_womb_remembered = SoulHistory { corridors_of_light: 5, hours_are_suns: true, @@ -31,20 +31,25 @@ fn main() { }; let mut mut_unused_var = 1; + //~^ WARNING unused variable: `mut_unused_var` + //~| WARNING variable does not need to be mutable let (mut var, unused_var) = (1, 2); + //~^ WARNING unused variable: `var` + //~| WARNING unused variable: `unused_var` + //~| WARNING variable does not need to be mutable // NOTE: `var` comes after `unused_var` lexicographically yet the warning // for `var` will be emitted before the one for `unused_var`. We use an // `IndexMap` to ensure this is the case instead of a `BTreeMap`. - if let SoulHistory { corridors_of_light, - mut hours_are_suns, + if let SoulHistory { corridors_of_light, //~ WARNING unused variable: `corridors_of_light` + mut hours_are_suns, //~ WARNING `hours_are_suns` is assigned to, but endless_and_singing: true } = who_from_the_womb_remembered { - hours_are_suns = false; + hours_are_suns = false; //~ WARNING unused_assignments } let the_spirit = LovelyAmbition { lips: 1, fire: 2 }; - let LovelyAmbition { lips, fire } = the_spirit; + let LovelyAmbition { lips, fire } = the_spirit; //~ WARNING unused variable: `fire` println!("{}", lips); let bag = Large::Suit { @@ -53,31 +58,31 @@ fn main() { // Plain struct match bag { - Large::Suit { case } => {} + Large::Suit { case } => {} //~ WARNING unused variable: `case` }; // Referenced struct match &bag { - &Large::Suit { case } => {} + &Large::Suit { case } => {} //~ WARNING unused variable: `case` }; // Boxed struct match box bag { - box Large::Suit { case } => {} + box Large::Suit { case } => {} //~ WARNING unused variable: `case` }; // Tuple with struct match (bag,) { - (Large::Suit { case },) => {} + (Large::Suit { case },) => {} //~ WARNING unused variable: `case` }; // Slice with struct match [bag] { - [Large::Suit { case }] => {} + [Large::Suit { case }] => {} //~ WARNING unused variable: `case` }; // Tuple struct with struct match Tuple(bag, ()) { - Tuple(Large::Suit { case }, ()) => {} + Tuple(Large::Suit { case }, ()) => {} //~ WARNING unused variable: `case` }; } diff --git a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr index 74bbef8adad05..0e18abc03fac0 100644 --- a/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr +++ b/src/test/ui/lint/issue-47390-unused-variable-in-struct-pattern.stderr @@ -18,25 +18,25 @@ LL | let mut mut_unused_var = 1; | ^^^^^^^^^^^^^^ help: consider prefixing with an underscore: `_mut_unused_var` warning: unused variable: `var` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:35:14 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:14 | LL | let (mut var, unused_var) = (1, 2); | ^^^ help: consider prefixing with an underscore: `_var` warning: unused variable: `unused_var` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:35:19 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:19 | LL | let (mut var, unused_var) = (1, 2); | ^^^^^^^^^^ help: consider prefixing with an underscore: `_unused_var` warning: unused variable: `corridors_of_light` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:40:26 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:45:26 | LL | if let SoulHistory { corridors_of_light, | ^^^^^^^^^^^^^^^^^^ help: try ignoring the field: `corridors_of_light: _` warning: variable `hours_are_suns` is assigned to, but never used - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:41:30 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:46:30 | LL | mut hours_are_suns, | ^^^^^^^^^^^^^^ @@ -44,7 +44,7 @@ LL | mut hours_are_suns, = note: consider using `_hours_are_suns` instead warning: value assigned to `hours_are_suns` is never read - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:43:9 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:48:9 | LL | hours_are_suns = false; | ^^^^^^^^^^^^^^ @@ -58,43 +58,43 @@ LL | #![warn(unused)] // UI tests pass `-A unused` (#43896) = help: maybe it is overwritten before being read? warning: unused variable: `fire` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:47:32 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:52:32 | LL | let LovelyAmbition { lips, fire } = the_spirit; | ^^^^ help: try ignoring the field: `fire: _` warning: unused variable: `case` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:56:23 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:61:23 | LL | Large::Suit { case } => {} | ^^^^ help: try ignoring the field: `case: _` warning: unused variable: `case` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:61:24 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:66:24 | LL | &Large::Suit { case } => {} | ^^^^ help: try ignoring the field: `case: _` warning: unused variable: `case` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:66:27 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:71:27 | LL | box Large::Suit { case } => {} | ^^^^ help: try ignoring the field: `case: _` warning: unused variable: `case` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:71:24 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:76:24 | LL | (Large::Suit { case },) => {} | ^^^^ help: try ignoring the field: `case: _` warning: unused variable: `case` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:76:24 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:81:24 | LL | [Large::Suit { case }] => {} | ^^^^ help: try ignoring the field: `case: _` warning: unused variable: `case` - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:81:29 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:86:29 | LL | Tuple(Large::Suit { case }, ()) => {} | ^^^^ help: try ignoring the field: `case: _` @@ -115,7 +115,7 @@ LL | #![warn(unused)] // UI tests pass `-A unused` (#43896) = note: `#[warn(unused_mut)]` implied by `#[warn(unused)]` warning: variable does not need to be mutable - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:35:10 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:37:10 | LL | let (mut var, unused_var) = (1, 2); | ----^^^ diff --git a/src/test/ui/lint/must-use-ops.rs b/src/test/ui/lint/must-use-ops.rs index d0adf6a875d3e..3e425727e7829 100644 --- a/src/test/ui/lint/must-use-ops.rs +++ b/src/test/ui/lint/must-use-ops.rs @@ -1,6 +1,6 @@ // Issue #50124 - Test warning for unused operator expressions -// build-pass (FIXME(62277): could be check-pass?) +// check-pass #![warn(unused_must_use)] @@ -9,33 +9,33 @@ fn main() { let val_pointer = &val; // Comparison Operators - val == 1; - val < 1; - val <= 1; - val != 1; - val >= 1; - val > 1; + val == 1; //~ WARNING unused comparison + val < 1; //~ WARNING unused comparison + val <= 1; //~ WARNING unused comparison + val != 1; //~ WARNING unused comparison + val >= 1; //~ WARNING unused comparison + val > 1; //~ WARNING unused comparison // Arithmetic Operators - val + 2; - val - 2; - val / 2; - val * 2; - val % 2; + val + 2; //~ WARNING unused arithmetic operation + val - 2; //~ WARNING unused arithmetic operation + val / 2; //~ WARNING unused arithmetic operation + val * 2; //~ WARNING unused arithmetic operation + val % 2; //~ WARNING unused arithmetic operation // Logical Operators - true && true; - false || true; + true && true; //~ WARNING unused logical operation + false || true; //~ WARNING unused logical operation // Bitwise Operators - 5 ^ val; - 5 & val; - 5 | val; - 5 << val; - 5 >> val; + 5 ^ val; //~ WARNING unused bitwise operation + 5 & val; //~ WARNING unused bitwise operation + 5 | val; //~ WARNING unused bitwise operation + 5 << val; //~ WARNING unused bitwise operation + 5 >> val; //~ WARNING unused bitwise operation // Unary Operators - !val; - -val; - *val_pointer; + !val; //~ WARNING unused unary operation + -val; //~ WARNING unused unary operation + *val_pointer; //~ WARNING unused unary operation } diff --git a/src/test/ui/lint/not_found.rs b/src/test/ui/lint/not_found.rs index 979a67b15583a..de120b6e084b8 100644 --- a/src/test/ui/lint/not_found.rs +++ b/src/test/ui/lint/not_found.rs @@ -1,13 +1,21 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass // this tests the `unknown_lint` lint, especially the suggestions // the suggestion only appears if a lint with the lowercase name exists #[allow(FOO_BAR)] +//~^ WARNING unknown lint + // the suggestion appears on all-uppercase names #[warn(DEAD_CODE)] +//~^ WARNING unknown lint +//~| HELP did you mean + // the suggestion appears also on mixed-case names #[deny(Warnings)] +//~^ WARNING unknown lint +//~| HELP did you mean + fn main() { unimplemented!(); } diff --git a/src/test/ui/lint/not_found.stderr b/src/test/ui/lint/not_found.stderr index 5016d9b97d69e..5a651e9ce0f3a 100644 --- a/src/test/ui/lint/not_found.stderr +++ b/src/test/ui/lint/not_found.stderr @@ -7,13 +7,13 @@ LL | #[allow(FOO_BAR)] = note: `#[warn(unknown_lints)]` on by default warning: unknown lint: `DEAD_CODE` - --> $DIR/not_found.rs:8:8 + --> $DIR/not_found.rs:10:8 | LL | #[warn(DEAD_CODE)] | ^^^^^^^^^ help: did you mean: `dead_code` warning: unknown lint: `Warnings` - --> $DIR/not_found.rs:10:8 + --> $DIR/not_found.rs:15:8 | LL | #[deny(Warnings)] | ^^^^^^^^ help: did you mean (notice the capitalization): `warnings` diff --git a/src/test/ui/lint/unreachable_pub-pub_crate.rs b/src/test/ui/lint/unreachable_pub-pub_crate.rs index 27b437b22eb03..94f79d69751f1 100644 --- a/src/test/ui/lint/unreachable_pub-pub_crate.rs +++ b/src/test/ui/lint/unreachable_pub-pub_crate.rs @@ -4,44 +4,45 @@ // suggestions to use `crate` given when it is on). When that feature becomes // stable, this test can be deleted. -// build-pass (FIXME(62277): could be check-pass?) +// check-pass -#![allow(unused)] #![warn(unreachable_pub)] mod private_mod { // non-leaked `pub` items in private module should be linted - pub use std::fmt; + pub use std::fmt; //~ WARNING unreachable_pub pub use std::env::{Args}; // braced-use has different item spans than unbraced + //~^ WARNING unreachable_pub - pub struct Hydrogen { + pub struct Hydrogen { //~ WARNING unreachable_pub // `pub` struct fields, too - pub neutrons: usize, + pub neutrons: usize, //~ WARNING unreachable_pub // (... but not more-restricted fields) pub(crate) electrons: usize } impl Hydrogen { // impls, too - pub fn count_neutrons(&self) -> usize { self.neutrons } + pub fn count_neutrons(&self) -> usize { self.neutrons } //~ WARNING unreachable_pub pub(crate) fn count_electrons(&self) -> usize { self.electrons } } - pub enum Helium {} - pub union Lithium { c1: usize, c2: u8 } - pub fn beryllium() {} - pub trait Boron {} - pub const CARBON: usize = 1; - pub static NITROGEN: usize = 2; - pub type Oxygen = bool; + pub enum Helium {} //~ WARNING unreachable_pub + pub union Lithium { c1: usize, c2: u8 } //~ WARNING unreachable_pub + pub fn beryllium() {} //~ WARNING unreachable_pub + pub trait Boron {} //~ WARNING unreachable_pub + pub const CARBON: usize = 1; //~ WARNING unreachable_pub + pub static NITROGEN: usize = 2; //~ WARNING unreachable_pub + pub type Oxygen = bool; //~ WARNING unreachable_pub macro_rules! define_empty_struct_with_visibility { ($visibility: vis, $name: ident) => { $visibility struct $name {} } + //~^ WARNING unreachable_pub } define_empty_struct_with_visibility!(pub, Fluorine); extern { - pub fn catalyze() -> bool; + pub fn catalyze() -> bool; //~ WARNING unreachable_pub } // items leaked through signatures (see `get_neon` below) are OK diff --git a/src/test/ui/lint/unreachable_pub-pub_crate.stderr b/src/test/ui/lint/unreachable_pub-pub_crate.stderr index 2b3f74a18afa9..da21c2ac4ab87 100644 --- a/src/test/ui/lint/unreachable_pub-pub_crate.stderr +++ b/src/test/ui/lint/unreachable_pub-pub_crate.stderr @@ -1,5 +1,5 @@ warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:15:5 + --> $DIR/unreachable_pub-pub_crate.rs:14:5 | LL | pub use std::fmt; | ---^^^^^^^^^^^^^^ @@ -7,14 +7,14 @@ LL | pub use std::fmt; | help: consider restricting its visibility: `pub(crate)` | note: lint level defined here - --> $DIR/unreachable_pub-pub_crate.rs:11:9 + --> $DIR/unreachable_pub-pub_crate.rs:10:9 | LL | #![warn(unreachable_pub)] | ^^^^^^^^^^^^^^^ = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:16:24 + --> $DIR/unreachable_pub-pub_crate.rs:15:24 | LL | pub use std::env::{Args}; // braced-use has different item spans than unbraced | --- ^^^^ @@ -124,7 +124,7 @@ warning: unreachable `pub` item | LL | ($visibility: vis, $name: ident) => { $visibility struct $name {} } | ^^^^^^^^^^^^^^^^^^^^^^^^ -LL | } +... LL | define_empty_struct_with_visibility!(pub, Fluorine); | ---------------------------------------------------- | | | @@ -134,7 +134,7 @@ LL | define_empty_struct_with_visibility!(pub, Fluorine); = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:44:9 + --> $DIR/unreachable_pub-pub_crate.rs:45:9 | LL | pub fn catalyze() -> bool; | ---^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/unreachable_pub.rs b/src/test/ui/lint/unreachable_pub.rs index 545281604ea50..a4c1497013964 100644 --- a/src/test/ui/lint/unreachable_pub.rs +++ b/src/test/ui/lint/unreachable_pub.rs @@ -1,4 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass #![feature(crate_visibility_modifier)] @@ -7,36 +7,38 @@ mod private_mod { // non-leaked `pub` items in private module should be linted - pub use std::fmt; + pub use std::fmt; //~ WARNING unreachable_pub pub use std::env::{Args}; // braced-use has different item spans than unbraced + //~^ WARNING unreachable_pub - pub struct Hydrogen { + pub struct Hydrogen { //~ WARNING unreachable_pub // `pub` struct fields, too - pub neutrons: usize, + pub neutrons: usize, //~ WARNING unreachable_pub // (... but not more-restricted fields) crate electrons: usize } impl Hydrogen { // impls, too - pub fn count_neutrons(&self) -> usize { self.neutrons } + pub fn count_neutrons(&self) -> usize { self.neutrons } //~ WARNING unreachable_pub crate fn count_electrons(&self) -> usize { self.electrons } } - pub enum Helium {} - pub union Lithium { c1: usize, c2: u8 } - pub fn beryllium() {} - pub trait Boron {} - pub const CARBON: usize = 1; - pub static NITROGEN: usize = 2; - pub type Oxygen = bool; + pub enum Helium {} //~ WARNING unreachable_pub + pub union Lithium { c1: usize, c2: u8 } //~ WARNING unreachable_pub + pub fn beryllium() {} //~ WARNING unreachable_pub + pub trait Boron {} //~ WARNING unreachable_pub + pub const CARBON: usize = 1; //~ WARNING unreachable_pub + pub static NITROGEN: usize = 2; //~ WARNING unreachable_pub + pub type Oxygen = bool; //~ WARNING unreachable_pub macro_rules! define_empty_struct_with_visibility { ($visibility: vis, $name: ident) => { $visibility struct $name {} } + //~^ WARNING unreachable_pub } define_empty_struct_with_visibility!(pub, Fluorine); extern { - pub fn catalyze() -> bool; + pub fn catalyze() -> bool; //~ WARNING unreachable_pub } // items leaked through signatures (see `get_neon` below) are OK diff --git a/src/test/ui/lint/unreachable_pub.stderr b/src/test/ui/lint/unreachable_pub.stderr index 6352f3e2c5c3d..2cb27a770edcd 100644 --- a/src/test/ui/lint/unreachable_pub.stderr +++ b/src/test/ui/lint/unreachable_pub.stderr @@ -24,7 +24,7 @@ LL | pub use std::env::{Args}; // braced-use has different item spans than u = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:13:5 + --> $DIR/unreachable_pub.rs:14:5 | LL | pub struct Hydrogen { | ---^^^^^^^^^^^^^^^^ @@ -34,7 +34,7 @@ LL | pub struct Hydrogen { = help: or consider exporting it for use by other crates warning: unreachable `pub` field - --> $DIR/unreachable_pub.rs:15:9 + --> $DIR/unreachable_pub.rs:16:9 | LL | pub neutrons: usize, | ---^^^^^^^^^^^^^^^^ @@ -42,7 +42,7 @@ LL | pub neutrons: usize, | help: consider restricting its visibility: `crate` warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:21:9 + --> $DIR/unreachable_pub.rs:22:9 | LL | pub fn count_neutrons(&self) -> usize { self.neutrons } | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -50,7 +50,7 @@ LL | pub fn count_neutrons(&self) -> usize { self.neutrons } | help: consider restricting its visibility: `crate` warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:25:5 + --> $DIR/unreachable_pub.rs:26:5 | LL | pub enum Helium {} | ---^^^^^^^^^^^^ @@ -60,7 +60,7 @@ LL | pub enum Helium {} = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:26:5 + --> $DIR/unreachable_pub.rs:27:5 | LL | pub union Lithium { c1: usize, c2: u8 } | ---^^^^^^^^^^^^^^ @@ -70,7 +70,7 @@ LL | pub union Lithium { c1: usize, c2: u8 } = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:27:5 + --> $DIR/unreachable_pub.rs:28:5 | LL | pub fn beryllium() {} | ---^^^^^^^^^^^^^^^ @@ -80,7 +80,7 @@ LL | pub fn beryllium() {} = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:28:5 + --> $DIR/unreachable_pub.rs:29:5 | LL | pub trait Boron {} | ---^^^^^^^^^^^^ @@ -90,7 +90,7 @@ LL | pub trait Boron {} = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:29:5 + --> $DIR/unreachable_pub.rs:30:5 | LL | pub const CARBON: usize = 1; | ---^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -100,7 +100,7 @@ LL | pub const CARBON: usize = 1; = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:30:5 + --> $DIR/unreachable_pub.rs:31:5 | LL | pub static NITROGEN: usize = 2; | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -110,7 +110,7 @@ LL | pub static NITROGEN: usize = 2; = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:31:5 + --> $DIR/unreachable_pub.rs:32:5 | LL | pub type Oxygen = bool; | ---^^^^^^^^^^^^^^^^^^^^ @@ -120,11 +120,11 @@ LL | pub type Oxygen = bool; = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:34:47 + --> $DIR/unreachable_pub.rs:35:47 | LL | ($visibility: vis, $name: ident) => { $visibility struct $name {} } | ^^^^^^^^^^^^^^^^^^^^^^^^ -LL | } +... LL | define_empty_struct_with_visibility!(pub, Fluorine); | ---------------------------------------------------- | | | @@ -134,7 +134,7 @@ LL | define_empty_struct_with_visibility!(pub, Fluorine); = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:39:9 + --> $DIR/unreachable_pub.rs:41:9 | LL | pub fn catalyze() -> bool; | ---^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/unused_import_warning_issue_45268.rs b/src/test/ui/lint/unused_import_warning_issue_45268.rs index 791bbb24196c8..5ae4828634091 100644 --- a/src/test/ui/lint/unused_import_warning_issue_45268.rs +++ b/src/test/ui/lint/unused_import_warning_issue_45268.rs @@ -24,6 +24,7 @@ mod test { } use test::Unused; // This is really unused, so warning is OK + //~^ WARNING unused import use test::A; // This is used by the test2::func() through import of super::* use test::B; // This is used by the test2::func() through import of super::* diff --git a/src/test/ui/macros/macro-lifetime-used-with-labels.rs b/src/test/ui/macros/macro-lifetime-used-with-labels.rs index 4c4bccbc12bc8..86a3e9f44c38f 100644 --- a/src/test/ui/macros/macro-lifetime-used-with-labels.rs +++ b/src/test/ui/macros/macro-lifetime-used-with-labels.rs @@ -18,7 +18,7 @@ macro_rules! br { } macro_rules! br2 { ($b:lifetime) => { - 'b: loop { + 'b: loop { //~ WARNING `'b` shadows a label name that is already in scope break $b; // this $b should refer to the outer loop. } } diff --git a/src/test/ui/macros/macro-path-prelude-pass.rs b/src/test/ui/macros/macro-path-prelude-pass.rs index 8daa1c84f1dc3..7cf346286eadf 100644 --- a/src/test/ui/macros/macro-path-prelude-pass.rs +++ b/src/test/ui/macros/macro-path-prelude-pass.rs @@ -1,6 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) - -#![feature(extern_prelude)] +// check-pass mod m { fn check() { diff --git a/src/test/ui/macros/macro-path-prelude-pass.stderr b/src/test/ui/macros/macro-path-prelude-pass.stderr deleted file mode 100644 index c6e7fd77cd914..0000000000000 --- a/src/test/ui/macros/macro-path-prelude-pass.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable - --> $DIR/macro-path-prelude-pass.rs:3:12 - | -LL | #![feature(extern_prelude)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(stable_features)]` on by default - diff --git a/src/test/ui/macros/macro-use-all-and-none.rs b/src/test/ui/macros/macro-use-all-and-none.rs index e5f67d458d2b6..c8bd44008b081 100644 --- a/src/test/ui/macros/macro-use-all-and-none.rs +++ b/src/test/ui/macros/macro-use-all-and-none.rs @@ -4,7 +4,7 @@ #![warn(unused_attributes)] #[macro_use] -#[macro_use()] +#[macro_use()] //~ WARNING unused attribute extern crate two_macros_rpass; pub fn main() { diff --git a/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs b/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs index 5fe72caf9c1ff..73c1477c281a8 100644 --- a/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs +++ b/src/test/ui/or-patterns/or-patterns-syntactic-pass.rs @@ -3,7 +3,7 @@ // check-pass -#![feature(or_patterns)] +#![feature(or_patterns)] //~ WARNING the feature `or_patterns` is incomplete fn main() {} diff --git a/src/test/ui/removing-extern-crate.fixed b/src/test/ui/removing-extern-crate.fixed index d2993dbc4a417..8dbd0395b97bd 100644 --- a/src/test/ui/removing-extern-crate.fixed +++ b/src/test/ui/removing-extern-crate.fixed @@ -1,17 +1,16 @@ // edition:2018 // aux-build:removing-extern-crate.rs // run-rustfix -// build-pass (FIXME(62277): could be check-pass?) +// check-pass #![warn(rust_2018_idioms)] -#![allow(unused_imports)] - - + //~ WARNING unused extern crate + //~ WARNING unused extern crate mod another { - - + //~ WARNING unused extern crate + //~ WARNING unused extern crate } fn main() {} diff --git a/src/test/ui/removing-extern-crate.rs b/src/test/ui/removing-extern-crate.rs index 22fdfc2b0ec9c..465e1360c2ad1 100644 --- a/src/test/ui/removing-extern-crate.rs +++ b/src/test/ui/removing-extern-crate.rs @@ -1,17 +1,16 @@ // edition:2018 // aux-build:removing-extern-crate.rs // run-rustfix -// build-pass (FIXME(62277): could be check-pass?) +// check-pass #![warn(rust_2018_idioms)] -#![allow(unused_imports)] -extern crate removing_extern_crate as foo; -extern crate core; +extern crate removing_extern_crate as foo; //~ WARNING unused extern crate +extern crate core; //~ WARNING unused extern crate mod another { - extern crate removing_extern_crate as foo; - extern crate core; + extern crate removing_extern_crate as foo; //~ WARNING unused extern crate + extern crate core; //~ WARNING unused extern crate } fn main() {} diff --git a/src/test/ui/removing-extern-crate.stderr b/src/test/ui/removing-extern-crate.stderr index 18d0756e9f4e9..20d5564c16d15 100644 --- a/src/test/ui/removing-extern-crate.stderr +++ b/src/test/ui/removing-extern-crate.stderr @@ -1,5 +1,5 @@ warning: unused extern crate - --> $DIR/removing-extern-crate.rs:9:1 + --> $DIR/removing-extern-crate.rs:8:1 | LL | extern crate removing_extern_crate as foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it @@ -12,19 +12,19 @@ LL | #![warn(rust_2018_idioms)] = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` warning: unused extern crate - --> $DIR/removing-extern-crate.rs:10:1 + --> $DIR/removing-extern-crate.rs:9:1 | LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ help: remove it warning: unused extern crate - --> $DIR/removing-extern-crate.rs:13:5 + --> $DIR/removing-extern-crate.rs:12:5 | LL | extern crate removing_extern_crate as foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it warning: unused extern crate - --> $DIR/removing-extern-crate.rs:14:5 + --> $DIR/removing-extern-crate.rs:13:5 | LL | extern crate core; | ^^^^^^^^^^^^^^^^^^ help: remove it diff --git a/src/test/ui/rfc-2497-if-let-chains/protect-precedences.rs b/src/test/ui/rfc-2497-if-let-chains/protect-precedences.rs index b95105b59eddb..442983671884e 100644 --- a/src/test/ui/rfc-2497-if-let-chains/protect-precedences.rs +++ b/src/test/ui/rfc-2497-if-let-chains/protect-precedences.rs @@ -10,7 +10,7 @@ fn main() { fn _f1() -> bool { // Should associate as `(let _ = (return (true && false)))`. - if let _ = return true && false {}; + if let _ = return true && false {}; //~ WARNING unreachable_code } assert!(!_f1()); } diff --git a/src/test/ui/rust-2018/remove-extern-crate.fixed b/src/test/ui/rust-2018/remove-extern-crate.fixed index 7ddd2f547f071..2e10d5555908b 100644 --- a/src/test/ui/rust-2018/remove-extern-crate.fixed +++ b/src/test/ui/rust-2018/remove-extern-crate.fixed @@ -6,7 +6,7 @@ #![warn(rust_2018_idioms)] - + //~ WARNING unused extern crate // Shouldn't suggest changing to `use`, as `another_name` // would no longer be added to the prelude which could cause // compilation errors for imports that use `another_name` in other @@ -29,7 +29,7 @@ fn main() { } mod another { - use core; + use core; //~ WARNING `extern crate` is not idiomatic use remove_extern_crate; pub fn foo() { diff --git a/src/test/ui/rust-2018/remove-extern-crate.rs b/src/test/ui/rust-2018/remove-extern-crate.rs index 298b16140264a..9b04f901310ea 100644 --- a/src/test/ui/rust-2018/remove-extern-crate.rs +++ b/src/test/ui/rust-2018/remove-extern-crate.rs @@ -6,7 +6,7 @@ #![warn(rust_2018_idioms)] -extern crate core; +extern crate core; //~ WARNING unused extern crate // Shouldn't suggest changing to `use`, as `another_name` // would no longer be added to the prelude which could cause // compilation errors for imports that use `another_name` in other @@ -29,7 +29,7 @@ fn main() { } mod another { - extern crate core; + extern crate core; //~ WARNING `extern crate` is not idiomatic use remove_extern_crate; pub fn foo() { diff --git a/src/test/ui/rust-2018/try-ident.fixed b/src/test/ui/rust-2018/try-ident.fixed index f86a401cdf939..f285b2c0ee6fa 100644 --- a/src/test/ui/rust-2018/try-ident.fixed +++ b/src/test/ui/rust-2018/try-ident.fixed @@ -5,7 +5,11 @@ fn main() { r#try(); + //~^ WARNING `try` is a keyword in the 2018 edition + //~| WARNING it will become a hard error in the 2018 edition! } fn r#try() { + //~^ WARNING `try` is a keyword in the 2018 edition + //~| WARNING it will become a hard error in the 2018 edition! } diff --git a/src/test/ui/rust-2018/try-ident.rs b/src/test/ui/rust-2018/try-ident.rs index 6cc6aa12ff76e..d740801b562c8 100644 --- a/src/test/ui/rust-2018/try-ident.rs +++ b/src/test/ui/rust-2018/try-ident.rs @@ -5,7 +5,11 @@ fn main() { try(); + //~^ WARNING `try` is a keyword in the 2018 edition + //~| WARNING it will become a hard error in the 2018 edition! } fn try() { + //~^ WARNING `try` is a keyword in the 2018 edition + //~| WARNING it will become a hard error in the 2018 edition! } diff --git a/src/test/ui/rust-2018/try-ident.stderr b/src/test/ui/rust-2018/try-ident.stderr index 852e3e5aed64b..29cc68c439e9d 100644 --- a/src/test/ui/rust-2018/try-ident.stderr +++ b/src/test/ui/rust-2018/try-ident.stderr @@ -14,7 +14,7 @@ LL | #![warn(rust_2018_compatibility)] = note: for more information, see issue #49716 warning: `try` is a keyword in the 2018 edition - --> $DIR/try-ident.rs:10:4 + --> $DIR/try-ident.rs:12:4 | LL | fn try() { | ^^^ help: you can use a raw identifier to stay compatible: `r#try` diff --git a/src/test/ui/rust-2018/try-macro.fixed b/src/test/ui/rust-2018/try-macro.fixed index a7b7d3faf5ee9..5c899378b943f 100644 --- a/src/test/ui/rust-2018/try-macro.fixed +++ b/src/test/ui/rust-2018/try-macro.fixed @@ -1,16 +1,17 @@ // Test that `try!` macros are rewritten. // run-rustfix -// build-pass (FIXME(62277): could be check-pass?) +// check-pass #![warn(rust_2018_compatibility)] -#![allow(unused_variables)] #![allow(dead_code)] #![allow(deprecated)] fn foo() -> Result { let x: Result = Ok(22); r#try!(x); + //~^ WARNING `try` is a keyword in the 2018 edition + //~| WARNING this was previously accepted Ok(44) } diff --git a/src/test/ui/rust-2018/try-macro.rs b/src/test/ui/rust-2018/try-macro.rs index 986e158eb644e..db8a198d282cc 100644 --- a/src/test/ui/rust-2018/try-macro.rs +++ b/src/test/ui/rust-2018/try-macro.rs @@ -1,16 +1,17 @@ // Test that `try!` macros are rewritten. // run-rustfix -// build-pass (FIXME(62277): could be check-pass?) +// check-pass #![warn(rust_2018_compatibility)] -#![allow(unused_variables)] #![allow(dead_code)] #![allow(deprecated)] fn foo() -> Result { let x: Result = Ok(22); try!(x); + //~^ WARNING `try` is a keyword in the 2018 edition + //~| WARNING this was previously accepted Ok(44) } diff --git a/src/test/ui/rust-2018/try-macro.stderr b/src/test/ui/rust-2018/try-macro.stderr index fad1bb9f1b068..eb65d4150642a 100644 --- a/src/test/ui/rust-2018/try-macro.stderr +++ b/src/test/ui/rust-2018/try-macro.stderr @@ -1,5 +1,5 @@ warning: `try` is a keyword in the 2018 edition - --> $DIR/try-macro.rs:13:5 + --> $DIR/try-macro.rs:12:5 | LL | try!(x); | ^^^ help: you can use a raw identifier to stay compatible: `r#try` diff --git a/src/test/ui/test-attrs/test-on-macro.rs b/src/test/ui/test-attrs/test-on-macro.rs index a238db6d71623..0667364d13cd4 100644 --- a/src/test/ui/test-attrs/test-on-macro.rs +++ b/src/test/ui/test-attrs/test-on-macro.rs @@ -1,4 +1,4 @@ -// build-pass (FIXME(62277): could be check-pass?) +// check-pass // compile-flags:--test #![deny(warnings)] @@ -8,6 +8,6 @@ macro_rules! foo { } #[test] -foo!(); +foo!(); //~ WARNING `#[test]` attribute should not be used on macros fn main(){} diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs index bdbd64140f0cb..3416503b851fb 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs @@ -1,26 +1,26 @@ -// run-pass +// check-pass // Check tautalogically false `Copy` bounds #![feature(trivial_bounds)] -#![allow(unused)] -fn copy_string(t: String) -> String where String: Copy { +fn copy_string(t: String) -> String where String: Copy { //~ WARNING trivial_bounds is_copy(&t); let x = t; drop(t); t } -fn copy_out_string(t: &String) -> String where String: Copy { +fn copy_out_string(t: &String) -> String where String: Copy { //~ WARNING trivial_bounds *t } -fn copy_string_with_param(x: String) where String: Copy { +fn copy_string_with_param(x: String) where String: Copy { //~ WARNING trivial_bounds let y = x; let z = x; } // Check that no reborrowing occurs fn copy_mut<'a>(t: &&'a mut i32) -> &'a mut i32 where for<'b> &'b mut i32: Copy { + //~^ WARNING trivial_bounds is_copy(t); let x = *t; drop(x); diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr index af0bad80690f3..17389a8731332 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr @@ -1,5 +1,5 @@ warning: Trait bound std::string::String: std::marker::Copy does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-copy.rs:6:51 + --> $DIR/trivial-bounds-inconsistent-copy.rs:5:51 | LL | fn copy_string(t: String) -> String where String: Copy { | ^^^^ @@ -7,19 +7,19 @@ LL | fn copy_string(t: String) -> String where String: Copy { = note: `#[warn(trivial_bounds)]` on by default warning: Trait bound std::string::String: std::marker::Copy does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-copy.rs:13:56 + --> $DIR/trivial-bounds-inconsistent-copy.rs:12:56 | LL | fn copy_out_string(t: &String) -> String where String: Copy { | ^^^^ warning: Trait bound std::string::String: std::marker::Copy does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-copy.rs:17:55 + --> $DIR/trivial-bounds-inconsistent-copy.rs:16:55 | LL | fn copy_string_with_param(x: String) where String: Copy { | ^^^^ warning: Trait bound for<'b> &'b mut i32: std::marker::Copy does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-copy.rs:23:76 + --> $DIR/trivial-bounds-inconsistent-copy.rs:22:76 | LL | fn copy_mut<'a>(t: &&'a mut i32) -> &'a mut i32 where for<'b> &'b mut i32: Copy { | ^^^^ diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.rs index fa2daeb11e916..b13956673d231 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.rs @@ -18,21 +18,21 @@ impl A for B { fn underspecified_bound() -> u8 where - B: A + B: A //~ WARNING trivial_bounds { B::get_x() } fn inconsistent_bound() -> i32 where - B: A + B: A //~ WARNING trivial_bounds { B::get_x() } fn redundant_bound() -> u8 where - B: A + B: A //~ WARNING trivial_bounds { B::get_x() } @@ -40,6 +40,8 @@ where fn inconsistent_dup_bound() -> i32 where B: A + A + //~^ WARNING trivial_bounds + //~| WARNING trivial_bounds { B::get_x() } @@ -47,6 +49,8 @@ where fn redundant_dup_bound() -> u8 where B: A + A + //~^ WARNING trivial_bounds + //~| WARNING trivial_bounds { B::get_x() } diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.stderr index f2aa482f6dee4..dc685cbf6b37e 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.stderr @@ -31,13 +31,13 @@ LL | B: A + A | ^ warning: Trait bound B: A does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-projection.rs:49:8 + --> $DIR/trivial-bounds-inconsistent-projection.rs:51:8 | LL | B: A + A | ^^^^^^^^^ warning: Trait bound B: A does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-projection.rs:49:20 + --> $DIR/trivial-bounds-inconsistent-projection.rs:51:20 | LL | B: A + A | ^ diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs index d411807673c66..bfa083655c4fa 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs @@ -12,12 +12,15 @@ struct T { } struct S(str, str) where str: Sized; +//~^ WARNING Sized does not depend on any type or lifetime fn unsized_local() where for<'a> T: Sized { + //~^ WARNING Sized does not depend on any type or lifetime let x: T = *(Box::new(T { x: 1 }) as Box>); } fn return_str() -> str where str: Sized { + //~^ WARNING Sized does not depend on any type or lifetime *"Sized".to_string().into_boxed_str() } diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr index a80ebc173f037..d4fa698c7375f 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr @@ -7,13 +7,13 @@ LL | struct S(str, str) where str: Sized; = note: `#[warn(trivial_bounds)]` on by default warning: Trait bound for<'a> T<(dyn A + 'a)>: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-sized.rs:16:49 + --> $DIR/trivial-bounds-inconsistent-sized.rs:17:49 | LL | fn unsized_local() where for<'a> T: Sized { | ^^^^^ warning: Trait bound str: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent-sized.rs:20:35 + --> $DIR/trivial-bounds-inconsistent-sized.rs:22:35 | LL | fn return_str() -> str where str: Sized { | ^^^^^ diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.rs index cab2423d25de2..9efa22b10717f 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.rs @@ -5,6 +5,8 @@ use std::fmt::Debug; pub fn foo() where Vec: Debug, str: Copy { + //~^ WARNING Debug does not depend on any type or lifetime + //~| WARNING Copy does not depend on any type or lifetime let x = vec![*"1"]; println!("{:?}", x); } diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs index f6538b14d1711..7148f5d6da05b 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs @@ -11,17 +11,19 @@ pub trait Foo { fn generic_function(x: X) {} -enum E where i32: Foo { V } +enum E where i32: Foo { V } //~ WARNING trivial_bounds -struct S where i32: Foo; +struct S where i32: Foo; //~ WARNING trivial_bounds -trait T where i32: Foo {} +trait T where i32: Foo {} //~ WARNING trivial_bounds -union U where i32: Foo { f: i32 } +union U where i32: Foo { f: i32 } //~ WARNING trivial_bounds type Y where i32: Foo = (); +//~^ WARNING type_alias_bounds +//~| WARNING trivial_bounds -impl Foo for () where i32: Foo { +impl Foo for () where i32: Foo { //~ WARNING trivial_bounds fn test(&self) { 3i32.test(); Foo::test(&4i32); @@ -29,14 +31,14 @@ impl Foo for () where i32: Foo { } } -fn f() where i32: Foo { +fn f() where i32: Foo { //~ WARNING trivial_bounds let s = S; 3i32.test(); Foo::test(&4i32); generic_function(5i32); } -fn g() where &'static str: Foo { +fn g() where &'static str: Foo { //~ WARNING trivial_bounds "Foo".test(); Foo::test(&"Foo"); generic_function("Foo"); @@ -50,21 +52,22 @@ struct Dst { x: X, } -struct TwoStrs(str, str) where str: Sized; +struct TwoStrs(str, str) where str: Sized; //~ WARNING trivial_bounds -fn unsized_local() where for<'a> Dst: Sized { +fn unsized_local() where for<'a> Dst: Sized { //~ WARNING trivial_bounds let x: Dst = *(Box::new(Dst { x: 1 }) as Box>); } -fn return_str() -> str where str: Sized { +fn return_str() -> str where str: Sized { //~ WARNING trivial_bounds *"Sized".to_string().into_boxed_str() } fn use_op(s: String) -> String where String: ::std::ops::Neg { + //~^ WARNING trivial_bounds -s } -fn use_for() where i32: Iterator { +fn use_for() where i32: Iterator { //~ WARNING trivial_bounds for _ in 2i32 {} } diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr index cb8bad6d9e74d..156d38e3df58d 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr @@ -43,49 +43,49 @@ LL | type Y where i32: Foo = (); | ^^^ warning: Trait bound i32: Foo does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:24:28 + --> $DIR/trivial-bounds-inconsistent.rs:26:28 | LL | impl Foo for () where i32: Foo { | ^^^ warning: Trait bound i32: Foo does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:32:19 + --> $DIR/trivial-bounds-inconsistent.rs:34:19 | LL | fn f() where i32: Foo { | ^^^ warning: Trait bound &'static str: Foo does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:39:28 + --> $DIR/trivial-bounds-inconsistent.rs:41:28 | LL | fn g() where &'static str: Foo { | ^^^ warning: Trait bound str: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:53:37 + --> $DIR/trivial-bounds-inconsistent.rs:55:37 | LL | struct TwoStrs(str, str) where str: Sized; | ^^^^^ warning: Trait bound for<'a> Dst<(dyn A + 'a)>: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:55:51 + --> $DIR/trivial-bounds-inconsistent.rs:57:51 | LL | fn unsized_local() where for<'a> Dst: Sized { | ^^^^^ warning: Trait bound str: std::marker::Sized does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:59:35 + --> $DIR/trivial-bounds-inconsistent.rs:61:35 | LL | fn return_str() -> str where str: Sized { | ^^^^^ warning: Trait bound std::string::String: std::ops::Neg does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:63:46 + --> $DIR/trivial-bounds-inconsistent.rs:65:46 | LL | fn use_op(s: String) -> String where String: ::std::ops::Neg { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: Trait bound i32: std::iter::Iterator does not depend on any type or lifetime parameters - --> $DIR/trivial-bounds-inconsistent.rs:67:25 + --> $DIR/trivial-bounds-inconsistent.rs:70:25 | LL | fn use_for() where i32: Iterator { | ^^^^^^^^ diff --git a/src/test/ui/try-block/try-block-unreachable-code-lint.rs b/src/test/ui/try-block/try-block-unreachable-code-lint.rs index 5a9f662d229b2..e1d82ea360dc6 100644 --- a/src/test/ui/try-block/try-block-unreachable-code-lint.rs +++ b/src/test/ui/try-block/try-block-unreachable-code-lint.rs @@ -43,14 +43,14 @@ fn test_try_block_after_divergent_stmt() { err()?; } } - // ~^^^^^ WARNING unreachable expression + //~^^^^^ WARNING unreachable expression }; } fn test_wrapped_divergent_expr() { let _: Result = { Err(return) - // ~^ WARNING unreachable call + //~^ WARNING unreachable call }; } @@ -61,7 +61,7 @@ fn test_expr_after_divergent_stmt_in_try_block() { } 42 - // ~^ WARNING unreachable expression + //~^ WARNING unreachable expression }; println!("res: {:?}", res); } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index a9acc9733c19e..28b6d2c1d016d 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3148,11 +3148,20 @@ impl<'test> TestCx<'test> { explicit, self.config.compare_mode, expected_errors, proc_res.status, self.props.error_patterns); if !explicit && self.config.compare_mode.is_none() { - if !self.should_run() && !self.props.error_patterns.is_empty() { + let check_patterns = + !self.should_run() && + !self.props.error_patterns.is_empty(); + + let check_annotations = + !check_patterns || + !expected_errors.is_empty(); + + if check_patterns { // "// error-pattern" comments self.check_error_patterns(&proc_res.stderr, &proc_res); } - if !expected_errors.is_empty() { + + if check_annotations { // "//~ERROR comments" self.check_expected_errors(expected_errors, &proc_res); }