diff options
| author | bors <bors@rust-lang.org> | 2021-11-09 08:21:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-11-09 08:21:10 +0000 |
| commit | 214cd1f228a463b59f73ee46c8ae3b30f85de253 (patch) | |
| tree | 14e0374a49bca45bd553d17d94ec6fb0c530e94d /src/test | |
| parent | 60952bc3da442cf2ea11dcc9c80a461a659bbcd7 (diff) | |
| parent | ebf8966156ab5d2831dd4cd1b34bc5a906d0f895 (diff) | |
Auto merge of #87337 - jyn514:lint-error, r=oli-obk,flip1995
Don't abort compilation after giving a lint error The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors. Closes https://github.com/rust-lang/rust/issues/82761. This is a WIP because I have a feeling it will exit with 0 even if there were lint errors; I don't have a computer that can build rustc locally at the moment.
Diffstat (limited to 'src/test')
26 files changed, 303 insertions, 87 deletions
diff --git a/src/test/ui-fulldeps/lint-tool-test.rs b/src/test/ui-fulldeps/lint-tool-test.rs index f92bcd213b8..0d04eb6fcfa 100644 --- a/src/test/ui-fulldeps/lint-tool-test.rs +++ b/src/test/ui-fulldeps/lint-tool-test.rs @@ -10,10 +10,12 @@ //~^ WARNING lint name `test_lint` is deprecated and may not have an effect in the future //~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future //~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future +//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future #![deny(clippy_group)] //~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future //~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future //~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future +//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future fn lintme() { } //~ ERROR item is named 'lintme' @@ -30,6 +32,7 @@ pub fn main() { //~^ WARNING lint name `test_group` is deprecated and may not have an effect in the future //~| WARNING lint name `test_group` is deprecated and may not have an effect in the future //~| WARNING lint name `test_group` is deprecated and may not have an effect in the future +//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future #[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist` fn hello() { fn lintmetoo() { } diff --git a/src/test/ui-fulldeps/lint-tool-test.stderr b/src/test/ui-fulldeps/lint-tool-test.stderr index 2260477a91d..0f76384ed5b 100644 --- a/src/test/ui-fulldeps/lint-tool-test.stderr +++ b/src/test/ui-fulldeps/lint-tool-test.stderr @@ -7,19 +7,19 @@ LL | #![cfg_attr(foo, warn(test_lint))] = note: `#[warn(renamed_and_removed_lints)]` on by default warning: lint name `clippy_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:13:9 + --> $DIR/lint-tool-test.rs:14:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ help: change it to: `clippy::group` warning: lint name `test_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:29:9 + --> $DIR/lint-tool-test.rs:31:9 | LL | #[allow(test_group)] | ^^^^^^^^^^ help: change it to: `clippy::test_group` warning: unknown lint: `this_lint_does_not_exist` - --> $DIR/lint-tool-test.rs:33:8 + --> $DIR/lint-tool-test.rs:36:8 | LL | #[deny(this_lint_does_not_exist)] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -33,13 +33,13 @@ LL | #![cfg_attr(foo, warn(test_lint))] | ^^^^^^^^^ help: change it to: `clippy::test_lint` warning: lint name `clippy_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:13:9 + --> $DIR/lint-tool-test.rs:14:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ help: change it to: `clippy::group` warning: lint name `test_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:29:9 + --> $DIR/lint-tool-test.rs:31:9 | LL | #[allow(test_group)] | ^^^^^^^^^^ help: change it to: `clippy::test_group` @@ -59,42 +59,60 @@ LL | #![cfg_attr(foo, warn(test_lint))] | ^^^^^^^^^ help: change it to: `clippy::test_lint` warning: lint name `clippy_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:13:9 + --> $DIR/lint-tool-test.rs:14:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ help: change it to: `clippy::group` error: item is named 'lintme' - --> $DIR/lint-tool-test.rs:18:1 + --> $DIR/lint-tool-test.rs:20:1 | LL | fn lintme() { } | ^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/lint-tool-test.rs:13:9 + --> $DIR/lint-tool-test.rs:14:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ = note: `#[deny(clippy::test_lint)]` implied by `#[deny(clippy::group)]` error: item is named 'lintmetoo' - --> $DIR/lint-tool-test.rs:26:5 + --> $DIR/lint-tool-test.rs:28:5 | LL | fn lintmetoo() { } | ^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/lint-tool-test.rs:13:9 + --> $DIR/lint-tool-test.rs:14:9 | LL | #![deny(clippy_group)] | ^^^^^^^^^^^^ = note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]` warning: lint name `test_group` is deprecated and may not have an effect in the future. - --> $DIR/lint-tool-test.rs:29:9 + --> $DIR/lint-tool-test.rs:31:9 | LL | #[allow(test_group)] | ^^^^^^^^^^ help: change it to: `clippy::test_group` -error: aborting due to 2 previous errors; 11 warnings emitted +warning: lint name `test_lint` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:9:23 + | +LL | #![cfg_attr(foo, warn(test_lint))] + | ^^^^^^^^^ help: change it to: `clippy::test_lint` + +warning: lint name `clippy_group` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:14:9 + | +LL | #![deny(clippy_group)] + | ^^^^^^^^^^^^ help: change it to: `clippy::group` + +warning: lint name `test_group` is deprecated and may not have an effect in the future. + --> $DIR/lint-tool-test.rs:31:9 + | +LL | #[allow(test_group)] + | ^^^^^^^^^^ help: change it to: `clippy::test_group` + +error: aborting due to 2 previous errors; 14 warnings emitted diff --git a/src/test/ui/deprecation/deprecation-lint.rs b/src/test/ui/deprecation/deprecation-lint.rs index 35e42a6857f..9bde2ca1942 100644 --- a/src/test/ui/deprecation/deprecation-lint.rs +++ b/src/test/ui/deprecation/deprecation-lint.rs @@ -278,6 +278,7 @@ mod this_crate { let _ = nested::DeprecatedStruct { //~^ ERROR use of deprecated struct `this_crate::nested::DeprecatedStruct`: text i: 0 //~ ERROR use of deprecated field `this_crate::nested::DeprecatedStruct::i`: text + //~| ERROR field `i` of struct `this_crate::nested::DeprecatedStruct` is private }; let _ = nested::DeprecatedUnitStruct; //~ ERROR use of deprecated unit struct `this_crate::nested::DeprecatedUnitStruct`: text diff --git a/src/test/ui/deprecation/deprecation-lint.stderr b/src/test/ui/deprecation/deprecation-lint.stderr index 20af4f62e65..5d716fa625e 100644 --- a/src/test/ui/deprecation/deprecation-lint.stderr +++ b/src/test/ui/deprecation/deprecation-lint.stderr @@ -257,97 +257,97 @@ LL | let _ = nested::DeprecatedStruct { | ^^^^^^^^^^^^^^^^ error: use of deprecated unit struct `this_crate::nested::DeprecatedUnitStruct`: text - --> $DIR/deprecation-lint.rs:283:25 + --> $DIR/deprecation-lint.rs:284:25 | LL | let _ = nested::DeprecatedUnitStruct; | ^^^^^^^^^^^^^^^^^^^^ error: use of deprecated unit variant `this_crate::nested::Enum::DeprecatedVariant`: text - --> $DIR/deprecation-lint.rs:285:31 + --> $DIR/deprecation-lint.rs:286:31 | LL | ... let _ = nested::Enum::DeprecatedVariant; | ^^^^^^^^^^^^^^^^^ error: use of deprecated tuple struct `this_crate::nested::DeprecatedTupleStruct`: text - --> $DIR/deprecation-lint.rs:287:25 + --> $DIR/deprecation-lint.rs:288:25 | LL | ... let _ = nested::DeprecatedTupleStruct (1); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text - --> $DIR/deprecation-lint.rs:292:16 + --> $DIR/deprecation-lint.rs:293:16 | LL | Trait::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text - --> $DIR/deprecation-lint.rs:294:25 + --> $DIR/deprecation-lint.rs:295:25 | LL | <Foo as Trait>::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - --> $DIR/deprecation-lint.rs:296:16 + --> $DIR/deprecation-lint.rs:297:16 | LL | Trait::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - --> $DIR/deprecation-lint.rs:298:25 + --> $DIR/deprecation-lint.rs:299:25 | LL | ... <Foo as Trait>::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated function `this_crate::test_fn_closure_body::{closure#0}::bar` - --> $DIR/deprecation-lint.rs:316:13 + --> $DIR/deprecation-lint.rs:317:13 | LL | bar(); | ^^^ error: use of deprecated trait `this_crate::DeprecatedTrait`: text - --> $DIR/deprecation-lint.rs:335:10 + --> $DIR/deprecation-lint.rs:336:10 | LL | impl DeprecatedTrait for S { } | ^^^^^^^^^^^^^^^ error: use of deprecated trait `this_crate::DeprecatedTrait`: text - --> $DIR/deprecation-lint.rs:337:24 + --> $DIR/deprecation-lint.rs:338:24 | LL | trait LocalTrait : DeprecatedTrait { } | ^^^^^^^^^^^^^^^ error: use of deprecated struct `this_crate2::Deprecated`: text - --> $DIR/deprecation-lint.rs:389:17 + --> $DIR/deprecation-lint.rs:390:17 | LL | let x = Deprecated { | ^^^^^^^^^^ error: use of deprecated struct `this_crate2::Deprecated`: text - --> $DIR/deprecation-lint.rs:398:13 + --> $DIR/deprecation-lint.rs:399:13 | LL | let Deprecated { | ^^^^^^^^^^ error: use of deprecated struct `this_crate2::Deprecated`: text - --> $DIR/deprecation-lint.rs:404:13 + --> $DIR/deprecation-lint.rs:405:13 | LL | let Deprecated | ^^^^^^^^^^ error: use of deprecated tuple struct `this_crate2::Deprecated2`: text - --> $DIR/deprecation-lint.rs:409:17 + --> $DIR/deprecation-lint.rs:410:17 | LL | let x = Deprecated2(1, 2, 3); | ^^^^^^^^^^^ error: use of deprecated tuple struct `this_crate2::Deprecated2`: text - --> $DIR/deprecation-lint.rs:419:13 + --> $DIR/deprecation-lint.rs:420:13 | LL | let Deprecated2 | ^^^^^^^^^^^ error: use of deprecated tuple struct `this_crate2::Deprecated2`: text - --> $DIR/deprecation-lint.rs:428:13 + --> $DIR/deprecation-lint.rs:429:13 | LL | let Deprecated2 | ^^^^^^^^^^^ @@ -617,124 +617,131 @@ LL | i: 0 | ^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text - --> $DIR/deprecation-lint.rs:291:13 + --> $DIR/deprecation-lint.rs:292:13 | LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text - --> $DIR/deprecation-lint.rs:293:16 + --> $DIR/deprecation-lint.rs:294:16 | LL | <Foo>::trait_deprecated(&foo); | ^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - --> $DIR/deprecation-lint.rs:295:13 + --> $DIR/deprecation-lint.rs:296:13 | LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - --> $DIR/deprecation-lint.rs:297:16 + --> $DIR/deprecation-lint.rs:298:16 | LL | <Foo>::trait_deprecated_text(&foo); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated`: text - --> $DIR/deprecation-lint.rs:302:13 + --> $DIR/deprecation-lint.rs:303:13 | LL | foo.trait_deprecated(); | ^^^^^^^^^^^^^^^^ error: use of deprecated associated function `this_crate::Trait::trait_deprecated_text`: text - --> $DIR/deprecation-lint.rs:303:13 + --> $DIR/deprecation-lint.rs:304:13 | LL | foo.trait_deprecated_text(); | ^^^^^^^^^^^^^^^^^^^^^ error: use of deprecated field `this_crate2::Stable::override2`: text - --> $DIR/deprecation-lint.rs:362:13 + --> $DIR/deprecation-lint.rs:363:13 | LL | override2: 3, | ^^^^^^^^^^^^ error: use of deprecated field `this_crate2::Stable::override2`: text - --> $DIR/deprecation-lint.rs:366:17 + --> $DIR/deprecation-lint.rs:367:17 | LL | let _ = x.override2; | ^^^^^^^^^^^ error: use of deprecated field `this_crate2::Stable::override2`: text - --> $DIR/deprecation-lint.rs:370:13 + --> $DIR/deprecation-lint.rs:371:13 | LL | override2: _ | ^^^^^^^^^^^^ error: use of deprecated field `this_crate2::Stable2::2`: text - --> $DIR/deprecation-lint.rs:378:17 + --> $DIR/deprecation-lint.rs:379:17 | LL | let _ = x.2; | ^^^ error: use of deprecated field `this_crate2::Stable2::2`: text - --> $DIR/deprecation-lint.rs:383:20 + --> $DIR/deprecation-lint.rs:384:20 | LL | _) | ^ error: use of deprecated field `this_crate2::Deprecated::inherit`: text - --> $DIR/deprecation-lint.rs:391:13 + --> $DIR/deprecation-lint.rs:392:13 | LL | inherit: 1, | ^^^^^^^^^^ error: use of deprecated field `this_crate2::Deprecated::inherit`: text - --> $DIR/deprecation-lint.rs:395:17 + --> $DIR/deprecation-lint.rs:396:17 | LL | let _ = x.inherit; | ^^^^^^^^^ error: use of deprecated field `this_crate2::Deprecated::inherit`: text - --> $DIR/deprecation-lint.rs:400:13 + --> $DIR/deprecation-lint.rs:401:13 | LL | inherit: _, | ^^^^^^^^^^ error: use of deprecated field `this_crate2::Deprecated2::0`: text - --> $DIR/deprecation-lint.rs:412:17 + --> $DIR/deprecation-lint.rs:413:17 | LL | let _ = x.0; | ^^^ error: use of deprecated field `this_crate2::Deprecated2::1`: text - --> $DIR/deprecation-lint.rs:414:17 + --> $DIR/deprecation-lint.rs:415:17 | LL | let _ = x.1; | ^^^ error: use of deprecated field `this_crate2::Deprecated2::2`: text - --> $DIR/deprecation-lint.rs:416:17 + --> $DIR/deprecation-lint.rs:417:17 | LL | let _ = x.2; | ^^^ error: use of deprecated field `this_crate2::Deprecated2::0`: text - --> $DIR/deprecation-lint.rs:421:14 + --> $DIR/deprecation-lint.rs:422:14 | LL | (_, | ^ error: use of deprecated field `this_crate2::Deprecated2::1`: text - --> $DIR/deprecation-lint.rs:423:14 + --> $DIR/deprecation-lint.rs:424:14 | LL | _, | ^ error: use of deprecated field `this_crate2::Deprecated2::2`: text - --> $DIR/deprecation-lint.rs:425:14 + --> $DIR/deprecation-lint.rs:426:14 | LL | _) | ^ -error: aborting due to 122 previous errors +error[E0451]: field `i` of struct `this_crate::nested::DeprecatedStruct` is private + --> $DIR/deprecation-lint.rs:280:13 + | +LL | i: 0 + | ^^^^ private field + +error: aborting due to 123 previous errors +For more information about this error, try `rustc --explain E0451`. diff --git a/src/test/ui/impl-trait/where-allowed.rs b/src/test/ui/impl-trait/where-allowed.rs index 4605e76ac96..35fb42d6213 100644 --- a/src/test/ui/impl-trait/where-allowed.rs +++ b/src/test/ui/impl-trait/where-allowed.rs @@ -235,6 +235,7 @@ impl <T = impl Debug> T {} //~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions //~| WARNING this was previously accepted by the compiler but is being phased out //~| ERROR `impl Trait` not allowed outside of function and method return types +//~| ERROR no nominal type found // Disallowed fn in_method_generic_param_default<T = impl Debug>(_: T) {} diff --git a/src/test/ui/impl-trait/where-allowed.stderr b/src/test/ui/impl-trait/where-allowed.stderr index 7f11d30dbaa..236cf449e85 100644 --- a/src/test/ui/impl-trait/where-allowed.stderr +++ b/src/test/ui/impl-trait/where-allowed.stderr @@ -272,19 +272,19 @@ LL | impl <T = impl Debug> T {} | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and method return types - --> $DIR/where-allowed.rs:240:40 + --> $DIR/where-allowed.rs:241:40 | LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {} | ^^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and method return types - --> $DIR/where-allowed.rs:246:29 + --> $DIR/where-allowed.rs:247:29 | LL | let _in_local_variable: impl Fn() = || {}; | ^^^^^^^^^ error[E0562]: `impl Trait` not allowed outside of function and method return types - --> $DIR/where-allowed.rs:248:46 + --> $DIR/where-allowed.rs:249:46 | LL | let _in_return_in_local_variable = || -> impl Fn() { || {} }; | ^^^^^^^^^ @@ -300,7 +300,7 @@ LL | impl <T = impl Debug> T {} = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions - --> $DIR/where-allowed.rs:240:36 + --> $DIR/where-allowed.rs:241:36 | LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {} | ^ @@ -308,7 +308,15 @@ LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {} = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887> -error: aborting due to 48 previous errors +error[E0118]: no nominal type found for inherent implementation + --> $DIR/where-allowed.rs:234:23 + | +LL | impl <T = impl Debug> T {} + | ^ impl requires a nominal type + | + = note: either implement a trait on it or create a newtype to wrap it instead + +error: aborting due to 49 previous errors -Some errors have detailed explanations: E0562, E0658, E0666. -For more information about an error, try `rustc --explain E0562`. +Some errors have detailed explanations: E0118, E0562, E0658, E0666. +For more information about an error, try `rustc --explain E0118`. diff --git a/src/test/ui/issues/issue-7246.rs b/src/test/ui/issues/issue-7246.rs index bf2794eb632..7b16fa024f8 100644 --- a/src/test/ui/issues/issue-7246.rs +++ b/src/test/ui/issues/issue-7246.rs @@ -5,6 +5,7 @@ use std::ptr; pub unsafe fn g() { return; if *ptr::null() {}; //~ ERROR unreachable + //~| WARNING dereferencing a null pointer } pub fn main() {} diff --git a/src/test/ui/issues/issue-7246.stderr b/src/test/ui/issues/issue-7246.stderr index bb0221ecb86..a9bf2bf763d 100644 --- a/src/test/ui/issues/issue-7246.stderr +++ b/src/test/ui/issues/issue-7246.stderr @@ -12,5 +12,13 @@ note: the lint level is defined here LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ -error: aborting due to previous error +warning: dereferencing a null pointer + --> $DIR/issue-7246.rs:7:8 + | +LL | if *ptr::null() {}; + | ^^^^^^^^^^^^ this code causes undefined behavior when executed + | + = note: `#[warn(deref_nullptr)]` on by default + +error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/lint/crate_level_only_lint.rs b/src/test/ui/lint/crate_level_only_lint.rs index 38c5487183c..d9673faa214 100644 --- a/src/test/ui/lint/crate_level_only_lint.rs +++ b/src/test/ui/lint/crate_level_only_lint.rs @@ -4,10 +4,12 @@ mod foo { #![allow(uncommon_codepoints)] //~^ ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] //~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] +//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] #[allow(uncommon_codepoints)] //~^ ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] //~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] +//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] const BAR: f64 = 0.000001; } @@ -15,5 +17,6 @@ const BAR: f64 = 0.000001; #[allow(uncommon_codepoints)] //~^ ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] //~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] +//~| ERROR allow(uncommon_codepoints) is ignored unless specified at crate level [unused_attributes] fn main() { } diff --git a/src/test/ui/lint/crate_level_only_lint.stderr b/src/test/ui/lint/crate_level_only_lint.stderr index 83bea0412ff..8fb06df2a48 100644 --- a/src/test/ui/lint/crate_level_only_lint.stderr +++ b/src/test/ui/lint/crate_level_only_lint.stderr @@ -11,13 +11,13 @@ LL | #![deny(uncommon_codepoints, unused_attributes)] | ^^^^^^^^^^^^^^^^^ error: allow(uncommon_codepoints) is ignored unless specified at crate level - --> $DIR/crate_level_only_lint.rs:8:9 + --> $DIR/crate_level_only_lint.rs:9:9 | LL | #[allow(uncommon_codepoints)] | ^^^^^^^^^^^^^^^^^^^ error: allow(uncommon_codepoints) is ignored unless specified at crate level - --> $DIR/crate_level_only_lint.rs:15:9 + --> $DIR/crate_level_only_lint.rs:17:9 | LL | #[allow(uncommon_codepoints)] | ^^^^^^^^^^^^^^^^^^^ @@ -29,16 +29,34 @@ LL | #![allow(uncommon_codepoints)] | ^^^^^^^^^^^^^^^^^^^ error: allow(uncommon_codepoints) is ignored unless specified at crate level - --> $DIR/crate_level_only_lint.rs:8:9 + --> $DIR/crate_level_only_lint.rs:9:9 | LL | #[allow(uncommon_codepoints)] | ^^^^^^^^^^^^^^^^^^^ error: allow(uncommon_codepoints) is ignored unless specified at crate level - --> $DIR/crate_level_only_lint.rs:15:9 + --> $DIR/crate_level_only_lint.rs:17:9 | LL | #[allow(uncommon_codepoints)] | ^^^^^^^^^^^^^^^^^^^ -error: aborting due to 6 previous errors +error: allow(uncommon_codepoints) is ignored unless specified at crate level + --> $DIR/crate_level_only_lint.rs:4:10 + | +LL | #![allow(uncommon_codepoints)] + | ^^^^^^^^^^^^^^^^^^^ + +error: allow(uncommon_codepoints) is ignored unless specified at crate level + --> $DIR/crate_level_only_lint.rs:9:9 + | +LL | #[allow(uncommon_codepoints)] + | ^^^^^^^^^^^^^^^^^^^ + +error: allow(uncommon_codepoints) is ignored unless specified at crate level + --> $DIR/crate_level_only_lint.rs:17:9 + | +LL | #[allow(uncommon_codepoints)] + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 9 previous errors diff --git a/src/test/ui/lint/forbid-group-group-2.rs b/src/test/ui/lint/forbid-group-group-2.rs index 7d8a3981814..b12fd72da74 100644 --- a/src/test/ui/lint/forbid-group-group-2.rs +++ b/src/test/ui/lint/forbid-group-group-2.rs @@ -17,4 +17,10 @@ //~| WARNING previously accepted by the compiler //~| ERROR incompatible with previous //~| WARNING previously accepted by the compiler +//~| ERROR incompatible with previous +//~| WARNING previously accepted by the compiler +//~| ERROR incompatible with previous +//~| WARNING previously accepted by the compiler +//~| ERROR incompatible with previous +//~| WARNING previously accepted by the compiler fn main() {} diff --git a/src/test/ui/lint/forbid-group-group-2.stderr b/src/test/ui/lint/forbid-group-group-2.stderr index d8c09e6526a..214e949c11a 100644 --- a/src/test/ui/lint/forbid-group-group-2.stderr +++ b/src/test/ui/lint/forbid-group-group-2.stderr @@ -75,5 +75,41 @@ LL | #[allow(nonstandard_style)] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670> -error: aborting due to 6 previous errors +error: allow(nonstandard_style) incompatible with previous forbid + --> $DIR/forbid-group-group-2.rs:7:9 + | +LL | #![forbid(warnings)] + | -------- `forbid` level set here +... +LL | #[allow(nonstandard_style)] + | ^^^^^^^^^^^^^^^^^ overruled by previous forbid + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670> + +error: allow(nonstandard_style) incompatible with previous forbid + --> $DIR/forbid-group-group-2.rs:7:9 + | +LL | #![forbid(warnings)] + | -------- `forbid` level set here +... +LL | #[allow(nonstandard_style)] + | ^^^^^^^^^^^^^^^^^ overruled by previous forbid + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670> + +error: allow(nonstandard_style) incompatible with previous forbid + --> $DIR/forbid-group-group-2.rs:7:9 + | +LL | #![forbid(warnings)] + | -------- `forbid` level set here +... +LL | #[allow(nonstandard_style)] + | ^^^^^^^^^^^^^^^^^ overruled by previous forbid + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670> + +error: aborting due to 9 previous errors diff --git a/src/test/ui/lint/lint-forbid-internal-unsafe.rs b/src/test/ui/lint/lint-forbid-internal-unsafe.rs index b08fbf6f845..3ee55ba96b1 100644 --- a/src/test/ui/lint/lint-forbid-internal-unsafe.rs +++ b/src/test/ui/lint/lint-forbid-internal-unsafe.rs @@ -13,4 +13,5 @@ macro_rules! evil { fn main() { println!("{}", evil!(*(0 as *const u8))); + //~^ WARNING dereferencing a null pointer } diff --git a/src/test/ui/lint/lint-forbid-internal-unsafe.stderr b/src/test/ui/lint/lint-forbid-internal-unsafe.stderr index e31c003985e..ba425ceb442 100644 --- a/src/test/ui/lint/lint-forbid-internal-unsafe.stderr +++ b/src/test/ui/lint/lint-forbid-internal-unsafe.stderr @@ -10,5 +10,13 @@ note: the lint level is defined here LL | #![forbid(unsafe_code)] | ^^^^^^^^^^^ -error: aborting due to previous error +warning: dereferencing a null pointer + --> $DIR/lint-forbid-internal-unsafe.rs:15:26 + | +LL | println!("{}", evil!(*(0 as *const u8))); + | ^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed + | + = note: `#[warn(deref_nullptr)]` on by default + +error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.rs b/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.rs index 81a3427a102..ed8e7ddddc5 100644 --- a/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.rs +++ b/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.rs @@ -1,6 +1,7 @@ #![deny(uncommon_codepoints)] const µ: f64 = 0.000001; //~ ERROR identifier contains uncommon Unicode codepoints +//~| WARNING should have an upper case name fn dijkstra() {} //~ ERROR identifier contains uncommon Unicode codepoints diff --git a/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr b/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr index d435282a6e8..0533da03068 100644 --- a/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr +++ b/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-uncommon-codepoints.stderr @@ -11,16 +11,24 @@ LL | #![deny(uncommon_codepoints)] | ^^^^^^^^^^^^^^^^^^^ error: identifier contains uncommon Unicode codepoints - --> $DIR/lint-uncommon-codepoints.rs:5:4 + --> $DIR/lint-uncommon-codepoints.rs:6:4 | LL | fn dijkstra() {} | ^^^^^^^ error: identifier contains uncommon Unicode codepoints - --> $DIR/lint-uncommon-codepoints.rs:8:9 + --> $DIR/lint-uncommon-codepoints.rs:9:9 | LL | let ㇻㇲㇳ = "rust"; | ^^^^^^ -error: aborting due to 3 previous errors +warning: constant `µ` should have an upper case name + --> $DIR/lint-uncommon-codepoints.rs:3:7 + | +LL | const µ: f64 = 0.000001; + | ^ help: convert the identifier to upper case: `Μ` + | + = note: `#[warn(non_upper_case_globals)]` on by default + +error: aborting due to 3 previous errors; 1 warning emitted diff --git a/src/test/ui/reachable/expr_cast.rs b/src/test/ui/reachable/expr_cast.rs index f53bcb97e69..e8e477ea4f6 100644 --- a/src/test/ui/reachable/expr_cast.rs +++ b/src/test/ui/reachable/expr_cast.rs @@ -7,6 +7,7 @@ fn a() { // the cast is unreachable: let x = {return} as !; //~ ERROR unreachable + //~| ERROR non-primitive cast } fn main() { } diff --git a/src/test/ui/reachable/expr_cast.stderr b/src/test/ui/reachable/expr_cast.stderr index 3aa15bde995..6643f1784a1 100644 --- a/src/test/ui/reachable/expr_cast.stderr +++ b/src/test/ui/reachable/expr_cast.stderr @@ -13,5 +13,12 @@ note: the lint level is defined here LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^ -error: aborting due to previous error +error[E0605]: non-primitive cast: `()` as `!` + --> $DIR/expr_cast.rs:9:13 + | +LL | let x = {return} as !; + | ^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0605`. diff --git a/src/test/ui/stability-attribute/stability-attribute-trait-impl.rs b/src/test/ui/stability-attribute/stability-attribute-trait-impl.rs index 656564fc9e3..ce2726ffde4 100644 --- a/src/test/ui/stability-attribute/stability-attribute-trait-impl.rs +++ b/src/test/ui/stability-attribute/stability-attribute-trait-impl.rs @@ -1,27 +1,28 @@ #![feature(staged_api)] +//~^ ERROR module has missing stability attribute -#[stable(feature = "x", since = "1")] +#[stable(feature = "a", since = "1")] struct StableType; -#[unstable(feature = "x", issue = "none")] +#[unstable(feature = "b", issue = "none")] struct UnstableType; -#[stable(feature = "x", since = "1")] +#[stable(feature = "c", since = "1")] trait StableTrait {} -#[unstable(feature = "x", issue = "none")] +#[unstable(feature = "d", issue = "none")] trait UnstableTrait {} -#[unstable(feature = "x", issue = "none")] +#[unstable(feature = "e", issue = "none")] impl UnstableTrait for UnstableType {} -#[unstable(feature = "x", issue = "none")] +#[unstable(feature = "f", issue = "none")] impl StableTrait for UnstableType {} -#[unstable(feature = "x", issue = "none")] +#[unstable(feature = "g", issue = "none")] impl UnstableTrait for StableType {} -#[unstable(feature = "x", issue = "none")] +#[unstable(feature = "h", issue = "none")] //~^ ERROR an `#[unstable]` annotation here has no effect [ineffective_unstable_trait_impl] impl StableTrait for StableType {} diff --git a/src/test/ui/stability-attribute/stability-attribute-trait-impl.stderr b/src/test/ui/stability-attribute/stability-attribute-trait-impl.stderr index a11479cc8f4..310f02024ca 100644 --- a/src/test/ui/stability-attribute/stability-attribute-trait-impl.stderr +++ b/src/test/ui/stability-attribute/stability-attribute-trait-impl.stderr @@ -1,11 +1,23 @@ error: an `#[unstable]` annotation here has no effect - --> $DIR/stability-attribute-trait-impl.rs:24:1 + --> $DIR/stability-attribute-trait-impl.rs:25:1 | -LL | #[unstable(feature = "x", issue = "none")] +LL | #[unstable(feature = "h", issue = "none")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[deny(ineffective_unstable_trait_impl)]` on by default = note: see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information -error: aborting due to previous error +error: module has missing stability attribute + --> $DIR/stability-attribute-trait-impl.rs:1:1 + | +LL | / #![feature(staged_api)] +LL | | +LL | | +LL | | #[stable(feature = "a", since = "1")] +... | +LL | | +LL | | fn main() {} + | |____________^ + +error: aborting due to 2 previous errors diff --git a/src/test/ui/statics/uninhabited-static.rs b/src/test/ui/statics/uninhabited-static.rs index cc78f6cfa53..d5645474891 100644 --- a/src/test/ui/statics/uninhabited-static.rs +++ b/src/test/ui/statics/uninhabited-static.rs @@ -11,7 +11,11 @@ extern { static VOID2: Void = unsafe { std::mem::transmute(()) }; //~ ERROR static of uninhabited type //~| WARN: previously accepted +//~| ERROR undefined behavior to use this value +//~| WARN: type `Void` does not permit zero-initialization static NEVER2: Void = unsafe { std::mem::transmute(()) }; //~ ERROR static of uninhabited type //~| WARN: previously accepted +//~| ERROR undefined behavior to use this value +//~| WARN: type `Void` does not permit zero-initialization fn main() {} diff --git a/src/test/ui/statics/uninhabited-static.stderr b/src/test/ui/statics/uninhabited-static.stderr index 5d95b299938..c38cf10d6e6 100644 --- a/src/test/ui/statics/uninhabited-static.stderr +++ b/src/test/ui/statics/uninhabited-static.stderr @@ -34,7 +34,7 @@ LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; = note: uninhabited statics cannot be initialized, and any access would be an immediate error error: static of uninhabited type - --> $DIR/uninhabited-static.rs:14:1 + --> $DIR/uninhabited-static.rs:16:1 | LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -43,5 +43,47 @@ LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; = note: for more information, see issue #74840 <https://github.com/rust-lang/rust/issues/74840> = note: uninhabited statics cannot be initialized, and any access would be an immediate error -error: aborting due to 4 previous errors +error[E0080]: it is undefined behavior to use this value + --> $DIR/uninhabited-static.rs:12:1 + | +LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Void + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 0, align: 1) {} + +error[E0080]: it is undefined behavior to use this value + --> $DIR/uninhabited-static.rs:16:1 + | +LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Void + | + = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. + = note: the raw bytes of the constant (size: 0, align: 1) {} + +warning: the type `Void` does not permit zero-initialization + --> $DIR/uninhabited-static.rs:12:31 + | +LL | static VOID2: Void = unsafe { std::mem::transmute(()) }; + | ^^^^^^^^^^^^^^^^^^^^^^^ + | | + | this code causes undefined behavior when executed + | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done + | + = note: `#[warn(invalid_value)]` on by default + = note: enums with no variants have no valid value + +warning: the type `Void` does not permit zero-initialization + --> $DIR/uninhabited-static.rs:16:32 + | +LL | static NEVER2: Void = unsafe { std::mem::transmute(()) }; + | ^^^^^^^^^^^^^^^^^^^^^^^ + | | + | this code causes undefined behavior when executed + | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done + | + = note: enums with no variants have no valid value + +error: aborting due to 6 previous errors; 2 warnings emitted +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.rs b/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.rs index 5f3b711b31a..acbf15dcb6c 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.rs +++ b/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.rs @@ -31,7 +31,10 @@ impl Tr for E { type V = u8; fn f() -> Self::V { 0 } //~^ ERROR ambiguous associated item + //~| ERROR ambiguous associated item //~| WARN this was previously accepted + //~| WARN this was previously accepted + //~| HELP use fully-qualified syntax //~| HELP use fully-qualified syntax } diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr b/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr index 870b1eec48c..f007f71a73c 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr +++ b/src/test/ui/type-alias-enum-variants/enum-variant-priority-lint-ambiguous_associated_items.stderr @@ -18,5 +18,24 @@ note: `V` could also refer to the associated type defined here LL | type V; | ^^^^^^^ -error: aborting due to previous error +error: ambiguous associated item + --> $DIR/enum-variant-priority-lint-ambiguous_associated_items.rs:32:15 + | +LL | fn f() -> Self::V { 0 } + | ^^^^^^^ help: use fully-qualified syntax: `<E as Tr>::V` + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #57644 <https://github.com/rust-lang/rust/issues/57644> +note: `V` could refer to the variant defined here + --> $DIR/enum-variant-priority-lint-ambiguous_associated_items.rs:22:5 + | +LL | V + | ^ +note: `V` could also refer to the associated type defined here + --> $DIR/enum-variant-priority-lint-ambiguous_associated_items.rs:26:5 + | +LL | type V; + | ^^^^^^^ + +error: aborting due to 2 previous errors diff --git a/src/test/ui/use/use-nested-groups-unused-imports.rs b/src/test/ui/use/use-nested-groups-unused-imports.rs index 5fe85954dc8..ca6b8ba94d1 100644 --- a/src/test/ui/use/use-nested-groups-unused-imports.rs +++ b/src/test/ui/use/use-nested-groups-unused-imports.rs @@ -1,4 +1,3 @@ -#![feature(use_nested_groups)] #![allow(dead_code)] #![deny(unused_imports)] diff --git a/src/test/ui/use/use-nested-groups-unused-imports.stderr b/src/test/ui/use/use-nested-groups-unused-imports.stderr index 987d1dcf5f0..6610f8ecd4a 100644 --- a/src/test/ui/use/use-nested-groups-unused-imports.stderr +++ b/src/test/ui/use/use-nested-groups-unused-imports.stderr @@ -1,23 +1,23 @@ error: unused imports: `*`, `Foo`, `baz::{}`, `foobar::*` - --> $DIR/use-nested-groups-unused-imports.rs:16:11 + --> $DIR/use-nested-groups-unused-imports.rs:15:11 | LL | use foo::{Foo, bar::{baz::{}, foobar::*}, *}; | ^^^ ^^^^^^^ ^^^^^^^^^ ^ | note: the lint level is defined here - --> $DIR/use-nested-groups-unused-imports.rs:3:9 + --> $DIR/use-nested-groups-unused-imports.rs:2:9 | LL | #![deny(unused_imports)] | ^^^^^^^^^^^^^^ error: unused import: `*` - --> $DIR/use-nested-groups-unused-imports.rs:18:24 + --> $DIR/use-nested-groups-unused-imports.rs:17:24 | LL | use foo::bar::baz::{*, *}; | ^ error: unused import: `foo::{}` - --> $DIR/use-nested-groups-unused-imports.rs:20:5 + --> $DIR/use-nested-groups-unused-imports.rs:19:5 | LL | use foo::{}; | ^^^^^^^ |
