diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:13:23 +0000 |
commit | 20431706a863f92cb37dc512fef6e48d192aaf2c (patch) | |
tree | 2867f13f5fd5437ba628c67d7f87309ccadcd286 /src/test/ui/lint | |
parent | Releasing progress-linux version 1.65.0+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-20431706a863f92cb37dc512fef6e48d192aaf2c.tar.xz rustc-20431706a863f92cb37dc512fef6e48d192aaf2c.zip |
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/lint')
127 files changed, 844 insertions, 465 deletions
diff --git a/src/test/ui/lint/auxiliary/trivial-cast-ice.rs b/src/test/ui/lint/auxiliary/trivial-cast-ice.rs new file mode 100644 index 000000000..ab2332d06 --- /dev/null +++ b/src/test/ui/lint/auxiliary/trivial-cast-ice.rs @@ -0,0 +1,7 @@ +#[macro_export] +macro_rules! foo { + () => { + let x: &Option<i32> = &Some(1); + let _y = x as *const Option<i32>; + } +} diff --git a/src/test/ui/lint/bare-trait-objects-path.stderr b/src/test/ui/lint/bare-trait-objects-path.stderr index 4b8c2b539..8ed303ca6 100644 --- a/src/test/ui/lint/bare-trait-objects-path.stderr +++ b/src/test/ui/lint/bare-trait-objects-path.stderr @@ -4,9 +4,9 @@ warning: trait objects without an explicit `dyn` are deprecated LL | let _: Dyn::Ty; | ^^^ | - = note: `#[warn(bare_trait_objects)]` on by default = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> + = note: `#[warn(bare_trait_objects)]` on by default help: use `dyn` | LL | let _: <dyn Dyn>::Ty; diff --git a/src/test/ui/lint/clashing-extern-fn.stderr b/src/test/ui/lint/clashing-extern-fn.stderr index 4607f6849..217eed6c9 100644 --- a/src/test/ui/lint/clashing-extern-fn.stderr +++ b/src/test/ui/lint/clashing-extern-fn.stderr @@ -7,13 +7,13 @@ LL | fn clash(x: u8); LL | fn clash(x: u64); | ^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | + = note: expected `unsafe extern "C" fn(u8)` + found `unsafe extern "C" fn(u64)` note: the lint level is defined here --> $DIR/clashing-extern-fn.rs:4:9 | LL | #![warn(clashing_extern_declarations)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected `unsafe extern "C" fn(u8)` - found `unsafe extern "C" fn(u64)` warning: `extern_link_name` redeclared with a different signature --> $DIR/clashing-extern-fn.rs:52:9 @@ -219,9 +219,9 @@ warning: `extern` block uses type `Option<TransparentNoNiche>`, which is not FFI LL | fn hidden_niche_transparent_no_niche() -> Option<TransparentNoNiche>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe | - = note: `#[warn(improper_ctypes)]` on by default = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint + = note: `#[warn(improper_ctypes)]` on by default warning: `extern` block uses type `Option<UnsafeCell<NonZeroUsize>>`, which is not FFI-safe --> $DIR/clashing-extern-fn.rs:412:46 diff --git a/src/test/ui/lint/cli-lint-override.forbid_warn.stderr b/src/test/ui/lint/cli-lint-override.forbid_warn.stderr index ff4dc4abc..d1c66a81c 100644 --- a/src/test/ui/lint/cli-lint-override.forbid_warn.stderr +++ b/src/test/ui/lint/cli-lint-override.forbid_warn.stderr @@ -4,8 +4,8 @@ error: extern declarations without an explicit ABI are deprecated LL | extern fn foo() {} | ^^^^^^^^^^^^^^^ ABI should be specified here | - = note: requested on the command line with `-F missing-abi` = help: the default ABI is C + = note: requested on the command line with `-F missing-abi` error: aborting due to previous error diff --git a/src/test/ui/lint/cli-lint-override.force_warn_deny.stderr b/src/test/ui/lint/cli-lint-override.force_warn_deny.stderr index 74e7823e1..779c24c93 100644 --- a/src/test/ui/lint/cli-lint-override.force_warn_deny.stderr +++ b/src/test/ui/lint/cli-lint-override.force_warn_deny.stderr @@ -4,8 +4,8 @@ warning: extern declarations without an explicit ABI are deprecated LL | extern fn foo() {} | ^^^^^^^^^^^^^^^ ABI should be specified here | - = note: requested on the command line with `--force-warn missing-abi` = help: the default ABI is C + = note: requested on the command line with `--force-warn missing-abi` warning: 1 warning emitted diff --git a/src/test/ui/lint/cli-lint-override.warn_deny.stderr b/src/test/ui/lint/cli-lint-override.warn_deny.stderr index 2d869adfd..f034cfa93 100644 --- a/src/test/ui/lint/cli-lint-override.warn_deny.stderr +++ b/src/test/ui/lint/cli-lint-override.warn_deny.stderr @@ -4,8 +4,8 @@ error: extern declarations without an explicit ABI are deprecated LL | extern fn foo() {} | ^^^^^^^^^^^^^^^ ABI should be specified here | - = note: requested on the command line with `-D missing-abi` = help: the default ABI is C + = note: requested on the command line with `-D missing-abi` error: aborting due to previous error diff --git a/src/test/ui/lint/dead-code/issue-85071-2.stderr b/src/test/ui/lint/dead-code/issue-85071-2.stderr index 86fbd1d75..5e963183d 100644 --- a/src/test/ui/lint/dead-code/issue-85071-2.stderr +++ b/src/test/ui/lint/dead-code/issue-85071-2.stderr @@ -7,16 +7,16 @@ LL | LL | let _y = x; | ^^ unreachable definition | -note: the lint level is defined here - --> $DIR/issue-85071-2.rs:7:26 - | -LL | #![warn(unused_variables,unreachable_code)] - | ^^^^^^^^^^^^^^^^ note: this expression has type `Foo`, which is uninhabited --> $DIR/issue-85071-2.rs:18:13 | LL | let x = s.f(); | ^^^^^ +note: the lint level is defined here + --> $DIR/issue-85071-2.rs:7:26 + | +LL | #![warn(unused_variables,unreachable_code)] + | ^^^^^^^^^^^^^^^^ warning: unused variable: `x` --> $DIR/issue-85071-2.rs:18:9 diff --git a/src/test/ui/lint/dead-code/issue-85071.stderr b/src/test/ui/lint/dead-code/issue-85071.stderr index 49555fdaa..721fb8148 100644 --- a/src/test/ui/lint/dead-code/issue-85071.stderr +++ b/src/test/ui/lint/dead-code/issue-85071.stderr @@ -7,16 +7,16 @@ LL | LL | let _ = x; | ^ unreachable expression | -note: the lint level is defined here - --> $DIR/issue-85071.rs:9:26 - | -LL | #![warn(unused_variables,unreachable_code)] - | ^^^^^^^^^^^^^^^^ note: this expression has type `Foo`, which is uninhabited --> $DIR/issue-85071.rs:15:13 | LL | let x = f(); | ^^^ +note: the lint level is defined here + --> $DIR/issue-85071.rs:9:26 + | +LL | #![warn(unused_variables,unreachable_code)] + | ^^^^^^^^^^^^^^^^ warning: unused variable: `x` --> $DIR/issue-85071.rs:15:9 diff --git a/src/test/ui/lint/dead-code/unused-variant.stderr b/src/test/ui/lint/dead-code/unused-variant.stderr index a68f64775..6029bf268 100644 --- a/src/test/ui/lint/dead-code/unused-variant.stderr +++ b/src/test/ui/lint/dead-code/unused-variant.stderr @@ -6,12 +6,12 @@ LL | enum Enum { LL | Variant1, | ^^^^^^^^ | + = note: `Enum` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis note: the lint level is defined here --> $DIR/unused-variant.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ - = note: `Enum` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis error: aborting due to previous error diff --git a/src/test/ui/lint/deny-overflowing-literals.stderr b/src/test/ui/lint/deny-overflowing-literals.stderr index 127dd4127..beb0ad795 100644 --- a/src/test/ui/lint/deny-overflowing-literals.stderr +++ b/src/test/ui/lint/deny-overflowing-literals.stderr @@ -4,8 +4,8 @@ error: literal out of range for `u8` LL | let x: u8 = 256; | ^^^ | - = note: `#[deny(overflowing_literals)]` on by default = note: the literal `256` does not fit into the type `u8` whose range is `0..=255` + = note: `#[deny(overflowing_literals)]` on by default error: range endpoint is out of range for `u8` --> $DIR/deny-overflowing-literals.rs:5:14 diff --git a/src/test/ui/lint/expansion-time.stderr b/src/test/ui/lint/expansion-time.stderr index b0fc1f8e5..064ee5fad 100644 --- a/src/test/ui/lint/expansion-time.stderr +++ b/src/test/ui/lint/expansion-time.stderr @@ -18,13 +18,13 @@ warning: missing fragment specifier LL | macro_rules! m { ($i) => {} } | ^^ | + = 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 #40107 <https://github.com/rust-lang/rust/issues/40107> note: the lint level is defined here --> $DIR/expansion-time.rs:8:8 | LL | #[warn(missing_fragment_specifier)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - = 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 #40107 <https://github.com/rust-lang/rust/issues/40107> warning: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable --> $DIR/expansion-time.rs:14:7 @@ -32,13 +32,13 @@ warning: use of unstable library feature 'test': `bench` is a part of custom tes LL | #[bench] | ^^^^^ | + = 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 #64266 <https://github.com/rust-lang/rust/issues/64266> note: the lint level is defined here --> $DIR/expansion-time.rs:12:8 | LL | #[warn(soft_unstable)] | ^^^^^^^^^^^^^ - = 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 #64266 <https://github.com/rust-lang/rust/issues/64266> warning: include macro expected single expression in source --> $DIR/expansion-time-include.rs:4:1 diff --git a/src/test/ui/lint/fn_must_use.stderr b/src/test/ui/lint/fn_must_use.stderr index 61b7993d2..2805720f0 100644 --- a/src/test/ui/lint/fn_must_use.stderr +++ b/src/test/ui/lint/fn_must_use.stderr @@ -4,12 +4,12 @@ warning: unused return value of `need_to_use_this_value` that must be used LL | need_to_use_this_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: it's important note: the lint level is defined here --> $DIR/fn_must_use.rs:3:9 | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ - = note: it's important warning: unused return value of `MyStruct::need_to_use_this_method_value` that must be used --> $DIR/fn_must_use.rs:60:5 diff --git a/src/test/ui/lint/for_loop_over_fallibles.rs b/src/test/ui/lint/for_loop_over_fallibles.rs new file mode 100644 index 000000000..43d71c2e8 --- /dev/null +++ b/src/test/ui/lint/for_loop_over_fallibles.rs @@ -0,0 +1,43 @@ +// check-pass + +fn main() { + // Common + for _ in Some(1) {} + //~^ WARN for loop over an `Option`. This is more readably written as an `if let` statement + //~| HELP to check pattern in a loop use `while let` + //~| HELP consider using `if let` to clear intent + for _ in Ok::<_, ()>(1) {} + //~^ WARN for loop over a `Result`. This is more readably written as an `if let` statement + //~| HELP to check pattern in a loop use `while let` + //~| HELP consider using `if let` to clear intent + + // `Iterator::next` specific + for _ in [0; 0].iter().next() {} + //~^ WARN for loop over an `Option`. This is more readably written as an `if let` statement + //~| HELP to iterate over `[0; 0].iter()` remove the call to `next` + //~| HELP consider using `if let` to clear intent + + // `Result<impl Iterator, _>`, but function doesn't return `Result` + for _ in Ok::<_, ()>([0; 0].iter()) {} + //~^ WARN for loop over a `Result`. This is more readably written as an `if let` statement + //~| HELP to check pattern in a loop use `while let` + //~| HELP consider using `if let` to clear intent +} + +fn _returns_result() -> Result<(), ()> { + // `Result<impl Iterator, _>` + for _ in Ok::<_, ()>([0; 0].iter()) {} + //~^ WARN for loop over a `Result`. This is more readably written as an `if let` statement + //~| HELP to check pattern in a loop use `while let` + //~| HELP consider unwrapping the `Result` with `?` to iterate over its contents + //~| HELP consider using `if let` to clear intent + + // `Result<impl IntoIterator>` + for _ in Ok::<_, ()>([0; 0]) {} + //~^ WARN for loop over a `Result`. This is more readably written as an `if let` statement + //~| HELP to check pattern in a loop use `while let` + //~| HELP consider unwrapping the `Result` with `?` to iterate over its contents + //~| HELP consider using `if let` to clear intent + + Ok(()) +} diff --git a/src/test/ui/lint/for_loop_over_fallibles.stderr b/src/test/ui/lint/for_loop_over_fallibles.stderr new file mode 100644 index 000000000..96efdf85c --- /dev/null +++ b/src/test/ui/lint/for_loop_over_fallibles.stderr @@ -0,0 +1,101 @@ +warning: for loop over an `Option`. This is more readably written as an `if let` statement + --> $DIR/for_loop_over_fallibles.rs:5:14 + | +LL | for _ in Some(1) {} + | ^^^^^^^ + | + = note: `#[warn(for_loops_over_fallibles)]` on by default +help: to check pattern in a loop use `while let` + | +LL | while let Some(_) = Some(1) {} + | ~~~~~~~~~~~~~~~ ~~~ +help: consider using `if let` to clear intent + | +LL | if let Some(_) = Some(1) {} + | ~~~~~~~~~~~~ ~~~ + +warning: for loop over a `Result`. This is more readably written as an `if let` statement + --> $DIR/for_loop_over_fallibles.rs:9:14 + | +LL | for _ in Ok::<_, ()>(1) {} + | ^^^^^^^^^^^^^^ + | +help: to check pattern in a loop use `while let` + | +LL | while let Ok(_) = Ok::<_, ()>(1) {} + | ~~~~~~~~~~~~~ ~~~ +help: consider using `if let` to clear intent + | +LL | if let Ok(_) = Ok::<_, ()>(1) {} + | ~~~~~~~~~~ ~~~ + +warning: for loop over an `Option`. This is more readably written as an `if let` statement + --> $DIR/for_loop_over_fallibles.rs:15:14 + | +LL | for _ in [0; 0].iter().next() {} + | ^^^^^^^^^^^^^^^^^^^^ + | +help: to iterate over `[0; 0].iter()` remove the call to `next` + | +LL | for _ in [0; 0].iter().by_ref() {} + | ~~~~~~~~~ +help: consider using `if let` to clear intent + | +LL | if let Some(_) = [0; 0].iter().next() {} + | ~~~~~~~~~~~~ ~~~ + +warning: for loop over a `Result`. This is more readably written as an `if let` statement + --> $DIR/for_loop_over_fallibles.rs:21:14 + | +LL | for _ in Ok::<_, ()>([0; 0].iter()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: to check pattern in a loop use `while let` + | +LL | while let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} + | ~~~~~~~~~~~~~ ~~~ +help: consider using `if let` to clear intent + | +LL | if let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} + | ~~~~~~~~~~ ~~~ + +warning: for loop over a `Result`. This is more readably written as an `if let` statement + --> $DIR/for_loop_over_fallibles.rs:29:14 + | +LL | for _ in Ok::<_, ()>([0; 0].iter()) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: to check pattern in a loop use `while let` + | +LL | while let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} + | ~~~~~~~~~~~~~ ~~~ +help: consider unwrapping the `Result` with `?` to iterate over its contents + | +LL | for _ in Ok::<_, ()>([0; 0].iter())? {} + | + +help: consider using `if let` to clear intent + | +LL | if let Ok(_) = Ok::<_, ()>([0; 0].iter()) {} + | ~~~~~~~~~~ ~~~ + +warning: for loop over a `Result`. This is more readably written as an `if let` statement + --> $DIR/for_loop_over_fallibles.rs:36:14 + | +LL | for _ in Ok::<_, ()>([0; 0]) {} + | ^^^^^^^^^^^^^^^^^^^ + | +help: to check pattern in a loop use `while let` + | +LL | while let Ok(_) = Ok::<_, ()>([0; 0]) {} + | ~~~~~~~~~~~~~ ~~~ +help: consider unwrapping the `Result` with `?` to iterate over its contents + | +LL | for _ in Ok::<_, ()>([0; 0])? {} + | + +help: consider using `if let` to clear intent + | +LL | if let Ok(_) = Ok::<_, ()>([0; 0]) {} + | ~~~~~~~~~~ ~~~ + +warning: 6 warnings emitted + diff --git a/src/test/ui/lint/forbid-group-group-2.stderr b/src/test/ui/lint/forbid-group-group-2.stderr index 214e949c1..b2e2bcea1 100644 --- a/src/test/ui/lint/forbid-group-group-2.stderr +++ b/src/test/ui/lint/forbid-group-group-2.stderr @@ -7,13 +7,13 @@ LL | #![forbid(warnings)] 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> note: the lint level is defined here --> $DIR/forbid-group-group-2.rs:5:9 | LL | #![deny(forbidden_lint_groups)] | ^^^^^^^^^^^^^^^^^^^^^ - = 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 diff --git a/src/test/ui/lint/forbid-group-member.stderr b/src/test/ui/lint/forbid-group-member.stderr index 891fa9885..47336d4d8 100644 --- a/src/test/ui/lint/forbid-group-member.stderr +++ b/src/test/ui/lint/forbid-group-member.stderr @@ -7,9 +7,9 @@ LL | LL | #[allow(unused_variables)] | ^^^^^^^^^^^^^^^^ overruled by previous forbid | - = note: `#[warn(forbidden_lint_groups)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670> + = note: `#[warn(forbidden_lint_groups)]` on by default warning: allow(unused_variables) incompatible with previous forbid --> $DIR/forbid-group-member.rs:8:9 diff --git a/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.rs b/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.rs index 3a3d81176..257df13ef 100644 --- a/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.rs +++ b/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.rs @@ -1,10 +1,10 @@ // --force-warn $LINT causes $LINT (which is deny-by-default) to warn // despite $LINT being allowed on command line -// compile-flags: -A const_err --force-warn const_err +// compile-flags: -A mutable_transmutes --force-warn mutable_transmutes // check-pass -const C: i32 = 1 / 0; -//~^ WARN any use of this value will cause an error -//~| WARN this was previously accepted by the compiler - -fn main() {} +fn main() { + unsafe { + let y = std::mem::transmute::<&i32, &mut i32>(&5); //~WARN: undefined behavior + } +} diff --git a/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr index 915b3b86f..6a1fc76e1 100644 --- a/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr @@ -1,23 +1,10 @@ -warning: any use of this value will cause an error - --> $DIR/allowed-cli-deny-by-default-lint.rs:6:16 +warning: transmuting &T to &mut T is undefined behavior, even if the reference is unused, consider instead using an UnsafeCell + --> $DIR/allowed-cli-deny-by-default-lint.rs:8:17 | -LL | const C: i32 = 1 / 0; - | ------------ ^^^^^ attempt to divide `1_i32` by zero +LL | let y = std::mem::transmute::<&i32, &mut i32>(&5); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: requested on the command line with `--force-warn const-err` - = 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 #71800 <https://github.com/rust-lang/rust/issues/71800> + = note: requested on the command line with `--force-warn mutable-transmutes` warning: 1 warning emitted -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/allowed-cli-deny-by-default-lint.rs:6:16 - | -LL | const C: i32 = 1 / 0; - | ------------ ^^^^^ attempt to divide `1_i32` by zero - | - = note: requested on the command line with `--force-warn const-err` - = 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 #71800 <https://github.com/rust-lang/rust/issues/71800> - diff --git a/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.rs b/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.rs index 08e75a775..0d4b468c2 100644 --- a/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.rs +++ b/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.rs @@ -1,11 +1,11 @@ // --force-warn $LINT causes $LINT (which is deny-by-default) to warn // despite $LINT being allowed in module -// compile-flags: --force-warn const_err +// compile-flags: --force-warn mutable_transmutes // check-pass -#![allow(const_err)] -const C: i32 = 1 / 0; -//~^ WARN any use of this value will cause an error -//~| WARN this was previously accepted by the compiler - -fn main() {} +#![allow(mutable_transmutes)] +fn main() { + unsafe { + let y = std::mem::transmute::<&i32, &mut i32>(&5); //~WARN: undefined behavior + } +} diff --git a/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr index 3b36d1d02..9ef53d47e 100644 --- a/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr @@ -1,23 +1,10 @@ -warning: any use of this value will cause an error - --> $DIR/allowed-deny-by-default-lint.rs:7:16 +warning: transmuting &T to &mut T is undefined behavior, even if the reference is unused, consider instead using an UnsafeCell + --> $DIR/allowed-deny-by-default-lint.rs:9:17 | -LL | const C: i32 = 1 / 0; - | ------------ ^^^^^ attempt to divide `1_i32` by zero +LL | let y = std::mem::transmute::<&i32, &mut i32>(&5); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: requested on the command line with `--force-warn const-err` - = 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 #71800 <https://github.com/rust-lang/rust/issues/71800> + = note: requested on the command line with `--force-warn mutable-transmutes` warning: 1 warning emitted -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/allowed-deny-by-default-lint.rs:7:16 - | -LL | const C: i32 = 1 / 0; - | ------------ ^^^^^ attempt to divide `1_i32` by zero - | - = note: requested on the command line with `--force-warn const-err` - = 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 #71800 <https://github.com/rust-lang/rust/issues/71800> - diff --git a/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr index 94d81c3aa..0f58953a5 100644 --- a/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr @@ -4,9 +4,9 @@ warning: trait objects without an explicit `dyn` are deprecated LL | pub fn function(_x: Box<SomeTrait>) {} | ^^^^^^^^^ | - = note: requested on the command line with `--force-warn bare-trait-objects` = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> + = note: requested on the command line with `--force-warn bare-trait-objects` help: use `dyn` | LL | pub fn function(_x: Box<dyn SomeTrait>) {} diff --git a/src/test/ui/lint/force-warn/cap-lints-allow.stderr b/src/test/ui/lint/force-warn/cap-lints-allow.stderr index 7f0fd8530..03a32fa6f 100644 --- a/src/test/ui/lint/force-warn/cap-lints-allow.stderr +++ b/src/test/ui/lint/force-warn/cap-lints-allow.stderr @@ -4,9 +4,9 @@ warning: trait objects without an explicit `dyn` are deprecated LL | pub fn function(_x: Box<SomeTrait>) {} | ^^^^^^^^^ | - = note: requested on the command line with `--force-warn bare-trait-objects` = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> + = note: requested on the command line with `--force-warn bare-trait-objects` help: use `dyn` | LL | pub fn function(_x: Box<dyn SomeTrait>) {} diff --git a/src/test/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr index 3dafaf705..d1b764b34 100644 --- a/src/test/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/cap-lints-warn-allowed-warn-by-default-lint.stderr @@ -4,9 +4,9 @@ warning: `...` range patterns are deprecated LL | 0...100 => true, | ^^^ help: use `..=` for an inclusive range | - = note: `--force-warn ellipsis-inclusive-range-patterns` implied by `--force-warn rust-2021-compatibility` = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> + = note: `--force-warn ellipsis-inclusive-range-patterns` implied by `--force-warn rust-2021-compatibility` warning: 1 warning emitted diff --git a/src/test/ui/lint/force-warn/deny-by-default-lint.rs b/src/test/ui/lint/force-warn/deny-by-default-lint.rs index e37102903..c2e9377e9 100644 --- a/src/test/ui/lint/force-warn/deny-by-default-lint.rs +++ b/src/test/ui/lint/force-warn/deny-by-default-lint.rs @@ -1,9 +1,9 @@ // --force-warn $LINT causes $LINT (which is deny-by-default) to warn -// compile-flags: --force-warn const_err +// compile-flags: --force-warn mutable_transmutes // check-pass -const C: i32 = 1 / 0; -//~^ WARN any use of this value will cause an error -//~| WARN this was previously accepted by the compiler - -fn main() {} +fn main() { + unsafe { + let y = std::mem::transmute::<&i32, &mut i32>(&5); //~WARN: undefined behavior + } +} diff --git a/src/test/ui/lint/force-warn/deny-by-default-lint.stderr b/src/test/ui/lint/force-warn/deny-by-default-lint.stderr index a2e5baa8b..c644d0fe7 100644 --- a/src/test/ui/lint/force-warn/deny-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/deny-by-default-lint.stderr @@ -1,23 +1,10 @@ -warning: any use of this value will cause an error - --> $DIR/deny-by-default-lint.rs:5:16 +warning: transmuting &T to &mut T is undefined behavior, even if the reference is unused, consider instead using an UnsafeCell + --> $DIR/deny-by-default-lint.rs:7:17 | -LL | const C: i32 = 1 / 0; - | ------------ ^^^^^ attempt to divide `1_i32` by zero +LL | let y = std::mem::transmute::<&i32, &mut i32>(&5); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: requested on the command line with `--force-warn const-err` - = 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 #71800 <https://github.com/rust-lang/rust/issues/71800> + = note: requested on the command line with `--force-warn mutable-transmutes` warning: 1 warning emitted -Future incompatibility report: Future breakage diagnostic: -warning: any use of this value will cause an error - --> $DIR/deny-by-default-lint.rs:5:16 - | -LL | const C: i32 = 1 / 0; - | ------------ ^^^^^ attempt to divide `1_i32` by zero - | - = note: requested on the command line with `--force-warn const-err` - = 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 #71800 <https://github.com/rust-lang/rust/issues/71800> - diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr index eb2bca7b8..e17630fd3 100644 --- a/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr @@ -4,9 +4,9 @@ warning: trait objects without an explicit `dyn` are deprecated LL | pub fn function(_x: Box<SomeTrait>) {} | ^^^^^^^^^ | - = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms` = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> + = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms` help: use `dyn` | LL | pub fn function(_x: Box<dyn SomeTrait>) {} diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr index ed01937a5..72198541a 100644 --- a/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr +++ b/src/test/ui/lint/force-warn/lint-group-allowed-lint-group.stderr @@ -4,9 +4,9 @@ warning: trait objects without an explicit `dyn` are deprecated LL | pub fn function(_x: Box<SomeTrait>) {} | ^^^^^^^^^ | - = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms` = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> + = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms` help: use `dyn` | LL | pub fn function(_x: Box<dyn SomeTrait>) {} diff --git a/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr b/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr index 8db7c1275..52c870ac2 100644 --- a/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr +++ b/src/test/ui/lint/force-warn/lint-group-allowed-warn-by-default-lint.stderr @@ -4,9 +4,9 @@ warning: trait objects without an explicit `dyn` are deprecated LL | pub fn function(_x: Box<SomeTrait>) {} | ^^^^^^^^^ | - = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms` = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> + = note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms` help: use `dyn` | LL | pub fn function(_x: Box<dyn SomeTrait>) {} diff --git a/src/test/ui/lint/inclusive-range-pattern-syntax.stderr b/src/test/ui/lint/inclusive-range-pattern-syntax.stderr index 91b8d2b5a..ed9fa0d41 100644 --- a/src/test/ui/lint/inclusive-range-pattern-syntax.stderr +++ b/src/test/ui/lint/inclusive-range-pattern-syntax.stderr @@ -4,13 +4,13 @@ warning: `...` range patterns are deprecated LL | 1...2 => {} | ^^^ help: use `..=` for an inclusive range | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> note: the lint level is defined here --> $DIR/inclusive-range-pattern-syntax.rs:4:9 | LL | #![warn(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> warning: `...` range patterns are deprecated --> $DIR/inclusive-range-pattern-syntax.rs:16:9 diff --git a/src/test/ui/lint/inert-attr-macro.stderr b/src/test/ui/lint/inert-attr-macro.stderr index 3b3aa5d0b..5ccb4ffe7 100644 --- a/src/test/ui/lint/inert-attr-macro.stderr +++ b/src/test/ui/lint/inert-attr-macro.stderr @@ -4,17 +4,17 @@ warning: unused attribute `inline` LL | #[inline] foo!(); | ^^^^^^^^^ | +note: the built-in attribute `inline` will be ignored, since it's applied to the macro invocation `foo` + --> $DIR/inert-attr-macro.rs:10:15 + | +LL | #[inline] foo!(); + | ^^^ note: the lint level is defined here --> $DIR/inert-attr-macro.rs:3:9 | LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(unused_attributes)]` implied by `#[warn(unused)]` -note: the built-in attribute `inline` will be ignored, since it's applied to the macro invocation `foo` - --> $DIR/inert-attr-macro.rs:10:15 - | -LL | #[inline] foo!(); - | ^^^ warning: unused attribute `allow` --> $DIR/inert-attr-macro.rs:14:5 diff --git a/src/test/ui/lint/inline-trait-and-foreign-items.stderr b/src/test/ui/lint/inline-trait-and-foreign-items.stderr index fc7e89e4f..2f1fb4c46 100644 --- a/src/test/ui/lint/inline-trait-and-foreign-items.stderr +++ b/src/test/ui/lint/inline-trait-and-foreign-items.stderr @@ -4,13 +4,13 @@ warning: `#[inline]` is ignored on constants LL | #[inline] | ^^^^^^^^^ | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: see issue #65833 <https://github.com/rust-lang/rust/issues/65833> for more information note: the lint level is defined here --> $DIR/inline-trait-and-foreign-items.rs:4:9 | LL | #![warn(unused_attributes)] | ^^^^^^^^^^^^^^^^^ - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: see issue #65833 <https://github.com/rust-lang/rust/issues/65833> for more information error[E0518]: attribute should be applied to function or closure --> $DIR/inline-trait-and-foreign-items.rs:11:5 @@ -67,7 +67,7 @@ error: unconstrained opaque type LL | type U = impl Trait; | ^^^^^^^^^^ | - = note: `U` must be used in combination with a concrete type within the same module + = note: `U` must be used in combination with a concrete type within the same impl error: aborting due to 6 previous errors; 2 warnings emitted diff --git a/src/test/ui/lint/uninitialized-zeroed.rs b/src/test/ui/lint/invalid_value.rs index dae258407..57d8cbe7c 100644 --- a/src/test/ui/lint/uninitialized-zeroed.rs +++ b/src/test/ui/lint/invalid_value.rs @@ -34,6 +34,20 @@ enum OneFruit { Banana, } +enum OneFruitNonZero { + Apple(!), + Banana(NonZeroU32), +} + +enum TwoUninhabited { + A(!), + B(Void), +} + +#[rustc_layout_scalar_valid_range_start(254)] +#[rustc_layout_scalar_valid_range_end(1)] +pub(crate) struct WrapAroundRange(u8); + #[allow(unused)] fn generic<T: 'static>() { unsafe { @@ -78,12 +92,21 @@ fn main() { let _val: NonNull<i32> = mem::zeroed(); //~ ERROR: does not permit zero-initialization let _val: NonNull<i32> = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized + let _val: (NonZeroU32, i32) = mem::zeroed(); //~ ERROR: does not permit zero-initialization + let _val: (NonZeroU32, i32) = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized + let _val: *const dyn Send = mem::zeroed(); //~ ERROR: does not permit zero-initialization let _val: *const dyn Send = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized let _val: [fn(); 2] = mem::zeroed(); //~ ERROR: does not permit zero-initialization let _val: [fn(); 2] = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized + let _val: TwoUninhabited = mem::zeroed(); //~ ERROR: does not permit zero-initialization + let _val: TwoUninhabited = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized + + let _val: OneFruitNonZero = mem::zeroed(); //~ ERROR: does not permit zero-initialization + let _val: OneFruitNonZero = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized + // Things that can be zero, but not uninit. let _val: bool = mem::zeroed(); let _val: bool = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized @@ -112,6 +135,19 @@ fn main() { let _val: *const [()] = mem::zeroed(); let _val: *const [()] = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized + let _val: WrapAroundRange = mem::zeroed(); + let _val: WrapAroundRange = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized + + // Things where 0 is okay due to rustc implementation details, + // but that are not guaranteed to keep working. + let _val: Result<i32, i32> = mem::zeroed(); + let _val: Result<i32, i32> = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized + + // Some things that happen to be UB-free due to rustc implementation details, + // but are not guaranteed to keep working. + let _val: OneFruit = mem::zeroed(); + let _val: OneFruit = mem::uninitialized(); + // Transmute-from-0 let _val: &'static i32 = mem::transmute(0usize); //~ ERROR: does not permit zero-initialization let _val: &'static [i32] = mem::transmute((0usize, 0usize)); //~ ERROR: does not permit zero-initialization @@ -129,9 +165,5 @@ fn main() { let _val: bool = MaybeUninit::zeroed().assume_init(); let _val: [bool; 0] = MaybeUninit::uninit().assume_init(); let _val: [!; 0] = MaybeUninit::zeroed().assume_init(); - - // Some things that happen to work due to rustc implementation details, - // but are not guaranteed to keep working. - let _val: OneFruit = mem::uninitialized(); } } diff --git a/src/test/ui/lint/uninitialized-zeroed.stderr b/src/test/ui/lint/invalid_value.stderr index b46042e7b..76afb765f 100644 --- a/src/test/ui/lint/uninitialized-zeroed.stderr +++ b/src/test/ui/lint/invalid_value.stderr @@ -1,5 +1,5 @@ error: the type `&T` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:40:32 + --> $DIR/invalid_value.rs:54:32 | LL | let _val: &'static T = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -7,15 +7,15 @@ LL | let _val: &'static T = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | + = note: references must be non-null note: the lint level is defined here - --> $DIR/uninitialized-zeroed.rs:6:9 + --> $DIR/invalid_value.rs:6:9 | LL | #![deny(invalid_value)] | ^^^^^^^^^^^^^ - = note: references must be non-null error: the type `&T` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:41:32 + --> $DIR/invalid_value.rs:55:32 | LL | let _val: &'static T = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -26,7 +26,7 @@ LL | let _val: &'static T = mem::uninitialized(); = note: references must be non-null error: the type `Wrap<&T>` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:43:38 + --> $DIR/invalid_value.rs:57:38 | LL | let _val: Wrap<&'static T> = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -35,13 +35,13 @@ LL | let _val: Wrap<&'static T> = mem::zeroed(); | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | note: references must be non-null (in this struct field) - --> $DIR/uninitialized-zeroed.rs:17:18 + --> $DIR/invalid_value.rs:17:18 | LL | struct Wrap<T> { wrapped: T } | ^^^^^^^^^^ error: the type `Wrap<&T>` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:44:38 + --> $DIR/invalid_value.rs:58:38 | LL | let _val: Wrap<&'static T> = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -50,13 +50,13 @@ LL | let _val: Wrap<&'static T> = mem::uninitialized(); | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | note: references must be non-null (in this struct field) - --> $DIR/uninitialized-zeroed.rs:17:18 + --> $DIR/invalid_value.rs:17:18 | LL | struct Wrap<T> { wrapped: T } | ^^^^^^^^^^ error: the type `!` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:51:23 + --> $DIR/invalid_value.rs:65:23 | LL | let _val: ! = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -67,7 +67,7 @@ LL | let _val: ! = mem::zeroed(); = note: the `!` type has no valid value error: the type `!` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:52:23 + --> $DIR/invalid_value.rs:66:23 | LL | let _val: ! = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -78,7 +78,7 @@ LL | let _val: ! = mem::uninitialized(); = note: the `!` type has no valid value error: the type `(i32, !)` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:54:30 + --> $DIR/invalid_value.rs:68:30 | LL | let _val: (i32, !) = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -89,7 +89,7 @@ LL | let _val: (i32, !) = mem::zeroed(); = note: the `!` type has no valid value error: the type `(i32, !)` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:55:30 + --> $DIR/invalid_value.rs:69:30 | LL | let _val: (i32, !) = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -100,7 +100,7 @@ LL | let _val: (i32, !) = mem::uninitialized(); = note: integers must not be uninitialized error: the type `Void` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:57:26 + --> $DIR/invalid_value.rs:71:26 | LL | let _val: Void = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -108,10 +108,14 @@ LL | let _val: Void = mem::zeroed(); | 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 +note: enums with no inhabited variants have no valid value + --> $DIR/invalid_value.rs:12:1 + | +LL | enum Void {} + | ^^^^^^^^^ error: the type `Void` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:58:26 + --> $DIR/invalid_value.rs:72:26 | LL | let _val: Void = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -119,10 +123,14 @@ LL | let _val: Void = mem::uninitialized(); | 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 +note: enums with no inhabited variants have no valid value + --> $DIR/invalid_value.rs:12:1 + | +LL | enum Void {} + | ^^^^^^^^^ error: the type `&i32` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:60:34 + --> $DIR/invalid_value.rs:74:34 | LL | let _val: &'static i32 = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -133,7 +141,7 @@ LL | let _val: &'static i32 = mem::zeroed(); = note: references must be non-null error: the type `&i32` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:61:34 + --> $DIR/invalid_value.rs:75:34 | LL | let _val: &'static i32 = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -144,7 +152,7 @@ LL | let _val: &'static i32 = mem::uninitialized(); = note: references must be non-null error: the type `Ref` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:63:25 + --> $DIR/invalid_value.rs:77:25 | LL | let _val: Ref = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -153,13 +161,13 @@ LL | let _val: Ref = mem::zeroed(); | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | note: references must be non-null (in this struct field) - --> $DIR/uninitialized-zeroed.rs:14:12 + --> $DIR/invalid_value.rs:14:12 | LL | struct Ref(&'static i32); | ^^^^^^^^^^^^ error: the type `Ref` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:64:25 + --> $DIR/invalid_value.rs:78:25 | LL | let _val: Ref = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -168,13 +176,13 @@ LL | let _val: Ref = mem::uninitialized(); | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | note: references must be non-null (in this struct field) - --> $DIR/uninitialized-zeroed.rs:14:12 + --> $DIR/invalid_value.rs:14:12 | LL | struct Ref(&'static i32); | ^^^^^^^^^^^^ error: the type `fn()` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:66:26 + --> $DIR/invalid_value.rs:80:26 | LL | let _val: fn() = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -185,7 +193,7 @@ LL | let _val: fn() = mem::zeroed(); = note: function pointers must be non-null error: the type `fn()` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:67:26 + --> $DIR/invalid_value.rs:81:26 | LL | let _val: fn() = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -196,7 +204,7 @@ LL | let _val: fn() = mem::uninitialized(); = note: function pointers must be non-null error: the type `Wrap<fn()>` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:69:32 + --> $DIR/invalid_value.rs:83:32 | LL | let _val: Wrap<fn()> = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -205,13 +213,13 @@ LL | let _val: Wrap<fn()> = mem::zeroed(); | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | note: function pointers must be non-null (in this struct field) - --> $DIR/uninitialized-zeroed.rs:17:18 + --> $DIR/invalid_value.rs:17:18 | LL | struct Wrap<T> { wrapped: T } | ^^^^^^^^^^ error: the type `Wrap<fn()>` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:70:32 + --> $DIR/invalid_value.rs:84:32 | LL | let _val: Wrap<fn()> = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -220,13 +228,13 @@ LL | let _val: Wrap<fn()> = mem::uninitialized(); | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | note: function pointers must be non-null (in this struct field) - --> $DIR/uninitialized-zeroed.rs:17:18 + --> $DIR/invalid_value.rs:17:18 | LL | struct Wrap<T> { wrapped: T } | ^^^^^^^^^^ error: the type `WrapEnum<fn()>` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:72:36 + --> $DIR/invalid_value.rs:86:36 | LL | let _val: WrapEnum<fn()> = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -234,14 +242,14 @@ LL | let _val: WrapEnum<fn()> = mem::zeroed(); | this code causes undefined behavior when executed | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | -note: function pointers must be non-null (in this enum field) - --> $DIR/uninitialized-zeroed.rs:18:28 +note: function pointers must be non-null (in this field of the only potentially inhabited enum variant) + --> $DIR/invalid_value.rs:18:28 | LL | enum WrapEnum<T> { Wrapped(T) } | ^ error: the type `WrapEnum<fn()>` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:73:36 + --> $DIR/invalid_value.rs:87:36 | LL | let _val: WrapEnum<fn()> = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -249,14 +257,14 @@ LL | let _val: WrapEnum<fn()> = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | -note: function pointers must be non-null (in this enum field) - --> $DIR/uninitialized-zeroed.rs:18:28 +note: function pointers must be non-null (in this field of the only potentially inhabited enum variant) + --> $DIR/invalid_value.rs:18:28 | LL | enum WrapEnum<T> { Wrapped(T) } | ^ error: the type `Wrap<(RefPair, i32)>` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:75:42 + --> $DIR/invalid_value.rs:89:42 | LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -265,13 +273,13 @@ LL | let _val: Wrap<(RefPair, i32)> = mem::zeroed(); | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | note: references must be non-null (in this struct field) - --> $DIR/uninitialized-zeroed.rs:15:16 + --> $DIR/invalid_value.rs:15:16 | LL | struct RefPair((&'static i32, i32)); | ^^^^^^^^^^^^^^^^^^^ error: the type `Wrap<(RefPair, i32)>` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:76:42 + --> $DIR/invalid_value.rs:90:42 | LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -280,13 +288,13 @@ LL | let _val: Wrap<(RefPair, i32)> = mem::uninitialized(); | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | note: references must be non-null (in this struct field) - --> $DIR/uninitialized-zeroed.rs:15:16 + --> $DIR/invalid_value.rs:15:16 | LL | struct RefPair((&'static i32, i32)); | ^^^^^^^^^^^^^^^^^^^ error: the type `NonNull<i32>` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:78:34 + --> $DIR/invalid_value.rs:92:34 | LL | let _val: NonNull<i32> = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -297,7 +305,7 @@ LL | let _val: NonNull<i32> = mem::zeroed(); = note: `std::ptr::NonNull<i32>` must be non-null error: the type `NonNull<i32>` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:79:34 + --> $DIR/invalid_value.rs:93:34 | LL | let _val: NonNull<i32> = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -307,8 +315,30 @@ LL | let _val: NonNull<i32> = mem::uninitialized(); | = note: `std::ptr::NonNull<i32>` must be non-null +error: the type `(NonZeroU32, i32)` does not permit zero-initialization + --> $DIR/invalid_value.rs:95:39 + | +LL | let _val: (NonZeroU32, i32) = mem::zeroed(); + | ^^^^^^^^^^^^^ + | | + | this code causes undefined behavior when executed + | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done + | + = note: `std::num::NonZeroU32` must be non-null + +error: the type `(NonZeroU32, i32)` does not permit being left uninitialized + --> $DIR/invalid_value.rs:96:39 + | +LL | let _val: (NonZeroU32, i32) = mem::uninitialized(); + | ^^^^^^^^^^^^^^^^^^^^ + | | + | this code causes undefined behavior when executed + | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done + | + = note: `std::num::NonZeroU32` must be non-null + error: the type `*const dyn Send` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:81:37 + --> $DIR/invalid_value.rs:98:37 | LL | let _val: *const dyn Send = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -319,7 +349,7 @@ LL | let _val: *const dyn Send = mem::zeroed(); = note: the vtable of a wide raw pointer must be non-null error: the type `*const dyn Send` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:82:37 + --> $DIR/invalid_value.rs:99:37 | LL | let _val: *const dyn Send = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -330,7 +360,7 @@ LL | let _val: *const dyn Send = mem::uninitialized(); = note: the vtable of a wide raw pointer must be non-null error: the type `[fn(); 2]` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:84:31 + --> $DIR/invalid_value.rs:101:31 | LL | let _val: [fn(); 2] = mem::zeroed(); | ^^^^^^^^^^^^^ @@ -341,7 +371,7 @@ LL | let _val: [fn(); 2] = mem::zeroed(); = note: function pointers must be non-null error: the type `[fn(); 2]` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:85:31 + --> $DIR/invalid_value.rs:102:31 | LL | let _val: [fn(); 2] = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -351,8 +381,68 @@ LL | let _val: [fn(); 2] = mem::uninitialized(); | = note: function pointers must be non-null +error: the type `TwoUninhabited` does not permit zero-initialization + --> $DIR/invalid_value.rs:104:36 + | +LL | let _val: TwoUninhabited = mem::zeroed(); + | ^^^^^^^^^^^^^ + | | + | 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 inhabited variants have no valid value + --> $DIR/invalid_value.rs:42:1 + | +LL | enum TwoUninhabited { + | ^^^^^^^^^^^^^^^^^^^ + +error: the type `TwoUninhabited` does not permit being left uninitialized + --> $DIR/invalid_value.rs:105:36 + | +LL | let _val: TwoUninhabited = mem::uninitialized(); + | ^^^^^^^^^^^^^^^^^^^^ + | | + | 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 inhabited variants have no valid value + --> $DIR/invalid_value.rs:42:1 + | +LL | enum TwoUninhabited { + | ^^^^^^^^^^^^^^^^^^^ + +error: the type `OneFruitNonZero` does not permit zero-initialization + --> $DIR/invalid_value.rs:107:37 + | +LL | let _val: OneFruitNonZero = mem::zeroed(); + | ^^^^^^^^^^^^^ + | | + | this code causes undefined behavior when executed + | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done + | +note: `std::num::NonZeroU32` must be non-null (in this field of the only potentially inhabited enum variant) + --> $DIR/invalid_value.rs:39:12 + | +LL | Banana(NonZeroU32), + | ^^^^^^^^^^ + +error: the type `OneFruitNonZero` does not permit being left uninitialized + --> $DIR/invalid_value.rs:108:37 + | +LL | let _val: OneFruitNonZero = mem::uninitialized(); + | ^^^^^^^^^^^^^^^^^^^^ + | | + | this code causes undefined behavior when executed + | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done + | +note: `std::num::NonZeroU32` must be non-null (in this field of the only potentially inhabited enum variant) + --> $DIR/invalid_value.rs:39:12 + | +LL | Banana(NonZeroU32), + | ^^^^^^^^^^ + error: the type `bool` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:89:26 + --> $DIR/invalid_value.rs:112:26 | LL | let _val: bool = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -363,7 +453,7 @@ LL | let _val: bool = mem::uninitialized(); = note: booleans must be either `true` or `false` error: the type `Wrap<char>` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:92:32 + --> $DIR/invalid_value.rs:115:32 | LL | let _val: Wrap<char> = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -372,13 +462,13 @@ LL | let _val: Wrap<char> = mem::uninitialized(); | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | note: characters must be a valid Unicode codepoint (in this struct field) - --> $DIR/uninitialized-zeroed.rs:17:18 + --> $DIR/invalid_value.rs:17:18 | LL | struct Wrap<T> { wrapped: T } | ^^^^^^^^^^ error: the type `NonBig` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:95:28 + --> $DIR/invalid_value.rs:118:28 | LL | let _val: NonBig = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -389,7 +479,7 @@ LL | let _val: NonBig = mem::uninitialized(); = note: `NonBig` must be initialized inside its custom valid range error: the type `Fruit` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:98:27 + --> $DIR/invalid_value.rs:121:27 | LL | let _val: Fruit = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -397,14 +487,14 @@ LL | let _val: Fruit = mem::uninitialized(); | this code causes undefined behavior when executed | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done | -note: enums have to be initialized to a variant - --> $DIR/uninitialized-zeroed.rs:26:1 +note: enums with multiple inhabited variants have to be initialized to a variant + --> $DIR/invalid_value.rs:26:1 | LL | enum Fruit { | ^^^^^^^^^^ error: the type `[bool; 2]` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:101:31 + --> $DIR/invalid_value.rs:124:31 | LL | let _val: [bool; 2] = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -415,7 +505,7 @@ LL | let _val: [bool; 2] = mem::uninitialized(); = note: booleans must be either `true` or `false` error: the type `i32` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:104:25 + --> $DIR/invalid_value.rs:127:25 | LL | let _val: i32 = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -426,7 +516,7 @@ LL | let _val: i32 = mem::uninitialized(); = note: integers must not be uninitialized error: the type `f32` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:107:25 + --> $DIR/invalid_value.rs:130:25 | LL | let _val: f32 = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -437,7 +527,7 @@ LL | let _val: f32 = mem::uninitialized(); = note: floats must not be uninitialized error: the type `*const ()` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:110:31 + --> $DIR/invalid_value.rs:133:31 | LL | let _val: *const () = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -448,7 +538,7 @@ LL | let _val: *const () = mem::uninitialized(); = note: raw pointers must not be uninitialized error: the type `*const [()]` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:113:33 + --> $DIR/invalid_value.rs:136:33 | LL | let _val: *const [()] = mem::uninitialized(); | ^^^^^^^^^^^^^^^^^^^^ @@ -458,8 +548,34 @@ LL | let _val: *const [()] = mem::uninitialized(); | = note: raw pointers must not be uninitialized +error: the type `WrapAroundRange` does not permit being left uninitialized + --> $DIR/invalid_value.rs:139:37 + | +LL | let _val: WrapAroundRange = mem::uninitialized(); + | ^^^^^^^^^^^^^^^^^^^^ + | | + | this code causes undefined behavior when executed + | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done + | + = note: `WrapAroundRange` must be initialized inside its custom valid range + +error: the type `Result<i32, i32>` does not permit being left uninitialized + --> $DIR/invalid_value.rs:144:38 + | +LL | let _val: Result<i32, i32> = mem::uninitialized(); + | ^^^^^^^^^^^^^^^^^^^^ + | | + | this code causes undefined behavior when executed + | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done + | +note: enums with multiple inhabited variants have to be initialized to a variant + --> $SRC_DIR/core/src/result.rs:LL:COL + | +LL | pub enum Result<T, E> { + | ^^^^^^^^^^^^^^^^^^^^^ + error: the type `&i32` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:116:34 + --> $DIR/invalid_value.rs:152:34 | LL | let _val: &'static i32 = mem::transmute(0usize); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -470,7 +586,7 @@ LL | let _val: &'static i32 = mem::transmute(0usize); = note: references must be non-null error: the type `&[i32]` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:117:36 + --> $DIR/invalid_value.rs:153:36 | LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -481,7 +597,7 @@ LL | let _val: &'static [i32] = mem::transmute((0usize, 0usize)); = note: references must be non-null error: the type `NonZeroU32` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:118:32 + --> $DIR/invalid_value.rs:154:32 | LL | let _val: NonZeroU32 = mem::transmute(0); | ^^^^^^^^^^^^^^^^^ @@ -492,7 +608,7 @@ LL | let _val: NonZeroU32 = mem::transmute(0); = note: `std::num::NonZeroU32` must be non-null error: the type `NonNull<i32>` does not permit zero-initialization - --> $DIR/uninitialized-zeroed.rs:121:34 + --> $DIR/invalid_value.rs:157:34 | LL | let _val: NonNull<i32> = MaybeUninit::zeroed().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -503,7 +619,7 @@ LL | let _val: NonNull<i32> = MaybeUninit::zeroed().assume_init(); = note: `std::ptr::NonNull<i32>` must be non-null error: the type `NonNull<i32>` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:122:34 + --> $DIR/invalid_value.rs:158:34 | LL | let _val: NonNull<i32> = MaybeUninit::uninit().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -514,7 +630,7 @@ LL | let _val: NonNull<i32> = MaybeUninit::uninit().assume_init(); = note: `std::ptr::NonNull<i32>` must be non-null error: the type `bool` does not permit being left uninitialized - --> $DIR/uninitialized-zeroed.rs:123:26 + --> $DIR/invalid_value.rs:159:26 | LL | let _val: bool = MaybeUninit::uninit().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -524,5 +640,5 @@ LL | let _val: bool = MaybeUninit::uninit().assume_init(); | = note: booleans must be either `true` or `false` -error: aborting due to 43 previous errors +error: aborting due to 51 previous errors diff --git a/src/test/ui/lint/issue-102705.rs b/src/test/ui/lint/issue-102705.rs new file mode 100644 index 000000000..5bcc8950a --- /dev/null +++ b/src/test/ui/lint/issue-102705.rs @@ -0,0 +1,22 @@ +// check-pass + +#![allow(opaque_hidden_inferred_bound)] +#![allow(dead_code)] + +trait Duh {} + +impl Duh for i32 {} + +trait Trait { + type Assoc: Duh; +} + +impl<R: Duh, F: FnMut() -> R> Trait for F { + type Assoc = R; +} + +fn foo() -> impl Trait<Assoc = impl Send> { + || 42 +} + +fn main() {} diff --git a/src/test/ui/lint/issue-14309.stderr b/src/test/ui/lint/issue-14309.stderr index a9538b5e3..9ce62a6b8 100644 --- a/src/test/ui/lint/issue-14309.stderr +++ b/src/test/ui/lint/issue-14309.stderr @@ -4,11 +4,6 @@ error: `extern` block uses type `A`, which is not FFI-safe LL | fn foo(x: A); | ^ not FFI-safe | -note: the lint level is defined here - --> $DIR/issue-14309.rs:1:9 - | -LL | #![deny(improper_ctypes)] - | ^^^^^^^^^^^^^^^ = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout note: the type is defined here @@ -16,6 +11,11 @@ note: the type is defined here | LL | struct A { | ^^^^^^^^ +note: the lint level is defined here + --> $DIR/issue-14309.rs:1:9 + | +LL | #![deny(improper_ctypes)] + | ^^^^^^^^^^^^^^^ error: `extern` block uses type `A`, which is not FFI-safe --> $DIR/issue-14309.rs:31:15 diff --git a/src/test/ui/lint/issue-1866.stderr b/src/test/ui/lint/issue-1866.stderr index 5edae48a1..d19a13496 100644 --- a/src/test/ui/lint/issue-1866.stderr +++ b/src/test/ui/lint/issue-1866.stderr @@ -7,13 +7,13 @@ LL | pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool; LL | pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | + = note: expected `unsafe extern "C" fn(*const usize) -> bool` + found `unsafe extern "C" fn(*const bool) -> bool` note: the lint level is defined here --> $DIR/issue-1866.rs:4:9 | LL | #![warn(clashing_extern_declarations)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected `unsafe extern "C" fn(*const usize) -> bool` - found `unsafe extern "C" fn(*const bool) -> bool` warning: 1 warning emitted diff --git a/src/test/ui/lint/issue-63364.stderr b/src/test/ui/lint/issue-63364.stderr index 0375359ae..9b5453fa8 100644 --- a/src/test/ui/lint/issue-63364.stderr +++ b/src/test/ui/lint/issue-63364.stderr @@ -4,8 +4,8 @@ error: literal out of range for `u16` LL | for n in 100_000.. { | ^^^^^^^ | - = note: `#[deny(overflowing_literals)]` on by default = note: the literal `100_000` does not fit into the type `u16` whose range is `0..=65535` + = note: `#[deny(overflowing_literals)]` on by default error: aborting due to previous error diff --git a/src/test/ui/lint/issue-70819-dont-override-forbid-in-same-scope.stderr b/src/test/ui/lint/issue-70819-dont-override-forbid-in-same-scope.stderr index 5093715de..cc44f8aa5 100644 --- a/src/test/ui/lint/issue-70819-dont-override-forbid-in-same-scope.stderr +++ b/src/test/ui/lint/issue-70819-dont-override-forbid-in-same-scope.stderr @@ -6,13 +6,13 @@ LL | #![forbid(unused)] LL | #![deny(unused)] | ^^^^^^ 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> note: the lint level is defined here --> $DIR/issue-70819-dont-override-forbid-in-same-scope.rs:17:11 | LL | #![forbid(forbidden_lint_groups)] | ^^^^^^^^^^^^^^^^^^^^^ - = 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 previous error diff --git a/src/test/ui/lint/issue-79744.stderr b/src/test/ui/lint/issue-79744.stderr index 6f6dd44d2..c1b56250d 100644 --- a/src/test/ui/lint/issue-79744.stderr +++ b/src/test/ui/lint/issue-79744.stderr @@ -4,9 +4,9 @@ error: literal out of range for `i8` LL | let e2 = 230; | ^^^ | - = note: `#[deny(overflowing_literals)]` on by default = note: the literal `230` does not fit into the type `i8` whose range is `-128..=127` = help: consider using the type `u8` instead + = note: `#[deny(overflowing_literals)]` on by default error: aborting due to previous error diff --git a/src/test/ui/lint/issue-80988.stderr b/src/test/ui/lint/issue-80988.stderr index 1d397f431..73e27ffda 100644 --- a/src/test/ui/lint/issue-80988.stderr +++ b/src/test/ui/lint/issue-80988.stderr @@ -7,9 +7,9 @@ LL | LL | #[deny(warnings)] | ^^^^^^^^ overruled by previous forbid | - = note: `#[warn(forbidden_lint_groups)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #81670 <https://github.com/rust-lang/rust/issues/81670> + = note: `#[warn(forbidden_lint_groups)]` on by default warning: deny(warnings) incompatible with previous forbid --> $DIR/issue-80988.rs:7:8 diff --git a/src/test/ui/lint/issue-83477.stderr b/src/test/ui/lint/issue-83477.stderr index e619bcfe2..f824fc09e 100644 --- a/src/test/ui/lint/issue-83477.stderr +++ b/src/test/ui/lint/issue-83477.stderr @@ -18,13 +18,13 @@ warning: prefer `FxHashMap` over `HashMap`, it has better performance LL | let _ = std::collections::HashMap::<String, String>::new(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary note: the lint level is defined here --> $DIR/issue-83477.rs:3:9 | LL | #![warn(rustc::internal)] | ^^^^^^^^^^^^^^^ = note: `#[warn(rustc::default_hash_types)]` implied by `#[warn(rustc::internal)]` - = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary warning: 3 warnings emitted diff --git a/src/test/ui/lint/issue-86600-lint-twice.stderr b/src/test/ui/lint/issue-86600-lint-twice.stderr index 8da3fb5a8..5a65c6121 100644 --- a/src/test/ui/lint/issue-86600-lint-twice.stderr +++ b/src/test/ui/lint/issue-86600-lint-twice.stderr @@ -4,9 +4,9 @@ warning: floating-point types cannot be used in patterns LL | 5.0 => {} | ^^^ | - = note: `#[warn(illegal_floating_point_literal_pattern)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620> + = note: `#[warn(illegal_floating_point_literal_pattern)]` on by default warning: 1 warning emitted diff --git a/src/test/ui/lint/lint-attr-everywhere-early.stderr b/src/test/ui/lint/lint-attr-everywhere-early.stderr index 1d6e3cda4..d6c6d5fae 100644 --- a/src/test/ui/lint/lint-attr-everywhere-early.stderr +++ b/src/test/ui/lint/lint-attr-everywhere-early.stderr @@ -474,13 +474,13 @@ error: `...` range patterns are deprecated LL | f1: 0...100, | ^^^ help: use `..=` for an inclusive range | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> note: the lint level is defined here --> $DIR/lint-attr-everywhere-early.rs:166:20 | LL | #[deny(ellipsis_inclusive_range_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> error: aborting due to 36 previous errors diff --git a/src/test/ui/lint/lint-attr-everywhere-late.stderr b/src/test/ui/lint/lint-attr-everywhere-late.stderr index 977843997..a69c2e0ef 100644 --- a/src/test/ui/lint/lint-attr-everywhere-late.stderr +++ b/src/test/ui/lint/lint-attr-everywhere-late.stderr @@ -163,13 +163,13 @@ LL | fn clashing1(); LL | fn clashing1(_: i32); | ^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | + = note: expected `unsafe extern "C" fn()` + found `unsafe extern "C" fn(i32)` note: the lint level is defined here --> $DIR/lint-attr-everywhere-late.rs:122:13 | LL | #![deny(clashing_extern_declarations)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected `unsafe extern "C" fn()` - found `unsafe extern "C" fn(i32)` error: `clashing2` redeclared with a different signature --> $DIR/lint-attr-everywhere-late.rs:128:5 @@ -180,13 +180,13 @@ LL | fn clashing2(); LL | fn clashing2(_: i32); | ^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration | + = note: expected `unsafe extern "C" fn()` + found `unsafe extern "C" fn(i32)` note: the lint level is defined here --> $DIR/lint-attr-everywhere-late.rs:127:12 | LL | #[deny(clashing_extern_declarations)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = note: expected `unsafe extern "C" fn()` - found `unsafe extern "C" fn(i32)` error: types that do not implement `Drop` can still have drop glue, consider instead using `std::mem::needs_drop` to detect whether a type is trivially dropped --> $DIR/lint-attr-everywhere-late.rs:93:38 @@ -206,16 +206,16 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | fn assoc_fn() { discriminant::<i32>(&123); } | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/lint-attr-everywhere-late.rs:95:12 - | -LL | #[deny(enum_intrinsics_non_enums)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. --> $DIR/lint-attr-everywhere-late.rs:96:41 | LL | fn assoc_fn() { discriminant::<i32>(&123); } | ^^^^ +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:95:12 + | +LL | #[deny(enum_intrinsics_non_enums)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: literal out of range for `u8` --> $DIR/lint-attr-everywhere-late.rs:98:59 @@ -223,12 +223,12 @@ error: literal out of range for `u8` LL | #[deny(overflowing_literals)] const ASSOC_CONST: u8 = 1000; | ^^^^ | + = note: the literal `1000` does not fit into the type `u8` whose range is `0..=255` note: the lint level is defined here --> $DIR/lint-attr-everywhere-late.rs:98:12 | LL | #[deny(overflowing_literals)] const ASSOC_CONST: u8 = 1000; | ^^^^^^^^^^^^^^^^^^^^ - = note: the literal `1000` does not fit into the type `u8` whose range is `0..=255` error: variable `PARAM` should have a snake case name --> $DIR/lint-attr-everywhere-late.rs:131:37 @@ -248,16 +248,16 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | let _ = discriminant::<i32>(&123); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/lint-attr-everywhere-late.rs:138:12 - | -LL | #[deny(enum_intrinsics_non_enums)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. --> $DIR/lint-attr-everywhere-late.rs:139:33 | LL | let _ = discriminant::<i32>(&123); | ^^^^ +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:138:12 + | +LL | #[deny(enum_intrinsics_non_enums)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: variable `PARAM` should have a snake case name --> $DIR/lint-attr-everywhere-late.rs:145:44 @@ -277,16 +277,16 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant::<i32>(&123); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/lint-attr-everywhere-late.rs:153:17 - | -LL | #![deny(enum_intrinsics_non_enums)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. --> $DIR/lint-attr-everywhere-late.rs:155:33 | LL | discriminant::<i32>(&123); | ^^^^ +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:153:17 + | +LL | #![deny(enum_intrinsics_non_enums)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type --> $DIR/lint-attr-everywhere-late.rs:161:13 @@ -294,16 +294,16 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant::<i32>(&123); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/lint-attr-everywhere-late.rs:159:16 - | -LL | #[deny(enum_intrinsics_non_enums)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. --> $DIR/lint-attr-everywhere-late.rs:161:33 | LL | discriminant::<i32>(&123); | ^^^^ +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:159:16 + | +LL | #[deny(enum_intrinsics_non_enums)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type --> $DIR/lint-attr-everywhere-late.rs:168:9 @@ -311,16 +311,16 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant::<i32>(&123); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/lint-attr-everywhere-late.rs:167:17 - | -LL | #![deny(enum_intrinsics_non_enums)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. --> $DIR/lint-attr-everywhere-late.rs:168:29 | LL | discriminant::<i32>(&123); | ^^^^ +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:167:17 + | +LL | #![deny(enum_intrinsics_non_enums)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type --> $DIR/lint-attr-everywhere-late.rs:172:9 @@ -328,16 +328,16 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant::<i32>(&123); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/lint-attr-everywhere-late.rs:171:16 - | -LL | #[deny(enum_intrinsics_non_enums)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. --> $DIR/lint-attr-everywhere-late.rs:172:29 | LL | discriminant::<i32>(&123); | ^^^^ +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:171:16 + | +LL | #[deny(enum_intrinsics_non_enums)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type --> $DIR/lint-attr-everywhere-late.rs:177:5 @@ -345,16 +345,16 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant::<i32>(&123); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/lint-attr-everywhere-late.rs:176:12 - | -LL | #[deny(enum_intrinsics_non_enums)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. --> $DIR/lint-attr-everywhere-late.rs:177:25 | LL | discriminant::<i32>(&123); | ^^^^ +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:176:12 + | +LL | #[deny(enum_intrinsics_non_enums)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type --> $DIR/lint-attr-everywhere-late.rs:179:41 @@ -362,16 +362,16 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | [#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)]; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/lint-attr-everywhere-late.rs:179:13 - | -LL | [#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. --> $DIR/lint-attr-everywhere-late.rs:179:61 | LL | [#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)]; | ^^^^ +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:179:13 + | +LL | [#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type --> $DIR/lint-attr-everywhere-late.rs:180:41 @@ -379,16 +379,16 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | (#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123),); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/lint-attr-everywhere-late.rs:180:13 - | -LL | (#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123),); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. --> $DIR/lint-attr-everywhere-late.rs:180:61 | LL | (#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123),); | ^^^^ +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:180:13 + | +LL | (#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123),); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type --> $DIR/lint-attr-everywhere-late.rs:182:45 @@ -396,16 +396,16 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | call(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/lint-attr-everywhere-late.rs:182:17 - | -LL | call(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. --> $DIR/lint-attr-everywhere-late.rs:182:65 | LL | call(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)); | ^^^^ +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:182:17 + | +LL | call(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type --> $DIR/lint-attr-everywhere-late.rs:184:52 @@ -413,16 +413,16 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/lint-attr-everywhere-late.rs:184:24 - | -LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `i32`, which is not an enum. --> $DIR/lint-attr-everywhere-late.rs:184:72 | LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)); | ^^^^ +note: the lint level is defined here + --> $DIR/lint-attr-everywhere-late.rs:184:24 + | +LL | TupleStruct(#[deny(enum_intrinsics_non_enums)] discriminant::<i32>(&123)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 31 previous errors diff --git a/src/test/ui/lint/lint-const-item-mutation.stderr b/src/test/ui/lint/lint-const-item-mutation.stderr index 94d876423..9f4360e67 100644 --- a/src/test/ui/lint/lint-const-item-mutation.stderr +++ b/src/test/ui/lint/lint-const-item-mutation.stderr @@ -4,13 +4,13 @@ warning: attempting to modify a `const` item LL | ARRAY[0] = 5; | ^^^^^^^^^^^^ | - = note: `#[warn(const_item_mutation)]` on by default = note: each usage of a `const` item creates a new temporary; the original `const` item will not be modified note: `const` item defined here --> $DIR/lint-const-item-mutation.rs:26:1 | LL | const ARRAY: [u8; 1] = [25]; | ^^^^^^^^^^^^^^^^^^^^ + = note: `#[warn(const_item_mutation)]` on by default warning: attempting to modify a `const` item --> $DIR/lint-const-item-mutation.rs:38:5 diff --git a/src/test/ui/lint/lint-ctypes-73249-2.stderr b/src/test/ui/lint/lint-ctypes-73249-2.stderr index 7c85e9fa8..8073c33dd 100644 --- a/src/test/ui/lint/lint-ctypes-73249-2.stderr +++ b/src/test/ui/lint/lint-ctypes-73249-2.stderr @@ -4,12 +4,12 @@ error: `extern` block uses type `Qux`, which is not FFI-safe LL | pub fn lint_me() -> A<()>; | ^^^^^ not FFI-safe | + = note: opaque types have no C equivalent note: the lint level is defined here --> $DIR/lint-ctypes-73249-2.rs:2:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ - = note: opaque types have no C equivalent error: aborting due to previous error diff --git a/src/test/ui/lint/lint-ctypes-73249-3.stderr b/src/test/ui/lint/lint-ctypes-73249-3.stderr index 83e2a233c..c41ce666d 100644 --- a/src/test/ui/lint/lint-ctypes-73249-3.stderr +++ b/src/test/ui/lint/lint-ctypes-73249-3.stderr @@ -4,12 +4,12 @@ error: `extern` block uses type `Qux`, which is not FFI-safe LL | pub fn lint_me() -> A; | ^ not FFI-safe | + = note: opaque types have no C equivalent note: the lint level is defined here --> $DIR/lint-ctypes-73249-3.rs:2:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ - = note: opaque types have no C equivalent error: aborting due to previous error diff --git a/src/test/ui/lint/lint-ctypes-73249-5.stderr b/src/test/ui/lint/lint-ctypes-73249-5.stderr index 37781d78c..98245c4f1 100644 --- a/src/test/ui/lint/lint-ctypes-73249-5.stderr +++ b/src/test/ui/lint/lint-ctypes-73249-5.stderr @@ -4,12 +4,12 @@ error: `extern` block uses type `Qux`, which is not FFI-safe LL | pub fn lint_me() -> A; | ^ not FFI-safe | + = note: opaque types have no C equivalent note: the lint level is defined here --> $DIR/lint-ctypes-73249-5.rs:2:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ - = note: opaque types have no C equivalent error: aborting due to previous error diff --git a/src/test/ui/lint/lint-ctypes-73251-1.stderr b/src/test/ui/lint/lint-ctypes-73251-1.stderr index 76b19d37e..9f43576ad 100644 --- a/src/test/ui/lint/lint-ctypes-73251-1.stderr +++ b/src/test/ui/lint/lint-ctypes-73251-1.stderr @@ -4,12 +4,12 @@ error: `extern` block uses type `Qux`, which is not FFI-safe LL | pub fn lint_me() -> <u32 as Foo>::Assoc; | ^^^^^^^^^^^^^^^^^^^ not FFI-safe | + = note: opaque types have no C equivalent note: the lint level is defined here --> $DIR/lint-ctypes-73251-1.rs:2:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ - = note: opaque types have no C equivalent error: aborting due to previous error diff --git a/src/test/ui/lint/lint-ctypes-73251-2.stderr b/src/test/ui/lint/lint-ctypes-73251-2.stderr index 64f0fb2d8..0b3de379c 100644 --- a/src/test/ui/lint/lint-ctypes-73251-2.stderr +++ b/src/test/ui/lint/lint-ctypes-73251-2.stderr @@ -4,12 +4,12 @@ error: `extern` block uses type `AliasA`, which is not FFI-safe LL | pub fn lint_me() -> <AliasB as TraitB>::Assoc; | ^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe | + = note: opaque types have no C equivalent note: the lint level is defined here --> $DIR/lint-ctypes-73251-2.rs:2:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ - = note: opaque types have no C equivalent error: aborting due to previous error diff --git a/src/test/ui/lint/lint-ctypes-enum.stderr b/src/test/ui/lint/lint-ctypes-enum.stderr index de532f69a..8554e2617 100644 --- a/src/test/ui/lint/lint-ctypes-enum.stderr +++ b/src/test/ui/lint/lint-ctypes-enum.stderr @@ -4,11 +4,6 @@ error: `extern` block uses type `U`, which is not FFI-safe LL | fn uf(x: U); | ^ not FFI-safe | -note: the lint level is defined here - --> $DIR/lint-ctypes-enum.rs:3:9 - | -LL | #![deny(improper_ctypes)] - | ^^^^^^^^^^^^^^^ = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum = note: enum has no representation hint note: the type is defined here @@ -16,6 +11,11 @@ note: the type is defined here | LL | enum U { | ^^^^^^ +note: the lint level is defined here + --> $DIR/lint-ctypes-enum.rs:3:9 + | +LL | #![deny(improper_ctypes)] + | ^^^^^^^^^^^^^^^ error: `extern` block uses type `B`, which is not FFI-safe --> $DIR/lint-ctypes-enum.rs:61:13 diff --git a/src/test/ui/lint/lint-ctypes-fn.stderr b/src/test/ui/lint/lint-ctypes-fn.stderr index 6f8d76411..a05206bf1 100644 --- a/src/test/ui/lint/lint-ctypes-fn.stderr +++ b/src/test/ui/lint/lint-ctypes-fn.stderr @@ -4,13 +4,13 @@ error: `extern` fn uses type `[u32]`, which is not FFI-safe LL | pub extern "C" fn slice_type(p: &[u32]) { } | ^^^^^^ not FFI-safe | + = help: consider using a raw pointer instead + = note: slices have no C equivalent note: the lint level is defined here --> $DIR/lint-ctypes-fn.rs:4:9 | LL | #![deny(improper_ctypes_definitions)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = help: consider using a raw pointer instead - = note: slices have no C equivalent error: `extern` fn uses type `str`, which is not FFI-safe --> $DIR/lint-ctypes-fn.rs:76:31 diff --git a/src/test/ui/lint/lint-ctypes.stderr b/src/test/ui/lint/lint-ctypes.stderr index bfec40e19..121ad0ce8 100644 --- a/src/test/ui/lint/lint-ctypes.stderr +++ b/src/test/ui/lint/lint-ctypes.stderr @@ -4,11 +4,6 @@ error: `extern` block uses type `Foo`, which is not FFI-safe LL | pub fn ptr_type1(size: *const Foo); | ^^^^^^^^^^ not FFI-safe | -note: the lint level is defined here - --> $DIR/lint-ctypes.rs:4:9 - | -LL | #![deny(improper_ctypes)] - | ^^^^^^^^^^^^^^^ = help: consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct = note: this struct has unspecified layout note: the type is defined here @@ -16,6 +11,11 @@ note: the type is defined here | LL | pub struct Foo; | ^^^^^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/lint-ctypes.rs:4:9 + | +LL | #![deny(improper_ctypes)] + | ^^^^^^^^^^^^^^^ error: `extern` block uses type `Foo`, which is not FFI-safe --> $DIR/lint-ctypes.rs:49:28 diff --git a/src/test/ui/lint/lint-enum-intrinsics-non-enums.stderr b/src/test/ui/lint/lint-enum-intrinsics-non-enums.stderr index bec9fb62e..63ed2503c 100644 --- a/src/test/ui/lint/lint-enum-intrinsics-non-enums.stderr +++ b/src/test/ui/lint/lint-enum-intrinsics-non-enums.stderr @@ -4,12 +4,12 @@ error: the return value of `mem::discriminant` is unspecified when called with a LL | discriminant(&()); | ^^^^^^^^^^^^^^^^^ | - = note: `#[deny(enum_intrinsics_non_enums)]` on by default note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `()`, which is not an enum. --> $DIR/lint-enum-intrinsics-non-enums.rs:26:18 | LL | discriminant(&()); | ^^^ + = note: `#[deny(enum_intrinsics_non_enums)]` on by default error: the return value of `mem::discriminant` is unspecified when called with a non-enum type --> $DIR/lint-enum-intrinsics-non-enums.rs:29:5 diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr index d7fd51461..3a84c6c1f 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.noopt.stderr @@ -7,7 +7,7 @@ LL | const N: i32 = T::N << 42; note: the lint level is defined here --> $DIR/lint-exceeding-bitshifts.rs:10:9 | -LL | #![warn(arithmetic_overflow, const_err)] +LL | #![warn(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ warning: this arithmetic operation will overflow diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr index d7fd51461..3a84c6c1f 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.opt.stderr @@ -7,7 +7,7 @@ LL | const N: i32 = T::N << 42; note: the lint level is defined here --> $DIR/lint-exceeding-bitshifts.rs:10:9 | -LL | #![warn(arithmetic_overflow, const_err)] +LL | #![warn(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ warning: this arithmetic operation will overflow diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.opt_with_overflow_checks.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.opt_with_overflow_checks.stderr index d7fd51461..3a84c6c1f 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.opt_with_overflow_checks.stderr +++ b/src/test/ui/lint/lint-exceeding-bitshifts.opt_with_overflow_checks.stderr @@ -7,7 +7,7 @@ LL | const N: i32 = T::N << 42; note: the lint level is defined here --> $DIR/lint-exceeding-bitshifts.rs:10:9 | -LL | #![warn(arithmetic_overflow, const_err)] +LL | #![warn(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ warning: this arithmetic operation will overflow diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.rs b/src/test/ui/lint/lint-exceeding-bitshifts.rs index d8774cb4d..048c1aff8 100644 --- a/src/test/ui/lint/lint-exceeding-bitshifts.rs +++ b/src/test/ui/lint/lint-exceeding-bitshifts.rs @@ -7,7 +7,7 @@ // normalize-stderr-test "shift left by `(64|32)_usize`, which" -> "shift left by `%BITS%`, which" #![crate_type="lib"] -#![warn(arithmetic_overflow, const_err)] +#![warn(arithmetic_overflow)] pub trait Foo { diff --git a/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr b/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr index afbab9896..2cc4d382d 100644 --- a/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr +++ b/src/test/ui/lint/lint-incoherent-auto-trait-objects.stderr @@ -7,9 +7,9 @@ LL | LL | impl Foo for dyn Send + Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)` | - = note: `#[deny(order_dependent_trait_objects)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484> + = note: `#[deny(order_dependent_trait_objects)]` on by default error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) --> $DIR/lint-incoherent-auto-trait-objects.rs:11:1 @@ -37,3 +37,45 @@ LL | impl Foo for dyn Send + Sync + Send {} error: aborting due to 3 previous errors +Future incompatibility report: Future breakage diagnostic: +error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + 'static)`: (E0119) + --> $DIR/lint-incoherent-auto-trait-objects.rs:5:1 + | +LL | impl Foo for dyn Send {} + | --------------------- first implementation here +LL | +LL | impl Foo for dyn Send + Send {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)` + | + = 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 #56484 <https://github.com/rust-lang/rust/issues/56484> + = note: `#[deny(order_dependent_trait_objects)]` on by default + +Future breakage diagnostic: +error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) + --> $DIR/lint-incoherent-auto-trait-objects.rs:11:1 + | +LL | impl Foo for dyn Send + Sync {} + | ---------------------------- first implementation here +LL | +LL | impl Foo for dyn Sync + Send {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` + | + = 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 #56484 <https://github.com/rust-lang/rust/issues/56484> + = note: `#[deny(order_dependent_trait_objects)]` on by default + +Future breakage diagnostic: +error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119) + --> $DIR/lint-incoherent-auto-trait-objects.rs:15:1 + | +LL | impl Foo for dyn Sync + Send {} + | ---------------------------- first implementation here +... +LL | impl Foo for dyn Send + Sync + Send {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)` + | + = 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 #56484 <https://github.com/rust-lang/rust/issues/56484> + = note: `#[deny(order_dependent_trait_objects)]` on by default + diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-bool.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-bool.stderr index 2a1847b98..9f38dcb0b 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-bool.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-bool.stderr @@ -4,8 +4,8 @@ error: atomic loads cannot have `Release` or `AcqRel` ordering LL | let _ = x.load(Ordering::Release); | ^^^^^^^^^^^^^^^^^ | - = note: `#[deny(invalid_atomic_ordering)]` on by default = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` + = note: `#[deny(invalid_atomic_ordering)]` on by default error: atomic loads cannot have `Release` or `AcqRel` ordering --> $DIR/lint-invalid-atomic-ordering-bool.rs:15:20 diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr index 021654cf3..cc075ce9e 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange-weak.stderr @@ -4,8 +4,8 @@ error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRe LL | let _ = x.compare_exchange_weak(ptr2, ptr, Ordering::Relaxed, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = note: `#[deny(invalid_atomic_ordering)]` on by default = help: consider using `Acquire` or `Relaxed` failure ordering instead + = note: `#[deny(invalid_atomic_ordering)]` on by default error: `compare_exchange_weak`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange_weak` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange-weak.rs:30:67 diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr index f6f8f88e8..fe6c7e55c 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-exchange.stderr @@ -4,8 +4,8 @@ error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, s LL | let _ = x.compare_exchange(0, 0, Ordering::Relaxed, Ordering::AcqRel); | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = note: `#[deny(invalid_atomic_ordering)]` on by default = help: consider using `Acquire` or `Relaxed` failure ordering instead + = note: `#[deny(invalid_atomic_ordering)]` on by default error: `compare_exchange`'s failure ordering may not be `Release` or `AcqRel`, since a failed `compare_exchange` does not result in a write --> $DIR/lint-invalid-atomic-ordering-exchange.rs:28:57 diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-fence.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-fence.stderr index e0741ffed..38327d607 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-fence.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-fence.stderr @@ -4,8 +4,8 @@ error: memory fences cannot have `Relaxed` ordering LL | fence(Ordering::Relaxed); | ^^^^^^^^^^^^^^^^^ | - = note: `#[deny(invalid_atomic_ordering)]` on by default = help: consider using ordering modes `Acquire`, `Release`, `AcqRel` or `SeqCst` + = note: `#[deny(invalid_atomic_ordering)]` on by default error: memory fences cannot have `Relaxed` ordering --> $DIR/lint-invalid-atomic-ordering-fence.rs:19:20 diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr index 267b1c706..33829d68f 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-fetch-update.stderr @@ -4,8 +4,8 @@ error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since LL | let _ = x.fetch_update(Ordering::Relaxed, Ordering::AcqRel, |old| Some(old + 1)); | ^^^^^^^^^^^^^^^^ invalid failure ordering | - = note: `#[deny(invalid_atomic_ordering)]` on by default = help: consider using `Acquire` or `Relaxed` failure ordering instead + = note: `#[deny(invalid_atomic_ordering)]` on by default error: `fetch_update`'s failure ordering may not be `Release` or `AcqRel`, since a failed `fetch_update` does not result in a write --> $DIR/lint-invalid-atomic-ordering-fetch-update.rs:28:47 diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-int.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-int.stderr index dfd999045..36930e2f4 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-int.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-int.stderr @@ -4,8 +4,8 @@ error: atomic loads cannot have `Release` or `AcqRel` ordering LL | let _ = x.load(Ordering::Release); | ^^^^^^^^^^^^^^^^^ | - = note: `#[deny(invalid_atomic_ordering)]` on by default = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` + = note: `#[deny(invalid_atomic_ordering)]` on by default error: atomic loads cannot have `Release` or `AcqRel` ordering --> $DIR/lint-invalid-atomic-ordering-int.rs:22:20 diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-ptr.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-ptr.stderr index f00cb8e40..12f4cad90 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-ptr.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-ptr.stderr @@ -4,8 +4,8 @@ error: atomic loads cannot have `Release` or `AcqRel` ordering LL | let _ = x.load(Ordering::Release); | ^^^^^^^^^^^^^^^^^ | - = note: `#[deny(invalid_atomic_ordering)]` on by default = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` + = note: `#[deny(invalid_atomic_ordering)]` on by default error: atomic loads cannot have `Release` or `AcqRel` ordering --> $DIR/lint-invalid-atomic-ordering-ptr.rs:17:20 diff --git a/src/test/ui/lint/lint-invalid-atomic-ordering-uint.stderr b/src/test/ui/lint/lint-invalid-atomic-ordering-uint.stderr index 36672e434..d26621f2a 100644 --- a/src/test/ui/lint/lint-invalid-atomic-ordering-uint.stderr +++ b/src/test/ui/lint/lint-invalid-atomic-ordering-uint.stderr @@ -4,8 +4,8 @@ error: atomic loads cannot have `Release` or `AcqRel` ordering LL | let _ = x.load(Ordering::Release); | ^^^^^^^^^^^^^^^^^ | - = note: `#[deny(invalid_atomic_ordering)]` on by default = help: consider using ordering modes `Acquire`, `SeqCst` or `Relaxed` + = note: `#[deny(invalid_atomic_ordering)]` on by default error: atomic loads cannot have `Release` or `AcqRel` ordering --> $DIR/lint-invalid-atomic-ordering-uint.rs:21:20 diff --git a/src/test/ui/lint/lint-non-snake-case-crate-2.stderr b/src/test/ui/lint/lint-non-snake-case-crate-2.stderr index e29511293..4b42145bb 100644 --- a/src/test/ui/lint/lint-non-snake-case-crate-2.stderr +++ b/src/test/ui/lint/lint-non-snake-case-crate-2.stderr @@ -1,11 +1,11 @@ error: crate `NonSnakeCase` should have a snake case name | + = help: convert the identifier to snake case: `non_snake_case` note: the lint level is defined here --> $DIR/lint-non-snake-case-crate-2.rs:4:9 | LL | #![deny(non_snake_case)] | ^^^^^^^^^^^^^^ - = help: convert the identifier to snake case: `non_snake_case` error: aborting due to previous error diff --git a/src/test/ui/lint/lint-output-format.rs b/src/test/ui/lint/lint-output-format.rs index 169a98c94..67e8ec8f1 100644 --- a/src/test/ui/lint/lint-output-format.rs +++ b/src/test/ui/lint/lint-output-format.rs @@ -5,6 +5,7 @@ extern crate lint_output_format; //~ ERROR use of unstable library feature use lint_output_format::{foo, bar}; //~ ERROR use of unstable library feature +//~| ERROR use of unstable library feature fn main() { let _x = foo(); diff --git a/src/test/ui/lint/lint-output-format.stderr b/src/test/ui/lint/lint-output-format.stderr index 3bc1d6fc1..0db79a156 100644 --- a/src/test/ui/lint/lint-output-format.stderr +++ b/src/test/ui/lint/lint-output-format.stderr @@ -7,6 +7,14 @@ LL | extern crate lint_output_format; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' + --> $DIR/lint-output-format.rs:7:26 + | +LL | use lint_output_format::{foo, bar}; + | ^^^ + | + = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable + +error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/lint-output-format.rs:7:31 | LL | use lint_output_format::{foo, bar}; @@ -15,13 +23,13 @@ LL | use lint_output_format::{foo, bar}; = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable error[E0658]: use of unstable library feature 'unstable_test_feature' - --> $DIR/lint-output-format.rs:11:14 + --> $DIR/lint-output-format.rs:12:14 | LL | let _y = bar(); | ^^^ | = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/lint/lint-pre-expansion-extern-module.stderr b/src/test/ui/lint/lint-pre-expansion-extern-module.stderr index 3355bb4e4..ce3e8806a 100644 --- a/src/test/ui/lint/lint-pre-expansion-extern-module.stderr +++ b/src/test/ui/lint/lint-pre-expansion-extern-module.stderr @@ -4,9 +4,9 @@ warning: `try` is a keyword in the 2018 edition LL | pub fn try() {} | ^^^ help: you can use a raw identifier to stay compatible: `r#try` | - = note: `-W keyword-idents` implied by `-W rust-2018-compatibility` = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018! = note: for more information, see issue #49716 <https://github.com/rust-lang/rust/issues/49716> + = note: `-W keyword-idents` implied by `-W rust-2018-compatibility` warning: 1 warning emitted diff --git a/src/test/ui/lint/lint-stability-deprecated.rs b/src/test/ui/lint/lint-stability-deprecated.rs index bdc66e830..74c35083e 100644 --- a/src/test/ui/lint/lint-stability-deprecated.rs +++ b/src/test/ui/lint/lint-stability-deprecated.rs @@ -130,7 +130,7 @@ mod cross_crate { let _ = UnstableTupleStruct (1); let _ = StableTupleStruct (1); - // At the moment, the lint checker only checks stability in + // At the moment, the lint checker only checks stability // in the arguments of macros. // Eventually, we will want to lint the contents of the // macro in the module *defining* it. Also, stability levels diff --git a/src/test/ui/lint/lint-strict-provenance-fuzzy-casts.stderr b/src/test/ui/lint/lint-strict-provenance-fuzzy-casts.stderr index c85934aa3..383623b48 100644 --- a/src/test/ui/lint/lint-strict-provenance-fuzzy-casts.stderr +++ b/src/test/ui/lint/lint-strict-provenance-fuzzy-casts.stderr @@ -4,12 +4,12 @@ error: strict provenance disallows casting integer `usize` to pointer `*const u8 LL | let dangling = 16_usize as *const u8; | ^^^^^^^^^^^^^^^^^^^^^ | + = help: if you can't comply with strict provenance and don't have a pointer with the correct provenance you can use `std::ptr::from_exposed_addr()` instead note: the lint level is defined here --> $DIR/lint-strict-provenance-fuzzy-casts.rs:2:9 | LL | #![deny(fuzzy_provenance_casts)] | ^^^^^^^^^^^^^^^^^^^^^^ - = help: if you can't comply with strict provenance and don't have a pointer with the correct provenance you can use `std::ptr::from_exposed_addr()` instead help: use `.with_addr()` to adjust a valid pointer in the same allocation, to this address | LL | let dangling = (...).with_addr(16_usize); diff --git a/src/test/ui/lint/lint-strict-provenance-lossy-casts.stderr b/src/test/ui/lint/lint-strict-provenance-lossy-casts.stderr index 05178b34b..aa151fe2d 100644 --- a/src/test/ui/lint/lint-strict-provenance-lossy-casts.stderr +++ b/src/test/ui/lint/lint-strict-provenance-lossy-casts.stderr @@ -4,12 +4,12 @@ error: under strict provenance it is considered bad style to cast pointer `*cons LL | let addr: usize = &x as *const u8 as usize; | ^^^^^^^^^^^^^^^^^^^^^^^^ | + = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_addr()` instead note: the lint level is defined here --> $DIR/lint-strict-provenance-lossy-casts.rs:2:9 | LL | #![deny(lossy_provenance_casts)] | ^^^^^^^^^^^^^^^^^^^^^^ - = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_addr()` instead help: use `.addr()` to obtain the address of a pointer | LL | let addr: usize = (&x as *const u8).addr(); diff --git a/src/test/ui/lint/lint-temporary-cstring-as-param.stderr b/src/test/ui/lint/lint-temporary-cstring-as-param.stderr index 0a9e5a4bf..838b3bc13 100644 --- a/src/test/ui/lint/lint-temporary-cstring-as-param.stderr +++ b/src/test/ui/lint/lint-temporary-cstring-as-param.stderr @@ -6,13 +6,13 @@ LL | some_function(CString::new("").unwrap().as_ptr()); | | | this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime | + = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html note: the lint level is defined here --> $DIR/lint-temporary-cstring-as-param.rs:1:9 | LL | #![deny(temporary_cstring_as_ptr)] | ^^^^^^^^^^^^^^^^^^^^^^^^ - = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned - = help: for more information, see https://doc.rust-lang.org/reference/destructors.html error: aborting due to previous error diff --git a/src/test/ui/lint/lint-temporary-cstring-as-ptr.stderr b/src/test/ui/lint/lint-temporary-cstring-as-ptr.stderr index e69d2dd53..79ef57dd1 100644 --- a/src/test/ui/lint/lint-temporary-cstring-as-ptr.stderr +++ b/src/test/ui/lint/lint-temporary-cstring-as-ptr.stderr @@ -6,13 +6,13 @@ LL | let s = CString::new("some text").unwrap().as_ptr(); | | | this `CString` is deallocated at the end of the statement, bind it to a variable to extend its lifetime | + = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned + = help: for more information, see https://doc.rust-lang.org/reference/destructors.html note: the lint level is defined here --> $DIR/lint-temporary-cstring-as-ptr.rs:2:9 | LL | #![deny(temporary_cstring_as_ptr)] | ^^^^^^^^^^^^^^^^^^^^^^^^ - = note: pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned - = help: for more information, see https://doc.rust-lang.org/reference/destructors.html error: aborting due to previous error diff --git a/src/test/ui/lint/lint-type-limits2.stderr b/src/test/ui/lint/lint-type-limits2.stderr index 3562cb440..b3420ad8a 100644 --- a/src/test/ui/lint/lint-type-limits2.stderr +++ b/src/test/ui/lint/lint-type-limits2.stderr @@ -12,13 +12,13 @@ warning: literal out of range for `i8` LL | 128 > bar() | ^^^ | + = note: the literal `128` does not fit into the type `i8` whose range is `-128..=127` + = help: consider using the type `u8` instead note: the lint level is defined here --> $DIR/lint-type-limits2.rs:2:9 | LL | #![warn(overflowing_literals)] | ^^^^^^^^^^^^^^^^^^^^ - = note: the literal `128` does not fit into the type `i8` whose range is `-128..=127` - = help: consider using the type `u8` instead error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/lint/lint-type-limits3.stderr b/src/test/ui/lint/lint-type-limits3.stderr index 823d1a4c7..db46e7ae7 100644 --- a/src/test/ui/lint/lint-type-limits3.stderr +++ b/src/test/ui/lint/lint-type-limits3.stderr @@ -12,13 +12,13 @@ warning: literal out of range for `i8` LL | while 200 != i { | ^^^ | + = note: the literal `200` does not fit into the type `i8` whose range is `-128..=127` + = help: consider using the type `u8` instead note: the lint level is defined here --> $DIR/lint-type-limits3.rs:2:9 | LL | #![warn(overflowing_literals)] | ^^^^^^^^^^^^^^^^^^^^ - = note: the literal `200` does not fit into the type `i8` whose range is `-128..=127` - = help: consider using the type `u8` instead error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/lint/lint-type-overflow.stderr b/src/test/ui/lint/lint-type-overflow.stderr index 1bb1ec547..48d8228b8 100644 --- a/src/test/ui/lint/lint-type-overflow.stderr +++ b/src/test/ui/lint/lint-type-overflow.stderr @@ -4,12 +4,12 @@ error: literal out of range for `u8` LL | let x1: u8 = 256; | ^^^ | + = note: the literal `256` does not fit into the type `u8` whose range is `0..=255` note: the lint level is defined here --> $DIR/lint-type-overflow.rs:1:9 | LL | #![deny(overflowing_literals)] | ^^^^^^^^^^^^^^^^^^^^ - = note: the literal `256` does not fit into the type `u8` whose range is `0..=255` error: literal out of range for `u8` --> $DIR/lint-type-overflow.rs:13:14 diff --git a/src/test/ui/lint/lint-type-overflow2.rs b/src/test/ui/lint/lint-type-overflow2.rs index c1f874c07..9b1eb510b 100644 --- a/src/test/ui/lint/lint-type-overflow2.rs +++ b/src/test/ui/lint/lint-type-overflow2.rs @@ -1,7 +1,6 @@ // compile-flags: -O #![deny(overflowing_literals)] -#![deny(const_err)] fn main() { let x2: i8 = --128; //~ ERROR literal out of range for `i8` diff --git a/src/test/ui/lint/lint-type-overflow2.stderr b/src/test/ui/lint/lint-type-overflow2.stderr index 3d40cdf96..eb593d062 100644 --- a/src/test/ui/lint/lint-type-overflow2.stderr +++ b/src/test/ui/lint/lint-type-overflow2.stderr @@ -1,19 +1,19 @@ error: literal out of range for `i8` - --> $DIR/lint-type-overflow2.rs:7:20 + --> $DIR/lint-type-overflow2.rs:6:20 | LL | let x2: i8 = --128; | ^^^ | + = note: the literal `128` does not fit into the type `i8` whose range is `-128..=127` + = help: consider using the type `u8` instead note: the lint level is defined here --> $DIR/lint-type-overflow2.rs:3:9 | LL | #![deny(overflowing_literals)] | ^^^^^^^^^^^^^^^^^^^^ - = note: the literal `128` does not fit into the type `i8` whose range is `-128..=127` - = help: consider using the type `u8` instead error: literal out of range for `f32` - --> $DIR/lint-type-overflow2.rs:9:14 + --> $DIR/lint-type-overflow2.rs:8:14 | LL | let x = -3.40282357e+38_f32; | ^^^^^^^^^^^^^^^^^^ @@ -21,7 +21,7 @@ LL | let x = -3.40282357e+38_f32; = note: the literal `3.40282357e+38_f32` does not fit into the type `f32` and will be converted to `f32::INFINITY` error: literal out of range for `f32` - --> $DIR/lint-type-overflow2.rs:10:14 + --> $DIR/lint-type-overflow2.rs:9:14 | LL | let x = 3.40282357e+38_f32; | ^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | let x = 3.40282357e+38_f32; = note: the literal `3.40282357e+38_f32` does not fit into the type `f32` and will be converted to `f32::INFINITY` error: literal out of range for `f64` - --> $DIR/lint-type-overflow2.rs:11:14 + --> $DIR/lint-type-overflow2.rs:10:14 | LL | let x = -1.7976931348623159e+308_f64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL | let x = -1.7976931348623159e+308_f64; = note: the literal `1.7976931348623159e+308_f64` does not fit into the type `f64` and will be converted to `f64::INFINITY` error: literal out of range for `f64` - --> $DIR/lint-type-overflow2.rs:12:14 + --> $DIR/lint-type-overflow2.rs:11:14 | LL | let x = 1.7976931348623159e+308_f64; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/lint/lint-unconditional-recursion.stderr b/src/test/ui/lint/lint-unconditional-recursion.stderr index c11b73f41..9d200a789 100644 --- a/src/test/ui/lint/lint-unconditional-recursion.stderr +++ b/src/test/ui/lint/lint-unconditional-recursion.stderr @@ -6,12 +6,12 @@ LL | fn foo() { LL | foo(); | ----- recursive call site | + = help: a `loop` may express intention better if this is on purpose note: the lint level is defined here --> $DIR/lint-unconditional-recursion.rs:1:9 | LL | #![deny(unconditional_recursion)] | ^^^^^^^^^^^^^^^^^^^^^^^ - = help: a `loop` may express intention better if this is on purpose error: function cannot return without recursing --> $DIR/lint-unconditional-recursion.rs:14:1 diff --git a/src/test/ui/lint/lint-unsafe-code.stderr b/src/test/ui/lint/lint-unsafe-code.stderr index 8dde05fc4..037f0a832 100644 --- a/src/test/ui/lint/lint-unsafe-code.stderr +++ b/src/test/ui/lint/lint-unsafe-code.stderr @@ -4,12 +4,12 @@ error: declaration of a `no_mangle` function LL | #[no_mangle] fn foo() {} | ^^^^^^^^^^^^ | + = note: the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them note: the lint level is defined here --> $DIR/lint-unsafe-code.rs:3:9 | LL | #![deny(unsafe_code)] | ^^^^^^^^^^^ - = note: the linker's behavior with multiple libraries exporting duplicate symbol names is undefined and Rust cannot provide guarantees when you manually override them error: declaration of a `no_mangle` static --> $DIR/lint-unsafe-code.rs:32:1 diff --git a/src/test/ui/lint/must_not_suspend/boxed.stderr b/src/test/ui/lint/must_not_suspend/boxed.stderr index b3c9b4381..9efc7b069 100644 --- a/src/test/ui/lint/must_not_suspend/boxed.stderr +++ b/src/test/ui/lint/must_not_suspend/boxed.stderr @@ -6,11 +6,6 @@ LL | let _guard = bar(); LL | other().await; | ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/boxed.rs:3:9 - | -LL | #![deny(must_not_suspend)] - | ^^^^^^^^^^^^^^^^ note: You gotta use Umm's, ya know? --> $DIR/boxed.rs:20:9 | @@ -21,6 +16,11 @@ help: consider using a block (`{ ... }`) to shrink the value's scope, ending bef | LL | let _guard = bar(); | ^^^^^^ +note: the lint level is defined here + --> $DIR/boxed.rs:3:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/lint/must_not_suspend/dedup.stderr b/src/test/ui/lint/must_not_suspend/dedup.stderr index 13fa3ae30..f8978ba57 100644 --- a/src/test/ui/lint/must_not_suspend/dedup.stderr +++ b/src/test/ui/lint/must_not_suspend/dedup.stderr @@ -4,16 +4,16 @@ error: `No` held across a suspend point, but should not be LL | wheeee(&No {}).await; | ^^^^^ ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/dedup.rs:3:9 - | -LL | #![deny(must_not_suspend)] - | ^^^^^^^^^^^^^^^^ help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point --> $DIR/dedup.rs:16:13 | LL | wheeee(&No {}).await; | ^^^^^ +note: the lint level is defined here + --> $DIR/dedup.rs:3:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/lint/must_not_suspend/gated.stderr b/src/test/ui/lint/must_not_suspend/gated.stderr index b58ecb555..64de1ebea 100644 --- a/src/test/ui/lint/must_not_suspend/gated.stderr +++ b/src/test/ui/lint/must_not_suspend/gated.stderr @@ -4,10 +4,10 @@ warning: unknown lint: `must_not_suspend` LL | #![deny(must_not_suspend)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(unknown_lints)]` on by default = note: the `must_not_suspend` lint is unstable = note: see issue #83310 <https://github.com/rust-lang/rust/issues/83310> for more information = help: add `#![feature(must_not_suspend)]` to the crate attributes to enable + = note: `#[warn(unknown_lints)]` on by default warning: unknown lint: `must_not_suspend` --> $DIR/gated.rs:4:1 diff --git a/src/test/ui/lint/must_not_suspend/mutex.stderr b/src/test/ui/lint/must_not_suspend/mutex.stderr index a968b7ca0..c251cb845 100644 --- a/src/test/ui/lint/must_not_suspend/mutex.stderr +++ b/src/test/ui/lint/must_not_suspend/mutex.stderr @@ -6,11 +6,6 @@ LL | let _guard = m.lock().unwrap(); LL | other().await; | ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/mutex.rs:3:9 - | -LL | #![deny(must_not_suspend)] - | ^^^^^^^^^^^^^^^^ note: holding a MutexGuard across suspend points can cause deadlocks, delays, and cause Futures to not implement `Send` --> $DIR/mutex.rs:8:9 | @@ -21,6 +16,11 @@ help: consider using a block (`{ ... }`) to shrink the value's scope, ending bef | LL | let _guard = m.lock().unwrap(); | ^^^^^^ +note: the lint level is defined here + --> $DIR/mutex.rs:3:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/lint/must_not_suspend/ref-drop-tracking.stderr b/src/test/ui/lint/must_not_suspend/ref-drop-tracking.stderr index c49d27128..180e187c1 100644 --- a/src/test/ui/lint/must_not_suspend/ref-drop-tracking.stderr +++ b/src/test/ui/lint/must_not_suspend/ref-drop-tracking.stderr @@ -7,11 +7,6 @@ LL | LL | other().await; | ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/ref-drop-tracking.rs:4:9 - | -LL | #![deny(must_not_suspend)] - | ^^^^^^^^^^^^^^^^ note: You gotta use Umm's, ya know? --> $DIR/ref-drop-tracking.rs:19:13 | @@ -22,6 +17,11 @@ help: consider using a block (`{ ... }`) to shrink the value's scope, ending bef | LL | let guard = &mut self.u; | ^^^^^ +note: the lint level is defined here + --> $DIR/ref-drop-tracking.rs:4:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr b/src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr index 0157c8b7f..abf76711b 100644 --- a/src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr +++ b/src/test/ui/lint/must_not_suspend/ref.drop_tracking.stderr @@ -7,11 +7,6 @@ LL | LL | other().await; | ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/ref.rs:6:9 - | -LL | #![deny(must_not_suspend)] - | ^^^^^^^^^^^^^^^^ note: You gotta use Umm's, ya know? --> $DIR/ref.rs:21:13 | @@ -22,6 +17,11 @@ help: consider using a block (`{ ... }`) to shrink the value's scope, ending bef | LL | let guard = &mut self.u; | ^^^^^ +note: the lint level is defined here + --> $DIR/ref.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr b/src/test/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr index 438e6489e..41ac09ea7 100644 --- a/src/test/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr +++ b/src/test/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr @@ -7,11 +7,6 @@ LL | LL | other().await; | ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/ref.rs:6:9 - | -LL | #![deny(must_not_suspend)] - | ^^^^^^^^^^^^^^^^ note: You gotta use Umm's, ya know? --> $DIR/ref.rs:21:26 | @@ -22,6 +17,11 @@ help: consider using a block (`{ ... }`) to shrink the value's scope, ending bef | LL | let guard = &mut self.u; | ^^^^^^ +note: the lint level is defined here + --> $DIR/ref.rs:6:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/lint/must_not_suspend/trait.stderr b/src/test/ui/lint/must_not_suspend/trait.stderr index 60369430a..d64d25aae 100644 --- a/src/test/ui/lint/must_not_suspend/trait.stderr +++ b/src/test/ui/lint/must_not_suspend/trait.stderr @@ -7,16 +7,16 @@ LL | let _guard1 = r#impl(); LL | other().await; | ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/trait.rs:3:9 - | -LL | #![deny(must_not_suspend)] - | ^^^^^^^^^^^^^^^^ help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point --> $DIR/trait.rs:21:9 | LL | let _guard1 = r#impl(); | ^^^^^^^ +note: the lint level is defined here + --> $DIR/trait.rs:3:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ error: boxed `Wow` trait object held across a suspend point, but should not be --> $DIR/trait.rs:22:9 diff --git a/src/test/ui/lint/must_not_suspend/unit.stderr b/src/test/ui/lint/must_not_suspend/unit.stderr index 42d037b35..c967dbac5 100644 --- a/src/test/ui/lint/must_not_suspend/unit.stderr +++ b/src/test/ui/lint/must_not_suspend/unit.stderr @@ -6,11 +6,6 @@ LL | let _guard = bar(); LL | other().await; | ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/unit.rs:3:9 - | -LL | #![deny(must_not_suspend)] - | ^^^^^^^^^^^^^^^^ note: You gotta use Umm's, ya know? --> $DIR/unit.rs:20:9 | @@ -21,6 +16,11 @@ help: consider using a block (`{ ... }`) to shrink the value's scope, ending bef | LL | let _guard = bar(); | ^^^^^^ +note: the lint level is defined here + --> $DIR/unit.rs:3:9 + | +LL | #![deny(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/lint/must_not_suspend/warn.stderr b/src/test/ui/lint/must_not_suspend/warn.stderr index 417c397da..fe551c652 100644 --- a/src/test/ui/lint/must_not_suspend/warn.stderr +++ b/src/test/ui/lint/must_not_suspend/warn.stderr @@ -6,11 +6,6 @@ LL | let _guard = bar(); LL | other().await; | ------ the value is held across this suspend point | -note: the lint level is defined here - --> $DIR/warn.rs:4:9 - | -LL | #![warn(must_not_suspend)] - | ^^^^^^^^^^^^^^^^ note: You gotta use Umm's, ya know? --> $DIR/warn.rs:21:9 | @@ -21,6 +16,11 @@ help: consider using a block (`{ ... }`) to shrink the value's scope, ending bef | LL | let _guard = bar(); | ^^^^^^ +note: the lint level is defined here + --> $DIR/warn.rs:4:9 + | +LL | #![warn(must_not_suspend)] + | ^^^^^^^^^^^^^^^^ warning: 1 warning emitted diff --git a/src/test/ui/lint/no-coverage.stderr b/src/test/ui/lint/no-coverage.stderr index 8452ccc7a..404efbeac 100644 --- a/src/test/ui/lint/no-coverage.stderr +++ b/src/test/ui/lint/no-coverage.stderr @@ -94,7 +94,7 @@ error: unconstrained opaque type LL | type U = impl Trait; | ^^^^^^^^^^ | - = note: `U` must be used in combination with a concrete type within the same module + = note: `U` must be used in combination with a concrete type within the same impl error: aborting due to 7 previous errors; 6 warnings emitted diff --git a/src/test/ui/lint/noop-method-call.rs b/src/test/ui/lint/noop-method-call.rs index 9870c8135..89b296635 100644 --- a/src/test/ui/lint/noop-method-call.rs +++ b/src/test/ui/lint/noop-method-call.rs @@ -46,6 +46,7 @@ fn main() { fn generic<T>(non_clone_type: &PlainType<T>) { non_clone_type.clone(); + //~^ WARNING call to `.clone()` on a reference in this situation does nothing } fn non_generic(non_clone_type: &PlainType<u32>) { diff --git a/src/test/ui/lint/noop-method-call.stderr b/src/test/ui/lint/noop-method-call.stderr index 7f6f96bf1..6a904d01a 100644 --- a/src/test/ui/lint/noop-method-call.stderr +++ b/src/test/ui/lint/noop-method-call.stderr @@ -4,12 +4,12 @@ warning: call to `.clone()` on a reference in this situation does nothing LL | let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref.clone(); | ^^^^^^^^ unnecessary method call | + = note: the type `&PlainType<u32>` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed note: the lint level is defined here --> $DIR/noop-method-call.rs:4:9 | LL | #![warn(noop_method_call)] | ^^^^^^^^^^^^^^^^ - = note: the type `&PlainType<u32>` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed warning: call to `.deref()` on a reference in this situation does nothing --> $DIR/noop-method-call.rs:28:63 @@ -28,12 +28,20 @@ LL | let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type.borrow(); = note: the type `&PlainType<u32>` which `borrow` is being called on is the same as the type returned from `borrow`, so the method call does not do anything and can be removed warning: call to `.clone()` on a reference in this situation does nothing - --> $DIR/noop-method-call.rs:52:19 + --> $DIR/noop-method-call.rs:48:19 + | +LL | non_clone_type.clone(); + | ^^^^^^^^ unnecessary method call + | + = note: the type `&PlainType<T>` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed + +warning: call to `.clone()` on a reference in this situation does nothing + --> $DIR/noop-method-call.rs:53:19 | LL | non_clone_type.clone(); | ^^^^^^^^ unnecessary method call | = note: the type `&PlainType<u32>` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed -warning: 4 warnings emitted +warning: 5 warnings emitted diff --git a/src/test/ui/lint/opaque-ty-ffi-unsafe.stderr b/src/test/ui/lint/opaque-ty-ffi-unsafe.stderr index 62d00fd68..33aa95854 100644 --- a/src/test/ui/lint/opaque-ty-ffi-unsafe.stderr +++ b/src/test/ui/lint/opaque-ty-ffi-unsafe.stderr @@ -4,12 +4,12 @@ error: `extern` block uses type `A`, which is not FFI-safe LL | pub fn a(_: A); | ^ not FFI-safe | + = note: opaque types have no C equivalent note: the lint level is defined here --> $DIR/opaque-ty-ffi-unsafe.rs:2:9 | LL | #![deny(improper_ctypes)] | ^^^^^^^^^^^^^^^ - = note: opaque types have no C equivalent error: aborting due to previous error diff --git a/src/test/ui/lint/outer-forbid.stderr b/src/test/ui/lint/outer-forbid.stderr index 781457321..a47877980 100644 --- a/src/test/ui/lint/outer-forbid.stderr +++ b/src/test/ui/lint/outer-forbid.stderr @@ -7,13 +7,13 @@ LL | #![forbid(unused, non_snake_case)] LL | #[allow(unused_variables)] | ^^^^^^^^^^^^^^^^ 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> note: the lint level is defined here --> $DIR/outer-forbid.rs:18:11 | LL | #![forbid(forbidden_lint_groups)] | ^^^^^^^^^^^^^^^^^^^^^ - = 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(unused) incompatible with previous forbid --> $DIR/outer-forbid.rs:25:9 diff --git a/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr b/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr index bc0c53303..e31d14c55 100644 --- a/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr +++ b/src/test/ui/lint/redundant-semicolon/redundant-semi-proc-macro.stderr @@ -1,4 +1,4 @@ -TokenStream [Ident { ident: "fn", span: #0 bytes(198..200) }, Ident { ident: "span_preservation", span: #0 bytes(201..218) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(218..220) }, Group { delimiter: Brace, stream: TokenStream [Ident { ident: "let", span: #0 bytes(228..231) }, Ident { ident: "tst", span: #0 bytes(232..235) }, Punct { ch: '=', spacing: Alone, span: #0 bytes(236..237) }, Literal { kind: Integer, symbol: "123", suffix: None, span: #0 bytes(238..241) }, Punct { ch: ';', spacing: Joint, span: #0 bytes(241..242) }, Punct { ch: ';', spacing: Alone, span: #0 bytes(242..243) }, Ident { ident: "match", span: #0 bytes(289..294) }, Ident { ident: "tst", span: #0 bytes(295..298) }, Group { delimiter: Brace, stream: TokenStream [Literal { kind: Integer, symbol: "123", suffix: None, span: #0 bytes(483..486) }, Punct { ch: '=', spacing: Joint, span: #0 bytes(487..489) }, Punct { ch: '>', spacing: Alone, span: #0 bytes(487..489) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(490..492) }, Punct { ch: ',', spacing: Alone, span: #0 bytes(492..493) }, Ident { ident: "_", span: #0 bytes(502..503) }, Punct { ch: '=', spacing: Joint, span: #0 bytes(504..506) }, Punct { ch: '>', spacing: Alone, span: #0 bytes(504..506) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(507..509) }], span: #0 bytes(299..515) }, Punct { ch: ';', spacing: Joint, span: #0 bytes(515..516) }, Punct { ch: ';', spacing: Joint, span: #0 bytes(516..517) }, Punct { ch: ';', spacing: Alone, span: #0 bytes(517..518) }], span: #0 bytes(222..562) }] +TokenStream [Ident { ident: "fn", span: #0 bytes(198..200) }, Ident { ident: "span_preservation", span: #0 bytes(201..218) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(218..220) }, Group { delimiter: Brace, stream: TokenStream [Ident { ident: "let", span: #0 bytes(228..231) }, Ident { ident: "tst", span: #0 bytes(232..235) }, Punct { ch: '=', spacing: Alone, span: #0 bytes(236..237) }, Literal { kind: Integer, symbol: "123", suffix: None, span: #0 bytes(238..241) }, Punct { ch: ';', spacing: Joint, span: #0 bytes(241..242) }, Punct { ch: ';', spacing: Alone, span: #0 bytes(242..243) }, Ident { ident: "match", span: #0 bytes(289..294) }, Ident { ident: "tst", span: #0 bytes(295..298) }, Group { delimiter: Brace, stream: TokenStream [Literal { kind: Integer, symbol: "123", suffix: None, span: #0 bytes(483..486) }, Punct { ch: '=', spacing: Joint, span: #0 bytes(487..488) }, Punct { ch: '>', spacing: Alone, span: #0 bytes(488..489) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(490..492) }, Punct { ch: ',', spacing: Alone, span: #0 bytes(492..493) }, Ident { ident: "_", span: #0 bytes(502..503) }, Punct { ch: '=', spacing: Joint, span: #0 bytes(504..505) }, Punct { ch: '>', spacing: Alone, span: #0 bytes(505..506) }, Group { delimiter: Parenthesis, stream: TokenStream [], span: #0 bytes(507..509) }], span: #0 bytes(299..515) }, Punct { ch: ';', spacing: Joint, span: #0 bytes(515..516) }, Punct { ch: ';', spacing: Joint, span: #0 bytes(516..517) }, Punct { ch: ';', spacing: Alone, span: #0 bytes(517..518) }], span: #0 bytes(222..562) }] error: unnecessary trailing semicolon --> $DIR/redundant-semi-proc-macro.rs:9:19 | diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr b/src/test/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr index 370e51bf7..2c35647b8 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr @@ -31,8 +31,8 @@ warning: this lint expectation is unfulfilled LL | unused_mut, | ^^^^^^^^^^ | - = note: `#[warn(unfulfilled_lint_expectations)]` on by default = note: this `expect` is overridden by a `allow` attribute before the `unused_mut` lint is triggered + = note: `#[warn(unfulfilled_lint_expectations)]` on by default warning: this lint expectation is unfulfilled --> $DIR/expect_nested_lint_levels.rs:24:5 diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_unfulfilled_expectation.stderr b/src/test/ui/lint/rfc-2383-lint-reason/expect_unfulfilled_expectation.stderr index 9bfee79b0..9a1c3e442 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_unfulfilled_expectation.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_unfulfilled_expectation.stderr @@ -4,9 +4,9 @@ warning: this lint expectation is unfulfilled LL | #![expect(unfulfilled_lint_expectations, reason = "idk why you would expect this")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(unfulfilled_lint_expectations)]` on by default = note: idk why you would expect this = note: the `unfulfilled_lint_expectations` lint can't be expected and will always produce this message + = note: `#[warn(unfulfilled_lint_expectations)]` on by default warning: this lint expectation is unfulfilled --> $DIR/expect_unfulfilled_expectation.rs:13:10 diff --git a/src/test/ui/lint/rfc-2383-lint-reason/expect_with_reason.stderr b/src/test/ui/lint/rfc-2383-lint-reason/expect_with_reason.stderr index 82c1a4c08..e349e4081 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/expect_with_reason.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/expect_with_reason.stderr @@ -4,8 +4,8 @@ warning: this lint expectation is unfulfilled LL | #![expect(unused_variables, reason = "<This should fail and display this reason>")] | ^^^^^^^^^^^^^^^^ | - = note: `#[warn(unfulfilled_lint_expectations)]` on by default = note: <This should fail and display this reason> + = note: `#[warn(unfulfilled_lint_expectations)]` on by default warning: 1 warning emitted diff --git a/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr b/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr index 06befcbb5..5942fa8ae 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr @@ -1,11 +1,3 @@ -warning: denote infinite loops with `loop { ... }` - --> $DIR/force_warn_expected_lints_fulfilled.rs:10:5 - | -LL | while true { - | ^^^^^^^^^^ help: use `loop` - | - = note: requested on the command line with `--force-warn while-true` - warning: unused variable: `x` --> $DIR/force_warn_expected_lints_fulfilled.rs:20:9 | @@ -36,5 +28,13 @@ LL | let mut what_does_the_fox_say = "*ding* *deng* *dung*"; | = note: requested on the command line with `--force-warn unused-mut` +warning: denote infinite loops with `loop { ... }` + --> $DIR/force_warn_expected_lints_fulfilled.rs:10:5 + | +LL | while true { + | ^^^^^^^^^^ help: use `loop` + | + = note: requested on the command line with `--force-warn while-true` + warning: 5 warnings emitted diff --git a/src/test/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.stderr b/src/test/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.stderr index 3bf8137dc..3e9d70821 100644 --- a/src/test/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.stderr +++ b/src/test/ui/lint/rfc-2383-lint-reason/lint-attribute-only-with-reason.stderr @@ -4,12 +4,12 @@ error: unused attribute LL | #[allow(reason = "I want to allow something")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | + = note: attribute `allow` without any lints has no effect note: the lint level is defined here --> $DIR/lint-attribute-only-with-reason.rs:3:9 | LL | #![deny(unused_attributes)] | ^^^^^^^^^^^^^^^^^ - = note: attribute `allow` without any lints has no effect error: unused attribute --> $DIR/lint-attribute-only-with-reason.rs:6:1 diff --git a/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-mixed-script-confusables.stderr b/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-mixed-script-confusables.stderr index 9ca034b71..884a4a453 100644 --- a/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-mixed-script-confusables.stderr +++ b/src/test/ui/lint/rfc-2457-non-ascii-idents/lint-mixed-script-confusables.stderr @@ -4,13 +4,13 @@ error: the usage of Script Group `Greek` in this crate consists solely of mixed LL | struct ΑctuallyNotLatin; | ^^^^^^^^^^^^^^^^ | + = note: the usage includes 'Α' (U+0391) + = note: please recheck to make sure their usages are indeed what you want note: the lint level is defined here --> $DIR/lint-mixed-script-confusables.rs:1:9 | LL | #![deny(mixed_script_confusables)] | ^^^^^^^^^^^^^^^^^^^^^^^^ - = note: the usage includes 'Α' (U+0391) - = note: please recheck to make sure their usages are indeed what you want error: the usage of Script Group `Cyrillic` in this crate consists solely of mixed script confusables --> $DIR/lint-mixed-script-confusables.rs:10:5 diff --git a/src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr b/src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr index 84ad32bdd..49608c205 100644 --- a/src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr +++ b/src/test/ui/lint/semicolon-in-expressions-from-macros/semicolon-in-expressions-from-macros.stderr @@ -7,15 +7,15 @@ LL | true; LL | foo!(warn_in_block) | ------------------- in this macro invocation | + = 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 #79813 <https://github.com/rust-lang/rust/issues/79813> + = note: macro invocations at the end of a block are treated as expressions + = note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo` note: the lint level is defined here --> $DIR/semicolon-in-expressions-from-macros.rs:4:9 | LL | #![warn(semicolon_in_expressions_from_macros)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = 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 #79813 <https://github.com/rust-lang/rust/issues/79813> - = note: macro invocations at the end of a block are treated as expressions - = note: to ignore the value produced by the macro, add a semicolon after the invocation of `foo` = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) warning: trailing semicolon in macro used in expression position diff --git a/src/test/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.stderr b/src/test/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.stderr index d770a8c8f..16c152eb2 100644 --- a/src/test/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.stderr +++ b/src/test/ui/lint/semicolon-in-expressions-from-macros/warn-semicolon-in-expressions-from-macros.stderr @@ -7,9 +7,9 @@ LL | true; LL | _ => foo!() | ------ in this macro invocation | - = note: `#[warn(semicolon_in_expressions_from_macros)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #79813 <https://github.com/rust-lang/rust/issues/79813> + = note: `#[warn(semicolon_in_expressions_from_macros)]` on by default = note: this warning originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info) warning: 1 warning emitted diff --git a/src/test/ui/lint/trivial-cast-ice.rs b/src/test/ui/lint/trivial-cast-ice.rs new file mode 100644 index 000000000..f781fab22 --- /dev/null +++ b/src/test/ui/lint/trivial-cast-ice.rs @@ -0,0 +1,12 @@ +// aux-build:trivial-cast-ice.rs +// check-pass + +// Demonstrates the ICE in #102561 + +#![deny(trivial_casts)] + +extern crate trivial_cast_ice; + +fn main() { + trivial_cast_ice::foo!(); +} diff --git a/src/test/ui/lint/trivial-casts-featuring-type-ascription.stderr b/src/test/ui/lint/trivial-casts-featuring-type-ascription.stderr index f7c42acb3..5087807b6 100644 --- a/src/test/ui/lint/trivial-casts-featuring-type-ascription.stderr +++ b/src/test/ui/lint/trivial-casts-featuring-type-ascription.stderr @@ -4,12 +4,12 @@ error: trivial numeric cast: `i32` as `i32` LL | let lugubrious = 12i32 as i32; | ^^^^^^^^^^^^ | + = help: cast can be replaced by coercion; this might require type ascription or a temporary variable note: the lint level is defined here --> $DIR/trivial-casts-featuring-type-ascription.rs:1:24 | LL | #![deny(trivial_casts, trivial_numeric_casts)] | ^^^^^^^^^^^^^^^^^^^^^ - = help: cast can be replaced by coercion; this might require type ascription or a temporary variable error: trivial cast: `&u32` as `*const u32` --> $DIR/trivial-casts-featuring-type-ascription.rs:8:13 @@ -17,12 +17,12 @@ error: trivial cast: `&u32` as `*const u32` LL | let _ = haunted as *const u32; | ^^^^^^^^^^^^^^^^^^^^^ | + = help: cast can be replaced by coercion; this might require type ascription or a temporary variable note: the lint level is defined here --> $DIR/trivial-casts-featuring-type-ascription.rs:1:9 | LL | #![deny(trivial_casts, trivial_numeric_casts)] | ^^^^^^^^^^^^^ - = help: cast can be replaced by coercion; this might require type ascription or a temporary variable error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/trivial-casts.stderr b/src/test/ui/lint/trivial-casts.stderr index 1544f553c..7ace353de 100644 --- a/src/test/ui/lint/trivial-casts.stderr +++ b/src/test/ui/lint/trivial-casts.stderr @@ -4,12 +4,12 @@ error: trivial numeric cast: `i32` as `i32` LL | let lugubrious = 12i32 as i32; | ^^^^^^^^^^^^ | + = help: cast can be replaced by coercion; this might require a temporary variable note: the lint level is defined here --> $DIR/trivial-casts.rs:1:24 | LL | #![deny(trivial_casts, trivial_numeric_casts)] | ^^^^^^^^^^^^^^^^^^^^^ - = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&u32` as `*const u32` --> $DIR/trivial-casts.rs:7:13 @@ -17,12 +17,12 @@ error: trivial cast: `&u32` as `*const u32` LL | let _ = haunted as *const u32; | ^^^^^^^^^^^^^^^^^^^^^ | + = help: cast can be replaced by coercion; this might require a temporary variable note: the lint level is defined here --> $DIR/trivial-casts.rs:1:9 | LL | #![deny(trivial_casts, trivial_numeric_casts)] | ^^^^^^^^^^^^^ - = help: cast can be replaced by coercion; this might require a temporary variable error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/trivial_casts.stderr b/src/test/ui/lint/trivial_casts.stderr index 8a216360f..74f962835 100644 --- a/src/test/ui/lint/trivial_casts.stderr +++ b/src/test/ui/lint/trivial_casts.stderr @@ -4,12 +4,12 @@ error: trivial numeric cast: `i32` as `i32` LL | let _ = 42_i32 as i32; | ^^^^^^^^^^^^^ | + = help: cast can be replaced by coercion; this might require a temporary variable note: the lint level is defined here --> $DIR/trivial_casts.rs:4:24 | LL | #![deny(trivial_casts, trivial_numeric_casts)] | ^^^^^^^^^^^^^^^^^^^^^ - = help: cast can be replaced by coercion; this might require a temporary variable error: trivial numeric cast: `u8` as `u8` --> $DIR/trivial_casts.rs:19:13 @@ -25,12 +25,12 @@ error: trivial cast: `&u32` as `*const u32` LL | let _ = x as *const u32; | ^^^^^^^^^^^^^^^ | + = help: cast can be replaced by coercion; this might require a temporary variable note: the lint level is defined here --> $DIR/trivial_casts.rs:4:9 | LL | #![deny(trivial_casts, trivial_numeric_casts)] | ^^^^^^^^^^^^^ - = help: cast can be replaced by coercion; this might require a temporary variable error: trivial cast: `&mut u32` as `*mut u32` --> $DIR/trivial_casts.rs:28:13 diff --git a/src/test/ui/lint/type-overflow.stderr b/src/test/ui/lint/type-overflow.stderr index 8a31fd447..62cb1f7f4 100644 --- a/src/test/ui/lint/type-overflow.stderr +++ b/src/test/ui/lint/type-overflow.stderr @@ -4,13 +4,13 @@ warning: literal out of range for `i8` LL | let error = 255i8; | ^^^^^ | + = note: the literal `255i8` does not fit into the type `i8` whose range is `-128..=127` + = help: consider using the type `u8` instead note: the lint level is defined here --> $DIR/type-overflow.rs:2:9 | LL | #![warn(overflowing_literals)] | ^^^^^^^^^^^^^^^^^^^^ - = note: the literal `255i8` does not fit into the type `i8` whose range is `-128..=127` - = help: consider using the type `u8` instead warning: literal out of range for `i8` --> $DIR/type-overflow.rs:10:16 diff --git a/src/test/ui/lint/unaligned_references.stderr b/src/test/ui/lint/unaligned_references.stderr index 97dbec286..346f49b92 100644 --- a/src/test/ui/lint/unaligned_references.stderr +++ b/src/test/ui/lint/unaligned_references.stderr @@ -4,15 +4,15 @@ error: reference to packed field is unaligned LL | let _ = &good.ptr; | ^^^^^^^^^ | + = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) note: the lint level is defined here --> $DIR/unaligned_references.rs:1:9 | LL | #![deny(unaligned_references)] | ^^^^^^^^^^^^^^^^^^^^ - = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error: reference to packed field is unaligned --> $DIR/unaligned_references.rs:24:17 @@ -111,15 +111,15 @@ error: reference to packed field is unaligned LL | let _ = &good.ptr; | ^^^^^^^^^ | + = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) note: the lint level is defined here --> $DIR/unaligned_references.rs:1:9 | LL | #![deny(unaligned_references)] | ^^^^^^^^^^^^^^^^^^^^ - = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) Future breakage diagnostic: error: reference to packed field is unaligned @@ -128,15 +128,15 @@ error: reference to packed field is unaligned LL | let _ = &good.data; | ^^^^^^^^^^ | + = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) note: the lint level is defined here --> $DIR/unaligned_references.rs:1:9 | LL | #![deny(unaligned_references)] | ^^^^^^^^^^^^^^^^^^^^ - = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) Future breakage diagnostic: error: reference to packed field is unaligned @@ -145,15 +145,15 @@ error: reference to packed field is unaligned LL | let _ = &good.data as *const _; | ^^^^^^^^^^ | + = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) note: the lint level is defined here --> $DIR/unaligned_references.rs:1:9 | LL | #![deny(unaligned_references)] | ^^^^^^^^^^^^^^^^^^^^ - = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) Future breakage diagnostic: error: reference to packed field is unaligned @@ -162,15 +162,15 @@ error: reference to packed field is unaligned LL | let _: *const _ = &good.data; | ^^^^^^^^^^ | + = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) note: the lint level is defined here --> $DIR/unaligned_references.rs:1:9 | LL | #![deny(unaligned_references)] | ^^^^^^^^^^^^^^^^^^^^ - = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) Future breakage diagnostic: error: reference to packed field is unaligned @@ -179,15 +179,15 @@ error: reference to packed field is unaligned LL | let _ = good.data.clone(); | ^^^^^^^^^^^^^^^^^ | + = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) note: the lint level is defined here --> $DIR/unaligned_references.rs:1:9 | LL | #![deny(unaligned_references)] | ^^^^^^^^^^^^^^^^^^^^ - = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) Future breakage diagnostic: error: reference to packed field is unaligned @@ -196,15 +196,15 @@ error: reference to packed field is unaligned LL | let _ = &good.data2[0]; | ^^^^^^^^^^^^^^ | + = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) note: the lint level is defined here --> $DIR/unaligned_references.rs:1:9 | LL | #![deny(unaligned_references)] | ^^^^^^^^^^^^^^^^^^^^ - = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) Future breakage diagnostic: error: reference to packed field is unaligned @@ -213,15 +213,15 @@ error: reference to packed field is unaligned LL | let _ = &packed2.x; | ^^^^^^^^^^ | + = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) note: the lint level is defined here --> $DIR/unaligned_references.rs:1:9 | LL | #![deny(unaligned_references)] | ^^^^^^^^^^^^^^^^^^^^ - = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) Future breakage diagnostic: error: reference to packed field is unaligned @@ -230,15 +230,15 @@ error: reference to packed field is unaligned LL | let _ref = &m1.1.a; | ^^^^^^^ | + = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) note: the lint level is defined here --> $DIR/unaligned_references.rs:1:9 | LL | #![deny(unaligned_references)] | ^^^^^^^^^^^^^^^^^^^^ - = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) Future breakage diagnostic: error: reference to packed field is unaligned @@ -247,13 +247,13 @@ error: reference to packed field is unaligned LL | let _ref = &m2.1.a; | ^^^^^^^ | + = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) note: the lint level is defined here --> $DIR/unaligned_references.rs:1:9 | LL | #![deny(unaligned_references)] | ^^^^^^^^^^^^^^^^^^^^ - = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) diff --git a/src/test/ui/lint/unaligned_references_external_macro.stderr b/src/test/ui/lint/unaligned_references_external_macro.stderr index 1262c21ee..c46ca6742 100644 --- a/src/test/ui/lint/unaligned_references_external_macro.stderr +++ b/src/test/ui/lint/unaligned_references_external_macro.stderr @@ -10,6 +10,10 @@ LL | | } LL | | } | |_^ | + = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) note: the lint level is defined here --> $DIR/unaligned_references_external_macro.rs:5:1 | @@ -21,10 +25,6 @@ LL | | pub field: u16 LL | | } LL | | } | |_^ - = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) = note: this error originates in the macro `unaligned_references_external_crate::mac` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error @@ -42,6 +42,10 @@ LL | | } LL | | } | |_^ | + = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> + = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) note: the lint level is defined here --> $DIR/unaligned_references_external_macro.rs:5:1 | @@ -53,9 +57,5 @@ LL | | pub field: u16 LL | | } LL | | } | |_^ - = 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 #82523 <https://github.com/rust-lang/rust/issues/82523> - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) - = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) = note: this error originates in the macro `unaligned_references_external_crate::mac` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/lint/unreachable_pub.stderr b/src/test/ui/lint/unreachable_pub.stderr index e021f500c..762834b97 100644 --- a/src/test/ui/lint/unreachable_pub.stderr +++ b/src/test/ui/lint/unreachable_pub.stderr @@ -6,12 +6,12 @@ LL | pub use std::fmt; | | | help: consider restricting its visibility: `pub(crate)` | + = help: or consider exporting it for use by other crates note: the lint level is defined here --> $DIR/unreachable_pub.rs:4:9 | LL | #![warn(unreachable_pub)] | ^^^^^^^^^^^^^^^ - = help: or consider exporting it for use by other crates warning: unreachable `pub` item --> $DIR/unreachable_pub.rs:9:24 diff --git a/src/test/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.stderr b/src/test/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.stderr index 26fa6eb9b..fe2e3afc8 100644 --- a/src/test/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.stderr +++ b/src/test/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.stderr @@ -49,8 +49,8 @@ warning: value assigned to `hours_are_suns` is never read LL | hours_are_suns = false; | ^^^^^^^^^^^^^^ | - = note: `#[warn(unused_assignments)]` implied by `#[warn(unused)]` = help: maybe it is overwritten before being read? + = note: `#[warn(unused_assignments)]` implied by `#[warn(unused)]` warning: unused variable: `fire` --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:52:32 diff --git a/src/test/ui/lint/unused/must-use-box-from-raw.stderr b/src/test/ui/lint/unused/must-use-box-from-raw.stderr index 7769f09aa..011acc3bf 100644 --- a/src/test/ui/lint/unused/must-use-box-from-raw.stderr +++ b/src/test/ui/lint/unused/must-use-box-from-raw.stderr @@ -4,12 +4,12 @@ warning: unused return value of `Box::<T>::from_raw` that must be used LL | Box::from_raw(ptr); | ^^^^^^^^^^^^^^^^^^^ | + = note: call `drop(from_raw(ptr))` if you intend to drop the `Box` note: the lint level is defined here --> $DIR/must-use-box-from-raw.rs:5:9 | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ - = note: call `drop(from_raw(ptr))` if you intend to drop the `Box` warning: 1 warning emitted diff --git a/src/test/ui/lint/unused/must_use-in-stdlib-traits.stderr b/src/test/ui/lint/unused/must_use-in-stdlib-traits.stderr index 76978d29d..f5199f43c 100644 --- a/src/test/ui/lint/unused/must_use-in-stdlib-traits.stderr +++ b/src/test/ui/lint/unused/must_use-in-stdlib-traits.stderr @@ -4,12 +4,12 @@ error: unused implementer of `Iterator` that must be used LL | iterator(); | ^^^^^^^^^^^ | + = note: iterators are lazy and do nothing unless consumed note: the lint level is defined here --> $DIR/must_use-in-stdlib-traits.rs:1:9 | LL | #![deny(unused_must_use)] | ^^^^^^^^^^^^^^^ - = note: iterators are lazy and do nothing unless consumed error: unused implementer of `Future` that must be used --> $DIR/must_use-in-stdlib-traits.rs:43:4 diff --git a/src/test/ui/lint/unused/must_use-tuple.stderr b/src/test/ui/lint/unused/must_use-tuple.stderr index e5709a5f0..63e0318fb 100644 --- a/src/test/ui/lint/unused/must_use-tuple.stderr +++ b/src/test/ui/lint/unused/must_use-tuple.stderr @@ -4,12 +4,12 @@ error: unused `Result` in tuple element 0 that must be used LL | (Ok::<(), ()>(()),); | ^^^^^^^^^^^^^^^^ | + = note: this `Result` may be an `Err` variant, which should be handled note: the lint level is defined here --> $DIR/must_use-tuple.rs:1:9 | LL | #![deny(unused_must_use)] | ^^^^^^^^^^^^^^^ - = note: this `Result` may be an `Err` variant, which should be handled error: unused `Result` in tuple element 0 that must be used --> $DIR/must_use-tuple.rs:10:6 diff --git a/src/test/ui/lint/unused/unused-attr-duplicate.stderr b/src/test/ui/lint/unused/unused-attr-duplicate.stderr index f592323b5..769b17487 100644 --- a/src/test/ui/lint/unused/unused-attr-duplicate.stderr +++ b/src/test/ui/lint/unused/unused-attr-duplicate.stderr @@ -4,16 +4,16 @@ error: unused attribute LL | #[no_link] | ^^^^^^^^^^ help: remove this attribute | -note: the lint level is defined here - --> $DIR/unused-attr-duplicate.rs:12:9 - | -LL | #![deny(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ note: attribute also specified here --> $DIR/unused-attr-duplicate.rs:32:1 | LL | #[no_link] | ^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/unused-attr-duplicate.rs:12:9 + | +LL | #![deny(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ error: unused attribute --> $DIR/unused-attr-duplicate.rs:37:1 diff --git a/src/test/ui/lint/unused/unused-closure.stderr b/src/test/ui/lint/unused/unused-closure.stderr index 265d3e8e0..4362abd20 100644 --- a/src/test/ui/lint/unused/unused-closure.stderr +++ b/src/test/ui/lint/unused/unused-closure.stderr @@ -6,12 +6,12 @@ LL | | println!("Hello!"); LL | | }; | |______^ | + = note: closures are lazy and do nothing unless called note: the lint level is defined here --> $DIR/unused-closure.rs:6:9 | LL | #![deny(unused_must_use)] | ^^^^^^^^^^^^^^^ - = note: closures are lazy and do nothing unless called error: unused implementer of `Future` that must be used --> $DIR/unused-closure.rs:13:5 diff --git a/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr b/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr index 1a022c309..078b780d8 100644 --- a/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr +++ b/src/test/ui/lint/unused/unused-doc-comments-edge-cases.stderr @@ -23,12 +23,12 @@ LL | LL | _ => false, | ---------- rustdoc does not generate documentation for match arms | + = help: use `//` for a plain comment note: the lint level is defined here --> $DIR/unused-doc-comments-edge-cases.rs:1:9 | LL | #![deny(unused_doc_comments)] | ^^^^^^^^^^^^^^^^^^^ - = help: use `//` for a plain comment error: unused doc comment --> $DIR/unused-doc-comments-edge-cases.rs:23:5 diff --git a/src/test/ui/lint/unused/unused-doc-comments-for-macros.stderr b/src/test/ui/lint/unused/unused-doc-comments-for-macros.stderr index f4f5bb71e..26b1c2b05 100644 --- a/src/test/ui/lint/unused/unused-doc-comments-for-macros.stderr +++ b/src/test/ui/lint/unused/unused-doc-comments-for-macros.stderr @@ -8,12 +8,12 @@ LL | | /// line3 | | | rustdoc does not generate documentation for macro invocations | + = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion note: the lint level is defined here --> $DIR/unused-doc-comments-for-macros.rs:1:9 | LL | #![deny(unused_doc_comments)] | ^^^^^^^^^^^^^^^^^^^ - = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion error: unused doc comment --> $DIR/unused-doc-comments-for-macros.rs:13:5 diff --git a/src/test/ui/lint/unused/unused-supertrait.rs b/src/test/ui/lint/unused/unused-supertrait.rs new file mode 100644 index 000000000..64a8e5204 --- /dev/null +++ b/src/test/ui/lint/unused/unused-supertrait.rs @@ -0,0 +1,11 @@ +#![deny(unused_must_use)] + +fn it() -> impl ExactSizeIterator<Item = ()> { + let x: Box<dyn ExactSizeIterator<Item = ()>> = todo!(); + x +} + +fn main() { + it(); + //~^ ERROR unused implementer of `Iterator` that must be used +} diff --git a/src/test/ui/lint/unused/unused-supertrait.stderr b/src/test/ui/lint/unused/unused-supertrait.stderr new file mode 100644 index 000000000..d2f8c0078 --- /dev/null +++ b/src/test/ui/lint/unused/unused-supertrait.stderr @@ -0,0 +1,15 @@ +error: unused implementer of `Iterator` that must be used + --> $DIR/unused-supertrait.rs:9:5 + | +LL | it(); + | ^^^^^ + | + = note: iterators are lazy and do nothing unless consumed +note: the lint level is defined here + --> $DIR/unused-supertrait.rs:1:9 + | +LL | #![deny(unused_must_use)] + | ^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/lint/unused/unused_attributes-must_use.stderr b/src/test/ui/lint/unused/unused_attributes-must_use.stderr index dd112c23e..ce959ddbc 100644 --- a/src/test/ui/lint/unused/unused_attributes-must_use.stderr +++ b/src/test/ui/lint/unused/unused_attributes-must_use.stderr @@ -4,16 +4,16 @@ error: unused attribute `must_use` LL | #[must_use] | ^^^^^^^^^^^ | -note: the lint level is defined here - --> $DIR/unused_attributes-must_use.rs:2:9 - | -LL | #![deny(unused_attributes, unused_must_use)] - | ^^^^^^^^^^^^^^^^^ note: the built-in attribute `must_use` will be ignored, since it's applied to the macro invocation `global_asm` --> $DIR/unused_attributes-must_use.rs:59:1 | LL | global_asm!(""); | ^^^^^^^^^^ +note: the lint level is defined here + --> $DIR/unused_attributes-must_use.rs:2:9 + | +LL | #![deny(unused_attributes, unused_must_use)] + | ^^^^^^^^^^^^^^^^^ error: `#[must_use]` has no effect when applied to an extern crate --> $DIR/unused_attributes-must_use.rs:5:1 diff --git a/src/test/ui/lint/unused/useless-comment.stderr b/src/test/ui/lint/unused/useless-comment.stderr index 0054426fb..8bb5bdaeb 100644 --- a/src/test/ui/lint/unused/useless-comment.stderr +++ b/src/test/ui/lint/unused/useless-comment.stderr @@ -4,12 +4,12 @@ error: unused doc comment LL | /// foo | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rustdoc does not generate documentation for macro invocations | + = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion note: the lint level is defined here --> $DIR/useless-comment.rs:3:9 | LL | #![deny(unused_doc_comments)] | ^^^^^^^^^^^^^^^^^^^ - = help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion error: unused doc comment --> $DIR/useless-comment.rs:32:5 |