diff --git a/src/test/ui/check_match/issue-43253.rs b/src/test/ui/check_match/issue-43253.rs index 108d7e1ea22..12ccba0ebf2 100644 --- a/src/test/ui/check_match/issue-43253.rs +++ b/src/test/ui/check_match/issue-43253.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + #![feature(exclusive_range_pattern)] #![warn(unreachable_patterns)] diff --git a/src/test/ui/check_match/issue-43253.stderr b/src/test/ui/check_match/issue-43253.stderr index a1cb3963914..91bd6b39c8c 100644 --- a/src/test/ui/check_match/issue-43253.stderr +++ b/src/test/ui/check_match/issue-43253.stderr @@ -1,24 +1,24 @@ warning: unreachable pattern - --> $DIR/issue-43253.rs:37:9 + --> $DIR/issue-43253.rs:39:9 | -37 | 9 => {}, +39 | 9 => {}, | ^ | note: lint level defined here - --> $DIR/issue-43253.rs:12:9 + --> $DIR/issue-43253.rs:14:9 | -12 | #![warn(unreachable_patterns)] +14 | #![warn(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ warning: unreachable pattern - --> $DIR/issue-43253.rs:43:9 + --> $DIR/issue-43253.rs:45:9 | -43 | 8...9 => {}, +45 | 8...9 => {}, | ^^^^^ warning: unreachable pattern - --> $DIR/issue-43253.rs:49:9 + --> $DIR/issue-43253.rs:51:9 | -49 | 9...9 => {}, +51 | 9...9 => {}, | ^^^^^ diff --git a/src/test/ui/codemap_tests/unicode_3.rs b/src/test/ui/codemap_tests/unicode_3.rs index 5294eedb845..81c3b5dde6d 100644 --- a/src/test/ui/codemap_tests/unicode_3.rs +++ b/src/test/ui/codemap_tests/unicode_3.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + fn main() { let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; while true { break; } println!("{}", s); diff --git a/src/test/ui/codemap_tests/unicode_3.stderr b/src/test/ui/codemap_tests/unicode_3.stderr index a7514a6b792..d2c850d3cbd 100644 --- a/src/test/ui/codemap_tests/unicode_3.stderr +++ b/src/test/ui/codemap_tests/unicode_3.stderr @@ -1,7 +1,7 @@ warning: denote infinite loops with `loop { ... }` - --> $DIR/unicode_3.rs:12:45 + --> $DIR/unicode_3.rs:14:45 | -12 | let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; while true { break; } +14 | let s = "ZͨA͑ͦ͒͋ͤ͑̚L̄͑͋Ĝͨͥ̿͒̽̈́Oͥ͛ͭ!̏"; while true { break; } | ----------^^^^^^^^^^^ | | | help: use `loop` diff --git a/src/test/ui/explain.rs b/src/test/ui/explain.rs index 17fb59935dd..6305fbcffce 100644 --- a/src/test/ui/explain.rs +++ b/src/test/ui/explain.rs @@ -9,3 +9,4 @@ // except according to those terms. // compile-flags: --explain E0591 +// must-compile-successfully diff --git a/src/test/ui/hello_world/main.rs b/src/test/ui/hello_world/main.rs index 61183975577..4c53d19f719 100644 --- a/src/test/ui/hello_world/main.rs +++ b/src/test/ui/hello_world/main.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + // Test that compiling hello world succeeds with no output of any kind. fn main() { diff --git a/src/test/ui/lint/command-line-lint-group-allow.rs b/src/test/ui/lint/command-line-lint-group-allow.rs index cdb9684933d..c1840f3d44c 100644 --- a/src/test/ui/lint/command-line-lint-group-allow.rs +++ b/src/test/ui/lint/command-line-lint-group-allow.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -A bad-style +// must-compile-successfully fn main() { let _InappropriateCamelCasing = true; 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 7d65c802788..048c15b1230 100644 --- a/src/test/ui/lint/command-line-lint-group-warn.rs +++ b/src/test/ui/lint/command-line-lint-group-warn.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -W bad-style +// must-compile-successfully fn main() { let _InappropriateCamelCasing = true; diff --git a/src/test/ui/lint/command-line-lint-group-warn.stderr b/src/test/ui/lint/command-line-lint-group-warn.stderr index 998c892c7e3..6562e16a45d 100644 --- a/src/test/ui/lint/command-line-lint-group-warn.stderr +++ b/src/test/ui/lint/command-line-lint-group-warn.stderr @@ -1,7 +1,7 @@ warning: variable `_InappropriateCamelCasing` should have a snake case name such as `_inappropriate_camel_casing` - --> $DIR/command-line-lint-group-warn.rs:14:9 + --> $DIR/command-line-lint-group-warn.rs:15:9 | -14 | let _InappropriateCamelCasing = true; +15 | let _InappropriateCamelCasing = true; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-W non-snake-case` implied by `-W bad-style` diff --git a/src/test/ui/lint/not_found.rs b/src/test/ui/lint/not_found.rs index 5cdc19823cf..3de2cc0bfae 100644 --- a/src/test/ui/lint/not_found.rs +++ b/src/test/ui/lint/not_found.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + // this tests the `unknown_lint` lint, especially the suggestions // the suggestion only appears if a lint with the lowercase name exists diff --git a/src/test/ui/lint/not_found.stderr b/src/test/ui/lint/not_found.stderr index 73265845494..16daceecb98 100644 --- a/src/test/ui/lint/not_found.stderr +++ b/src/test/ui/lint/not_found.stderr @@ -1,20 +1,20 @@ warning: unknown lint: `FOO_BAR` - --> $DIR/not_found.rs:14:9 + --> $DIR/not_found.rs:16:9 | -14 | #[allow(FOO_BAR)] +16 | #[allow(FOO_BAR)] | ^^^^^^^ | = note: #[warn(unknown_lints)] on by default warning: unknown lint: `DEAD_CODE` - --> $DIR/not_found.rs:16:8 + --> $DIR/not_found.rs:18:8 | -16 | #[warn(DEAD_CODE)] +18 | #[warn(DEAD_CODE)] | ^^^^^^^^^ help: lowercase the lint name: `dead_code` warning: unknown lint: `Warnings` - --> $DIR/not_found.rs:18:8 + --> $DIR/not_found.rs:20:8 | -18 | #[deny(Warnings)] +20 | #[deny(Warnings)] | ^^^^^^^^ help: lowercase the lint name: `warnings` diff --git a/src/test/ui/lint/unreachable_pub-pub_crate.rs b/src/test/ui/lint/unreachable_pub-pub_crate.rs index b794f6c9517..4192b7dceef 100644 --- a/src/test/ui/lint/unreachable_pub-pub_crate.rs +++ b/src/test/ui/lint/unreachable_pub-pub_crate.rs @@ -14,6 +14,8 @@ // suggestions to use `crate` given when it is on). When that feature becomes // stable, this test can be deleted. +// must-compile-successfully + #![feature(macro_vis_matcher)] #![allow(unused)] diff --git a/src/test/ui/lint/unreachable_pub-pub_crate.stderr b/src/test/ui/lint/unreachable_pub-pub_crate.stderr index 84cbf87c1a1..0c2841a9e15 100644 --- a/src/test/ui/lint/unreachable_pub-pub_crate.stderr +++ b/src/test/ui/lint/unreachable_pub-pub_crate.stderr @@ -1,22 +1,22 @@ warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:24:5 + --> $DIR/unreachable_pub-pub_crate.rs:26:5 | -24 | pub use std::fmt; +26 | pub use std::fmt; | ---^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | note: lint level defined here - --> $DIR/unreachable_pub-pub_crate.rs:20:9 + --> $DIR/unreachable_pub-pub_crate.rs:22:9 | -20 | #![warn(unreachable_pub)] +22 | #![warn(unreachable_pub)] | ^^^^^^^^^^^^^^^ = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:26:5 + --> $DIR/unreachable_pub-pub_crate.rs:28:5 | -26 | pub struct Hydrogen { +28 | pub struct Hydrogen { | ---^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` @@ -24,46 +24,26 @@ warning: unreachable `pub` item = help: or consider exporting it for use by other crates warning: unreachable `pub` field - --> $DIR/unreachable_pub-pub_crate.rs:28:9 + --> $DIR/unreachable_pub-pub_crate.rs:30:9 | -28 | pub neutrons: usize, +30 | pub neutrons: usize, | ---^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:34:9 + --> $DIR/unreachable_pub-pub_crate.rs:36:9 | -34 | pub fn count_neutrons(&self) -> usize { self.neutrons } +36 | pub fn count_neutrons(&self) -> usize { self.neutrons } | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` -warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:38:5 - | -38 | pub enum Helium {} - | ---^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` - | - = help: or consider exporting it for use by other crates - -warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:39:5 - | -39 | pub union Lithium { c1: usize, c2: u8 } - | ---^^^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `pub(crate)` - | - = help: or consider exporting it for use by other crates - warning: unreachable `pub` item --> $DIR/unreachable_pub-pub_crate.rs:40:5 | -40 | pub fn beryllium() {} - | ---^^^^^^^^^^^^^^^ +40 | pub enum Helium {} + | ---^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | @@ -72,8 +52,8 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub-pub_crate.rs:41:5 | -41 | pub trait Boron {} - | ---^^^^^^^^^^^^ +41 | pub union Lithium { c1: usize, c2: u8 } + | ---^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | @@ -82,8 +62,8 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub-pub_crate.rs:42:5 | -42 | pub const CARBON: usize = 1; - | ---^^^^^^^^^^^^^^^^^^^^^^^^^ +42 | pub fn beryllium() {} + | ---^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | @@ -92,8 +72,8 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub-pub_crate.rs:43:5 | -43 | pub static NITROGEN: usize = 2; - | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +43 | pub trait Boron {} + | ---^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` | @@ -102,7 +82,27 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub-pub_crate.rs:44:5 | -44 | pub type Oxygen = bool; +44 | pub const CARBON: usize = 1; + | ---^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | help: consider restricting its visibility: `pub(crate)` + | + = help: or consider exporting it for use by other crates + +warning: unreachable `pub` item + --> $DIR/unreachable_pub-pub_crate.rs:45:5 + | +45 | pub static NITROGEN: usize = 2; + | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | help: consider restricting its visibility: `pub(crate)` + | + = help: or consider exporting it for use by other crates + +warning: unreachable `pub` item + --> $DIR/unreachable_pub-pub_crate.rs:46:5 + | +46 | pub type Oxygen = bool; | ---^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` @@ -110,22 +110,22 @@ warning: unreachable `pub` item = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:47:47 + --> $DIR/unreachable_pub-pub_crate.rs:49:47 | -47 | ($visibility: vis, $name: ident) => { $visibility struct $name {} } +49 | ($visibility: vis, $name: ident) => { $visibility struct $name {} } | -----------^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` -48 | } -49 | define_empty_struct_with_visibility!(pub, Fluorine); +50 | } +51 | define_empty_struct_with_visibility!(pub, Fluorine); | ---------------------------------------------------- in this macro invocation | = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub-pub_crate.rs:52:9 + --> $DIR/unreachable_pub-pub_crate.rs:54:9 | -52 | pub fn catalyze() -> bool; +54 | pub fn catalyze() -> bool; | ---^^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `pub(crate)` diff --git a/src/test/ui/lint/unreachable_pub.rs b/src/test/ui/lint/unreachable_pub.rs index 5812061dfdb..393bccf03a7 100644 --- a/src/test/ui/lint/unreachable_pub.rs +++ b/src/test/ui/lint/unreachable_pub.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + #![feature(crate_visibility_modifier)] #![feature(macro_vis_matcher)] diff --git a/src/test/ui/lint/unreachable_pub.stderr b/src/test/ui/lint/unreachable_pub.stderr index bdd016ff2df..093870866c0 100644 --- a/src/test/ui/lint/unreachable_pub.stderr +++ b/src/test/ui/lint/unreachable_pub.stderr @@ -1,22 +1,22 @@ warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:19:5 + --> $DIR/unreachable_pub.rs:21:5 | -19 | pub use std::fmt; +21 | pub use std::fmt; | ---^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` | note: lint level defined here - --> $DIR/unreachable_pub.rs:15:9 + --> $DIR/unreachable_pub.rs:17:9 | -15 | #![warn(unreachable_pub)] +17 | #![warn(unreachable_pub)] | ^^^^^^^^^^^^^^^ = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:21:5 + --> $DIR/unreachable_pub.rs:23:5 | -21 | pub struct Hydrogen { +23 | pub struct Hydrogen { | ---^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` @@ -24,46 +24,26 @@ warning: unreachable `pub` item = help: or consider exporting it for use by other crates warning: unreachable `pub` field - --> $DIR/unreachable_pub.rs:23:9 + --> $DIR/unreachable_pub.rs:25:9 | -23 | pub neutrons: usize, +25 | pub neutrons: usize, | ---^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:29:9 + --> $DIR/unreachable_pub.rs:31:9 | -29 | pub fn count_neutrons(&self) -> usize { self.neutrons } +31 | pub fn count_neutrons(&self) -> usize { self.neutrons } | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` -warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:33:5 - | -33 | pub enum Helium {} - | ---^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `crate` - | - = help: or consider exporting it for use by other crates - -warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:34:5 - | -34 | pub union Lithium { c1: usize, c2: u8 } - | ---^^^^^^^^^^^^^^ - | | - | help: consider restricting its visibility: `crate` - | - = help: or consider exporting it for use by other crates - warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:35:5 | -35 | pub fn beryllium() {} - | ---^^^^^^^^^^^^^^^ +35 | pub enum Helium {} + | ---^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` | @@ -72,8 +52,8 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:36:5 | -36 | pub trait Boron {} - | ---^^^^^^^^^^^^ +36 | pub union Lithium { c1: usize, c2: u8 } + | ---^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` | @@ -82,8 +62,8 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:37:5 | -37 | pub const CARBON: usize = 1; - | ---^^^^^^^^^^^^^^^^^^^^^^^^^ +37 | pub fn beryllium() {} + | ---^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` | @@ -92,8 +72,8 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:38:5 | -38 | pub static NITROGEN: usize = 2; - | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +38 | pub trait Boron {} + | ---^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` | @@ -102,7 +82,27 @@ warning: unreachable `pub` item warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:39:5 | -39 | pub type Oxygen = bool; +39 | pub const CARBON: usize = 1; + | ---^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | help: consider restricting its visibility: `crate` + | + = help: or consider exporting it for use by other crates + +warning: unreachable `pub` item + --> $DIR/unreachable_pub.rs:40:5 + | +40 | pub static NITROGEN: usize = 2; + | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | help: consider restricting its visibility: `crate` + | + = help: or consider exporting it for use by other crates + +warning: unreachable `pub` item + --> $DIR/unreachable_pub.rs:41:5 + | +41 | pub type Oxygen = bool; | ---^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` @@ -110,22 +110,22 @@ warning: unreachable `pub` item = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:42:47 + --> $DIR/unreachable_pub.rs:44:47 | -42 | ($visibility: vis, $name: ident) => { $visibility struct $name {} } +44 | ($visibility: vis, $name: ident) => { $visibility struct $name {} } | -----------^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` -43 | } -44 | define_empty_struct_with_visibility!(pub, Fluorine); +45 | } +46 | define_empty_struct_with_visibility!(pub, Fluorine); | ---------------------------------------------------- in this macro invocation | = help: or consider exporting it for use by other crates warning: unreachable `pub` item - --> $DIR/unreachable_pub.rs:47:9 + --> $DIR/unreachable_pub.rs:49:9 | -47 | pub fn catalyze() -> bool; +49 | pub fn catalyze() -> bool; | ---^^^^^^^^^^^^^^^^^^^^^^^ | | | help: consider restricting its visibility: `crate` diff --git a/src/test/ui/lint/unused_parens_json_suggestion.rs b/src/test/ui/lint/unused_parens_json_suggestion.rs index ad501e66809..fdcd45c8314 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.rs +++ b/src/test/ui/lint/unused_parens_json_suggestion.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: --error-format pretty-json -Zunstable-options +// must-compile-successfully // The output for humans should just highlight the whole span without showing // the suggested replacement, but we also want to test that suggested diff --git a/src/test/ui/lint/unused_parens_json_suggestion.stderr b/src/test/ui/lint/unused_parens_json_suggestion.stderr index fe113eda3dd..37eb9a98f74 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_json_suggestion.stderr @@ -8,10 +8,10 @@ "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 1027, - "byte_end": 1040, - "line_start": 24, - "line_end": 24, + "byte_start": 1056, + "byte_end": 1069, + "line_start": 25, + "line_end": 25, "column_start": 14, "column_end": 27, "is_primary": true, @@ -35,10 +35,10 @@ "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 873, - "byte_end": 886, - "line_start": 19, - "line_end": 19, + "byte_start": 902, + "byte_end": 915, + "line_start": 20, + "line_end": 20, "column_start": 9, "column_end": 22, "is_primary": true, @@ -64,10 +64,10 @@ "spans": [ { "file_name": "$DIR/unused_parens_json_suggestion.rs", - "byte_start": 1027, - "byte_end": 1040, - "line_start": 24, - "line_end": 24, + "byte_start": 1056, + "byte_end": 1069, + "line_start": 25, + "line_end": 25, "column_start": 14, "column_end": 27, "is_primary": true, @@ -88,15 +88,15 @@ } ], "rendered": "warning: unnecessary parentheses around assigned value - --> $DIR/unused_parens_json_suggestion.rs:24:14 + --> $DIR/unused_parens_json_suggestion.rs:25:14 | -24 | let _a = (1 / (2 + 3)); +25 | let _a = (1 / (2 + 3)); | ^^^^^^^^^^^^^ help: remove these parentheses | note: lint level defined here - --> $DIR/unused_parens_json_suggestion.rs:19:9 + --> $DIR/unused_parens_json_suggestion.rs:20:9 | -19 | #![warn(unused_parens)] +20 | #![warn(unused_parens)] | ^^^^^^^^^^^^^ " diff --git a/src/test/ui/macros/trace-macro.rs b/src/test/ui/macros/trace-macro.rs index 34f674ae016..7e6da840900 100644 --- a/src/test/ui/macros/trace-macro.rs +++ b/src/test/ui/macros/trace-macro.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z trace-macros +// must-compile-successfully fn main() { println!("Hello, World!"); diff --git a/src/test/ui/macros/trace-macro.stderr b/src/test/ui/macros/trace-macro.stderr index 6cf3b0bd35d..842799648b2 100644 --- a/src/test/ui/macros/trace-macro.stderr +++ b/src/test/ui/macros/trace-macro.stderr @@ -1,7 +1,7 @@ note: trace_macro - --> $DIR/trace-macro.rs:14:5 + --> $DIR/trace-macro.rs:15:5 | -14 | println!("Hello, World!"); +15 | println!("Hello, World!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: expanding `println! { "Hello, World!" }` diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs index 76a0762461a..006bdaf4c60 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs @@ -28,6 +28,7 @@ // requirement, as you can see from the `#[rustc_regions]` output. // compile-flags:-Znll -Zborrowck=mir -Zverbose +// must-compile-successfully #![feature(rustc_attrs)] diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr index 7553ac5b0c3..81eb90020cc 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -1,17 +1,17 @@ warning: not reporting region error due to -Znll - --> $DIR/propagate-approximated-ref.rs:60:9 + --> $DIR/propagate-approximated-ref.rs:61:9 | -60 | demand_y(x, y, x.get()) +61 | demand_y(x, y, x.get()) | ^^^^^^^^^^^^^^^^^^^^^^^ note: External requirements - --> $DIR/propagate-approximated-ref.rs:58:47 + --> $DIR/propagate-approximated-ref.rs:59:47 | -58 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { +59 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | _______________________________________________^ -59 | | // Only works if 'x: 'y: -60 | | demand_y(x, y, x.get()) -61 | | }); +60 | | // Only works if 'x: 'y: +61 | | demand_y(x, y, x.get()) +62 | | }); | |_____^ | = note: defining type: DefId(0/1:18 ~ propagate_approximated_ref[317d]::supply[0]::{{closure}}[0]) with closure substs [ @@ -22,14 +22,14 @@ note: External requirements = note: where '_#1r: '_#2r note: No external requirements - --> $DIR/propagate-approximated-ref.rs:57:1 + --> $DIR/propagate-approximated-ref.rs:58:1 | -57 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { -58 | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -59 | | // Only works if 'x: 'y: -60 | | demand_y(x, y, x.get()) -61 | | }); -62 | | } +58 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { +59 | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { +60 | | // Only works if 'x: 'y: +61 | | demand_y(x, y, x.get()) +62 | | }); +63 | | } | |_^ | = note: defining type: DefId(0/0:6 ~ propagate_approximated_ref[317d]::supply[0]) with substs [] diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs index f776ddc8b15..5bd170cc304 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.rs @@ -17,6 +17,7 @@ // these errors are not (yet) reported. // compile-flags:-Znll -Zborrowck=mir -Zverbose +// must-compile-successfully #![feature(rustc_attrs)] diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index 8d1b9a94ea6..8fd6acbbe5d 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -1,17 +1,17 @@ warning: not reporting region error due to -Znll - --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:47:9 + --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:48:9 | -47 | demand_y(x, y, x.get()) +48 | demand_y(x, y, x.get()) | ^^^^^^^^^^^^^^^^^^^^^^^ note: External requirements - --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:45:47 + --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:46:47 | -45 | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { +46 | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { | _______________________________________________^ -46 | | // Only works if 'x: 'y: -47 | | demand_y(x, y, x.get()) -48 | | }); +47 | | // Only works if 'x: 'y: +48 | | demand_y(x, y, x.get()) +49 | | }); | |_____^ | = note: defining type: DefId(0/1:18 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [ @@ -22,14 +22,14 @@ note: External requirements = note: where '_#1r: '_#0r note: No external requirements - --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:44:1 + --> $DIR/propagate-approximated-shorter-to-static-no-bound.rs:45:1 | -44 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { -45 | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { -46 | | // Only works if 'x: 'y: -47 | | demand_y(x, y, x.get()) -48 | | }); -49 | | } +45 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { +46 | | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| { +47 | | // Only works if 'x: 'y: +48 | | demand_y(x, y, x.get()) +49 | | }); +50 | | } | |_^ | = note: defining type: DefId(0/0:6 ~ propagate_approximated_shorter_to_static_no_bound[317d]::supply[0]) with substs [] diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs index 54b501c9ab6..f4fdd4a8c17 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.rs @@ -18,6 +18,7 @@ // these errors are not (yet) reported. // compile-flags:-Znll -Zborrowck=mir -Zverbose +// must-compile-successfully #![feature(rustc_attrs)] diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index 9d318a63d8f..f189967244a 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -1,17 +1,17 @@ warning: not reporting region error due to -Znll - --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:50:9 + --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:51:9 | -50 | demand_y(x, y, x.get()) +51 | demand_y(x, y, x.get()) | ^^^^^^^^^^^^^^^^^^^^^^^ note: External requirements - --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:48:47 + --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:49:47 | -48 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { +49 | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | _______________________________________________^ -49 | | // Only works if 'x: 'y: -50 | | demand_y(x, y, x.get()) -51 | | }); +50 | | // Only works if 'x: 'y: +51 | | demand_y(x, y, x.get()) +52 | | }); | |_____^ | = note: defining type: DefId(0/1:18 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]::{{closure}}[0]) with closure substs [ @@ -22,14 +22,14 @@ note: External requirements = note: where '_#1r: '_#0r note: No external requirements - --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:47:1 + --> $DIR/propagate-approximated-shorter-to-static-wrong-bound.rs:48:1 | -47 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { -48 | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -49 | | // Only works if 'x: 'y: -50 | | demand_y(x, y, x.get()) -51 | | }); -52 | | } +48 | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { +49 | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { +50 | | // Only works if 'x: 'y: +51 | | demand_y(x, y, x.get()) +52 | | }); +53 | | } | |_^ | = note: defining type: DefId(0/0:6 ~ propagate_approximated_shorter_to_static_wrong_bound[317d]::supply[0]) with substs [] diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs index 48d446b00af..97a15a36fdd 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs @@ -16,6 +16,7 @@ // anonymous regions as well. // compile-flags:-Znll -Zborrowck=mir -Zverbose +// must-compile-successfully #![feature(rustc_attrs)] diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr index ae5ad6f4b96..1577e34e0de 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -1,17 +1,17 @@ warning: not reporting region error due to -Znll - --> $DIR/propagate-approximated-val.rs:48:9 + --> $DIR/propagate-approximated-val.rs:49:9 | -48 | demand_y(outlives1, outlives2, x.get()) +49 | demand_y(outlives1, outlives2, x.get()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: External requirements - --> $DIR/propagate-approximated-val.rs:46:45 + --> $DIR/propagate-approximated-val.rs:47:45 | -46 | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { +47 | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { | _____________________________________________^ -47 | | // Only works if 'x: 'y: -48 | | demand_y(outlives1, outlives2, x.get()) -49 | | }); +48 | | // Only works if 'x: 'y: +49 | | demand_y(outlives1, outlives2, x.get()) +50 | | }); | |_____^ | = note: defining type: DefId(0/1:18 ~ propagate_approximated_val[317d]::test[0]::{{closure}}[0]) with closure substs [ @@ -22,14 +22,14 @@ note: External requirements = note: where '_#1r: '_#2r note: No external requirements - --> $DIR/propagate-approximated-val.rs:45:1 + --> $DIR/propagate-approximated-val.rs:46:1 | -45 | / fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { -46 | | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { -47 | | // Only works if 'x: 'y: -48 | | demand_y(outlives1, outlives2, x.get()) -49 | | }); -50 | | } +46 | / fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { +47 | | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { +48 | | // Only works if 'x: 'y: +49 | | demand_y(outlives1, outlives2, x.get()) +50 | | }); +51 | | } | |_^ | = note: defining type: DefId(0/0:6 ~ propagate_approximated_val[317d]::test[0]) with substs [] diff --git a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.rs b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.rs index a28b5f4c0f9..ba4c287592e 100644 --- a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.rs +++ b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.rs @@ -14,6 +14,7 @@ // regions is erased. // compile-flags:-Znll -Zborrowck=mir -Zverbose +// must-compile-successfully #![feature(rustc_attrs)] diff --git a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr index 64f3bb08c62..d93124963eb 100644 --- a/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-despite-same-free-region.stderr @@ -1,17 +1,17 @@ warning: not reporting region error due to -Znll - --> $DIR/propagate-despite-same-free-region.rs:53:21 + --> $DIR/propagate-despite-same-free-region.rs:54:21 | -53 | let p = x.get(); +54 | let p = x.get(); | ^^^^^^^ note: External requirements - --> $DIR/propagate-despite-same-free-region.rs:51:9 + --> $DIR/propagate-despite-same-free-region.rs:52:9 | -51 | / |_outlives1, _outlives2, x, y| { -52 | | // Only works if 'x: 'y: -53 | | let p = x.get(); -54 | | demand_y(x, y, p) -55 | | }, +52 | / |_outlives1, _outlives2, x, y| { +53 | | // Only works if 'x: 'y: +54 | | let p = x.get(); +55 | | demand_y(x, y, p) +56 | | }, | |_________^ | = note: defining type: DefId(0/1:16 ~ propagate_despite_same_free_region[317d]::supply[0]::{{closure}}[0]) with closure substs [ @@ -22,15 +22,15 @@ note: External requirements = note: where '_#1r: '_#2r note: No external requirements - --> $DIR/propagate-despite-same-free-region.rs:48:1 + --> $DIR/propagate-despite-same-free-region.rs:49:1 | -48 | / fn supply<'a>(cell_a: Cell<&'a u32>) { -49 | | establish_relationships( -50 | | cell_a, -51 | | |_outlives1, _outlives2, x, y| { +49 | / fn supply<'a>(cell_a: Cell<&'a u32>) { +50 | | establish_relationships( +51 | | cell_a, +52 | | |_outlives1, _outlives2, x, y| { ... | -56 | | ); -57 | | } +57 | | ); +58 | | } | |_^ | = note: defining type: DefId(0/0:6 ~ propagate_despite_same_free_region[317d]::supply[0]) with substs [] diff --git a/src/test/ui/nll/maybe-initialized-drop-uninitialized.rs b/src/test/ui/nll/maybe-initialized-drop-uninitialized.rs index 64a4d391000..92b29a98c1c 100644 --- a/src/test/ui/nll/maybe-initialized-drop-uninitialized.rs +++ b/src/test/ui/nll/maybe-initialized-drop-uninitialized.rs @@ -9,6 +9,7 @@ // except according to those terms. //compile-flags: -Z emit-end-regions -Zborrowck=mir -Z nll +// must-compile-successfully #![allow(warnings)] diff --git a/src/test/ui/print-fuel/print-fuel.rs b/src/test/ui/print-fuel/print-fuel.rs index 0d9e243763f..2012a7d02ee 100644 --- a/src/test/ui/print-fuel/print-fuel.rs +++ b/src/test/ui/print-fuel/print-fuel.rs @@ -12,6 +12,7 @@ #![allow(dead_code)] // compile-flags: -Z print-fuel=foo +// must-compile-successfully struct S1(u8, u16, u8); struct S2(u8, u16, u8); diff --git a/src/test/ui/print_type_sizes/anonymous.rs b/src/test/ui/print_type_sizes/anonymous.rs index dc93bddbad8..cf0bedee2ab 100644 --- a/src/test/ui/print_type_sizes/anonymous.rs +++ b/src/test/ui/print_type_sizes/anonymous.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // All of the types that occur in this function are uninteresting, in // that one cannot control the sizes of these types with the same sort diff --git a/src/test/ui/print_type_sizes/generics.rs b/src/test/ui/print_type_sizes/generics.rs index 93bcd1c36e5..7bc4822359e 100644 --- a/src/test/ui/print_type_sizes/generics.rs +++ b/src/test/ui/print_type_sizes/generics.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates how generics are handled: types have to be // monomorphized, in the MIR of the original function in which they diff --git a/src/test/ui/print_type_sizes/multiple_types.rs b/src/test/ui/print_type_sizes/multiple_types.rs index 2b5010767fd..a9f29449015 100644 --- a/src/test/ui/print_type_sizes/multiple_types.rs +++ b/src/test/ui/print_type_sizes/multiple_types.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates that when multiple structural types occur in // a function, every one of them is included in the output. diff --git a/src/test/ui/print_type_sizes/niche-filling.rs b/src/test/ui/print_type_sizes/niche-filling.rs index f1c419d8895..08b58704022 100644 --- a/src/test/ui/print_type_sizes/niche-filling.rs +++ b/src/test/ui/print_type_sizes/niche-filling.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates how niche-filling enums are handled, // modelled after cases like `Option<&u32>`, `Option` and such. diff --git a/src/test/ui/print_type_sizes/no_duplicates.rs b/src/test/ui/print_type_sizes/no_duplicates.rs index 6008a346c05..40c41aae910 100644 --- a/src/test/ui/print_type_sizes/no_duplicates.rs +++ b/src/test/ui/print_type_sizes/no_duplicates.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates that when the same type occurs repeatedly // (even if multiple functions), it is only printed once in the diff --git a/src/test/ui/print_type_sizes/packed.rs b/src/test/ui/print_type_sizes/packed.rs index 7f278e71b21..1ee6395ac6c 100644 --- a/src/test/ui/print_type_sizes/packed.rs +++ b/src/test/ui/print_type_sizes/packed.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates how packing is handled; it should cause // the elimination of padding that would normally be introduced diff --git a/src/test/ui/print_type_sizes/padding.rs b/src/test/ui/print_type_sizes/padding.rs index af34a908ce8..b3cd2132343 100644 --- a/src/test/ui/print_type_sizes/padding.rs +++ b/src/test/ui/print_type_sizes/padding.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates how padding is handled: alignment // requirements can lead to the introduction of padding, either before diff --git a/src/test/ui/print_type_sizes/repr-align.rs b/src/test/ui/print_type_sizes/repr-align.rs index e9b43145de4..1bf76da8115 100644 --- a/src/test/ui/print_type_sizes/repr-align.rs +++ b/src/test/ui/print_type_sizes/repr-align.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates how padding is handled: alignment // requirements can lead to the introduction of padding, either before diff --git a/src/test/ui/print_type_sizes/uninhabited.rs b/src/test/ui/print_type_sizes/uninhabited.rs index 69cc4c93360..fae6cd4009c 100644 --- a/src/test/ui/print_type_sizes/uninhabited.rs +++ b/src/test/ui/print_type_sizes/uninhabited.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully #![feature(never_type)] diff --git a/src/test/ui/print_type_sizes/variants.rs b/src/test/ui/print_type_sizes/variants.rs index 875edb4515a..2725bb09b4b 100644 --- a/src/test/ui/print_type_sizes/variants.rs +++ b/src/test/ui/print_type_sizes/variants.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: -Z print-type-sizes +// must-compile-successfully // This file illustrates two things: // diff --git a/src/test/ui/reachable/expr_andand.rs b/src/test/ui/reachable/expr_andand.rs index af404d03097..7d74daaa6ee 100644 --- a/src/test/ui/reachable/expr_andand.rs +++ b/src/test/ui/reachable/expr_andand.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + #![allow(unused_variables)] #![allow(dead_code)] #![deny(unreachable_code)] diff --git a/src/test/ui/reachable/expr_oror.rs b/src/test/ui/reachable/expr_oror.rs index d01304d4034..ab0b71f0781 100644 --- a/src/test/ui/reachable/expr_oror.rs +++ b/src/test/ui/reachable/expr_oror.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + #![allow(unused_variables)] #![allow(dead_code)] #![deny(unreachable_code)] diff --git a/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.rs b/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.rs index b24b2d0fb24..eb4753122f3 100644 --- a/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.rs +++ b/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + #![feature(fn_must_use)] #![warn(unused_must_use)] diff --git a/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.stderr b/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.stderr index 4778f2e6d1b..92d1eeaf155 100644 --- a/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.stderr +++ b/src/test/ui/rfc_1940-must_use_on_functions/fn_must_use.stderr @@ -1,48 +1,48 @@ warning: unused return value of `need_to_use_this_value` which must be used: it's important - --> $DIR/fn_must_use.rs:59:5 + --> $DIR/fn_must_use.rs:61:5 | -59 | need_to_use_this_value(); //~ WARN unused return value +61 | need_to_use_this_value(); //~ WARN unused return value | ^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/fn_must_use.rs:12:9 + --> $DIR/fn_must_use.rs:14:9 | -12 | #![warn(unused_must_use)] +14 | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ warning: unused return value of `MyStruct::need_to_use_this_method_value` which must be used - --> $DIR/fn_must_use.rs:64:5 + --> $DIR/fn_must_use.rs:66:5 | -64 | m.need_to_use_this_method_value(); //~ WARN unused return value +66 | m.need_to_use_this_method_value(); //~ WARN unused return value | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused return value of `EvenNature::is_even` which must be used: no side effects - --> $DIR/fn_must_use.rs:65:5 + --> $DIR/fn_must_use.rs:67:5 | -65 | m.is_even(); // trait method! +67 | m.is_even(); // trait method! | ^^^^^^^^^^^^ warning: unused return value of `std::cmp::PartialEq::eq` which must be used - --> $DIR/fn_must_use.rs:71:5 + --> $DIR/fn_must_use.rs:73:5 | -71 | 2.eq(&3); //~ WARN unused return value +73 | 2.eq(&3); //~ WARN unused return value | ^^^^^^^^^ warning: unused return value of `std::cmp::PartialEq::eq` which must be used - --> $DIR/fn_must_use.rs:72:5 + --> $DIR/fn_must_use.rs:74:5 | -72 | m.eq(&n); //~ WARN unused return value +74 | m.eq(&n); //~ WARN unused return value | ^^^^^^^^^ warning: unused comparison which must be used - --> $DIR/fn_must_use.rs:75:5 + --> $DIR/fn_must_use.rs:77:5 | -75 | 2 == 3; //~ WARN unused comparison +77 | 2 == 3; //~ WARN unused comparison | ^^^^^^ warning: unused comparison which must be used - --> $DIR/fn_must_use.rs:76:5 + --> $DIR/fn_must_use.rs:78:5 | -76 | m == n; //~ WARN unused comparison +78 | m == n; //~ WARN unused comparison | ^^^^^^ diff --git a/src/test/ui/span/macro-span-replacement.rs b/src/test/ui/span/macro-span-replacement.rs index 71f37f6555e..0baa4fb4fe2 100644 --- a/src/test/ui/span/macro-span-replacement.rs +++ b/src/test/ui/span/macro-span-replacement.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + #![warn(unused)] macro_rules! m { diff --git a/src/test/ui/span/macro-span-replacement.stderr b/src/test/ui/span/macro-span-replacement.stderr index ed961896306..2a0e71e192c 100644 --- a/src/test/ui/span/macro-span-replacement.stderr +++ b/src/test/ui/span/macro-span-replacement.stderr @@ -1,16 +1,16 @@ warning: struct is never used: `S` - --> $DIR/macro-span-replacement.rs:15:9 + --> $DIR/macro-span-replacement.rs:17:9 | -15 | $b $a; //~ WARN struct is never used +17 | $b $a; //~ WARN struct is never used | ^^^^^^ ... -20 | m!(S struct); +22 | m!(S struct); | ------------- in this macro invocation | note: lint level defined here - --> $DIR/macro-span-replacement.rs:11:9 + --> $DIR/macro-span-replacement.rs:13:9 | -11 | #![warn(unused)] +13 | #![warn(unused)] | ^^^^^^ = note: #[warn(dead_code)] implied by #[warn(unused)] diff --git a/src/test/ui/span/multispan-import-lint.rs b/src/test/ui/span/multispan-import-lint.rs index c3582b0a0c5..5fb0ff7fb70 100644 --- a/src/test/ui/span/multispan-import-lint.rs +++ b/src/test/ui/span/multispan-import-lint.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// must-compile-successfully + #![warn(unused)] use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd}; diff --git a/src/test/ui/span/multispan-import-lint.stderr b/src/test/ui/span/multispan-import-lint.stderr index 1fecdea7d0d..e2c1d9cdc79 100644 --- a/src/test/ui/span/multispan-import-lint.stderr +++ b/src/test/ui/span/multispan-import-lint.stderr @@ -1,13 +1,13 @@ warning: unused imports: `Eq`, `Ord`, `PartialEq`, `PartialOrd` - --> $DIR/multispan-import-lint.rs:13:16 + --> $DIR/multispan-import-lint.rs:15:16 | -13 | use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd}; +15 | use std::cmp::{Eq, Ord, min, PartialEq, PartialOrd}; | ^^ ^^^ ^^^^^^^^^ ^^^^^^^^^^ | note: lint level defined here - --> $DIR/multispan-import-lint.rs:11:9 + --> $DIR/multispan-import-lint.rs:13:9 | -11 | #![warn(unused)] +13 | #![warn(unused)] | ^^^^^^ = note: #[warn(unused_imports)] implied by #[warn(unused)] diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index e7851c36327..1f736e33c8b 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -218,7 +218,7 @@ pub struct TestProps { // testing harness and used when generating compilation // arguments. (In particular, it propagates to the aux-builds.) pub incremental_dir: Option, - // Specifies that a cfail test must actually compile without errors. + // Specifies that a test must actually compile without errors. pub must_compile_successfully: bool, // rustdoc will test the output of the `--test` option pub check_test_line_numbers_match: bool, @@ -359,10 +359,6 @@ impl TestProps { self.forbid_output.push(of); } - if !self.must_compile_successfully { - self.must_compile_successfully = config.parse_must_compile_successfully(ln); - } - if !self.check_test_line_numbers_match { self.check_test_line_numbers_match = config.parse_check_test_line_numbers_match(ln); } @@ -371,6 +367,12 @@ impl TestProps { self.run_pass = config.parse_run_pass(ln); } + if !self.must_compile_successfully { + // run-pass implies must_compile_sucessfully + self.must_compile_successfully = + config.parse_must_compile_successfully(ln) || self.run_pass; + } + if let Some(rule) = config.parse_custom_normalization(ln, "normalize-stdout") { self.normalize_stdout.push(rule); } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index a18f4ec1aad..74da774c6d5 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -147,23 +147,26 @@ impl<'test> TestCx<'test> { assert!(self.revision.is_none(), "init_all invoked for a revision"); } - fn run_cfail_test(&self) { - let proc_res = self.compile_test(); - + fn check_if_test_should_compile(&self, proc_res: &ProcRes) { if self.props.must_compile_successfully { if !proc_res.status.success() { - self.fatal_proc_rec("test compilation failed although it shouldn't!", &proc_res); + self.fatal_proc_rec("test compilation failed although it shouldn't!", proc_res); } } else { if proc_res.status.success() { self.fatal_proc_rec( &format!("{} test compiled successfully!", self.config.mode)[..], - &proc_res, + proc_res, ); } - self.check_correct_failure_status(&proc_res); + self.check_correct_failure_status(proc_res); } + } + + fn run_cfail_test(&self) { + let proc_res = self.compile_test(); + self.check_if_test_should_compile(&proc_res); let output_to_check = self.get_output(&proc_res); let expected_errors = errors::load_errors(&self.testpaths.file, self.revision); @@ -2388,6 +2391,7 @@ impl<'test> TestCx<'test> { .any(|s| s.contains("--error-format")); let proc_res = self.compile_test(); + self.check_if_test_should_compile(&proc_res); let expected_stderr_path = self.expected_output_path(UI_STDERR); let expected_stderr = self.load_expected_output(&expected_stderr_path);