From a710e1fb28d1a75eb7cb2261321c51cccf1c0bc8 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 20 Jan 2025 16:59:22 +0100 Subject: [PATCH 01/12] account for `c_enum_min_bits` in `multiple-reprs` UI test fixes #135777 --- tests/ui/structs-enums/multiple-reprs.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/ui/structs-enums/multiple-reprs.rs b/tests/ui/structs-enums/multiple-reprs.rs index 1528db126ae51..ce50b62ce47f7 100644 --- a/tests/ui/structs-enums/multiple-reprs.rs +++ b/tests/ui/structs-enums/multiple-reprs.rs @@ -69,7 +69,7 @@ pub fn main() { assert_eq!(size_of::(), 8); assert_eq!(size_of::(), align_size(10, align_of::())); assert_eq!(size_of::(), align_size(14, align_of::())); - assert_eq!(size_of::(), align_size(6 + size_of::(), align_of::())); + assert_eq!(size_of::(), align_size(6 + c_enum_min_size(), align_of::())); assert_eq!(size_of::(), 21); } @@ -80,3 +80,13 @@ fn align_size(size: usize, align: usize) -> usize { size } } + +// this is `TargetOptions.c_enum_min_bits` which is not available as a `cfg` value so we retrieve +// the value at runtime. On most targets this is `sizeof(c_int)` but on `thumb*-none` is 1 byte +fn c_enum_min_size() -> usize { + #[repr(C)] + enum E { + A, + } + size_of::() +} From b691e9f2e0f72a77b7fafc533abbdbc39b8dc438 Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Sat, 25 Jan 2025 20:09:36 +0800 Subject: [PATCH 02/12] Correct comment for FreeBSD and DragonFly BSD in unix/thread Signed-off-by: Huang Qi --- library/std/src/sys/pal/unix/thread.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs index 356669980c7d9..42624324c36e5 100644 --- a/library/std/src/sys/pal/unix/thread.rs +++ b/library/std/src/sys/pal/unix/thread.rs @@ -144,7 +144,7 @@ impl Thread { const TASK_COMM_LEN: usize = 16; let name = truncate_cstr::<{ TASK_COMM_LEN }>(name); } else { - // FreeBSD, DragonFly, FreeBSD and NuttX do not enforce length limits. + // FreeBSD, DragonFly BSD and NuttX do not enforce length limits. } }; // Available since glibc 2.12, musl 1.1.16, and uClibc 1.0.20 for Linux, From 8c24c0a023456c3d9e58f06a3abf0a83d335c6f6 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 11 Feb 2025 12:03:22 -0800 Subject: [PATCH 03/12] Remove the common prelude module This fixes the issues described in https://github.com/rust-lang/rust/issues/136102. Primarily, this resolves some issues with how the documentation for the prelude is generated: - It avoids showing "unstable" for macros in the prelude that are actually stable. - Avoids duplication of some pages due to the previous lack of `doc(no_inline)`. - Makes the different edition preludes consistent, and sets a pattern that can be used by future editions. We may need to rearrange these modules in the future if we decide to remove anything from the prelude again. If we do, I think we should look into a different solution that avoids the documentation problems. --- library/core/src/prelude/mod.rs | 14 +++----------- library/core/src/prelude/{common.rs => v1.rs} | 4 +++- library/std/src/prelude/mod.rs | 14 +++----------- library/std/src/prelude/{common.rs => v1.rs} | 4 +++- tests/rustdoc-js-std/vec-new.js | 2 +- 5 files changed, 13 insertions(+), 25 deletions(-) rename library/core/src/prelude/{common.rs => v1.rs} (97%) rename library/std/src/prelude/{common.rs => v1.rs} (97%) diff --git a/library/core/src/prelude/mod.rs b/library/core/src/prelude/mod.rs index 0ab97f5bbd50e..590ffd64b5bff 100644 --- a/library/core/src/prelude/mod.rs +++ b/library/core/src/prelude/mod.rs @@ -9,16 +9,7 @@ #![stable(feature = "core_prelude", since = "1.4.0")] -mod common; - -/// The first version of the prelude of The Rust Standard Library. -/// -/// See the [module-level documentation](self) for more. -#[stable(feature = "rust1", since = "1.0.0")] -pub mod v1 { - #[stable(feature = "rust1", since = "1.0.0")] - pub use super::common::*; -} +pub mod v1; /// The 2015 version of the core prelude. /// @@ -64,7 +55,8 @@ pub mod rust_2021 { #[stable(feature = "prelude_2024", since = "1.85.0")] pub mod rust_2024 { #[stable(feature = "rust1", since = "1.0.0")] - pub use super::common::*; + #[doc(no_inline)] + pub use super::v1::*; #[stable(feature = "prelude_2021", since = "1.55.0")] #[doc(no_inline)] diff --git a/library/core/src/prelude/common.rs b/library/core/src/prelude/v1.rs similarity index 97% rename from library/core/src/prelude/common.rs rename to library/core/src/prelude/v1.rs index 8b116cecb5295..50fd67e839557 100644 --- a/library/core/src/prelude/common.rs +++ b/library/core/src/prelude/v1.rs @@ -1,7 +1,9 @@ -//! Items common to the prelude of all editions. +//! The first version of the core prelude. //! //! See the [module-level documentation](super) for more. +#![stable(feature = "core_prelude", since = "1.4.0")] + // No formatting: this file is nothing but re-exports, and their order is worth preserving. #![cfg_attr(rustfmt, rustfmt::skip)] diff --git a/library/std/src/prelude/mod.rs b/library/std/src/prelude/mod.rs index 14e6c2715df0b..992a9207a7206 100644 --- a/library/std/src/prelude/mod.rs +++ b/library/std/src/prelude/mod.rs @@ -111,16 +111,7 @@ #![stable(feature = "rust1", since = "1.0.0")] -mod common; - -/// The first version of the prelude of The Rust Standard Library. -/// -/// See the [module-level documentation](self) for more. -#[stable(feature = "rust1", since = "1.0.0")] -pub mod v1 { - #[stable(feature = "rust1", since = "1.0.0")] - pub use super::common::*; -} +pub mod v1; /// The 2015 version of the prelude of The Rust Standard Library. /// @@ -162,7 +153,8 @@ pub mod rust_2021 { #[stable(feature = "prelude_2024", since = "1.85.0")] pub mod rust_2024 { #[stable(feature = "rust1", since = "1.0.0")] - pub use super::common::*; + #[doc(no_inline)] + pub use super::v1::*; #[stable(feature = "prelude_2024", since = "1.85.0")] #[doc(no_inline)] diff --git a/library/std/src/prelude/common.rs b/library/std/src/prelude/v1.rs similarity index 97% rename from library/std/src/prelude/common.rs rename to library/std/src/prelude/v1.rs index 0f2d8334fca79..5b324b2e91671 100644 --- a/library/std/src/prelude/common.rs +++ b/library/std/src/prelude/v1.rs @@ -1,7 +1,9 @@ -//! Items common to the prelude of all editions. +//! The first version of the prelude of The Rust Standard Library. //! //! See the [module-level documentation](super) for more. +#![stable(feature = "rust1", since = "1.0.0")] + // No formatting: this file is nothing but re-exports, and their order is worth preserving. #![cfg_attr(rustfmt, rustfmt::skip)] diff --git a/tests/rustdoc-js-std/vec-new.js b/tests/rustdoc-js-std/vec-new.js index bb122ff439819..0eae8b6c19783 100644 --- a/tests/rustdoc-js-std/vec-new.js +++ b/tests/rustdoc-js-std/vec-new.js @@ -9,7 +9,7 @@ const EXPECTED = [ { 'query': 'prelude::vec', 'others': [ - { 'path': 'std::prelude::rust_2024', 'name': 'Vec' }, + { 'path': 'std::prelude::v1', 'name': 'Vec' }, ], }, { From 51b105d9f7a6c678da7dde6eb09d97d4f270a42a Mon Sep 17 00:00:00 2001 From: jyn Date: Wed, 12 Feb 2025 21:16:36 -0500 Subject: [PATCH 04/12] ignore vendor directory in `git status` --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index ddc8dad95e809..2184e04f16b27 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,8 @@ no_llvm_build /library/target /src/bootstrap/target /src/tools/x/target +# Created by `x vendor` +/vendor # Created by default with `src/ci/docker/run.sh` /obj/ # Created by nix dev shell / .envrc From 1a3efd27abc25372930fef847ff2d2027f5e821a Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Thu, 13 Feb 2025 10:04:10 +0100 Subject: [PATCH 05/12] Use `slice::fill` in `io::Repeat` implementation Use the existing `fill` methods on slices instead of manually writing the fill loop. --- library/std/src/io/util.rs | 28 ++++++++++------------------ library/std/src/lib.rs | 1 + 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/library/std/src/io/util.rs b/library/std/src/io/util.rs index 424f862090f09..cb3f864fd4e1e 100644 --- a/library/std/src/io/util.rs +++ b/library/std/src/io/util.rs @@ -7,6 +7,7 @@ use crate::fmt; use crate::io::{ self, BorrowedCursor, BufRead, IoSlice, IoSliceMut, Read, Seek, SeekFrom, SizeHint, Write, }; +use crate::mem::MaybeUninit; /// `Empty` ignores any data written via [`Write`], and will always be empty /// (returning zero bytes) when read via [`Read`]. @@ -182,35 +183,26 @@ pub const fn repeat(byte: u8) -> Repeat { impl Read for Repeat { #[inline] fn read(&mut self, buf: &mut [u8]) -> io::Result { - for slot in &mut *buf { - *slot = self.byte; - } + buf.fill(self.byte); Ok(buf.len()) } + #[inline] fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> { - for slot in &mut *buf { - *slot = self.byte; - } + buf.fill(self.byte); Ok(()) } + #[inline] fn read_buf(&mut self, mut buf: BorrowedCursor<'_>) -> io::Result<()> { - // SAFETY: No uninit bytes are being written - for slot in unsafe { buf.as_mut() } { - slot.write(self.byte); - } - - let remaining = buf.capacity(); - - // SAFETY: the entire unfilled portion of buf has been initialized - unsafe { - buf.advance_unchecked(remaining); - } - + // SAFETY: No uninit bytes are being written. + MaybeUninit::fill(unsafe { buf.as_mut() }, self.byte); + // SAFETY: the entire unfilled portion of buf has been initialized. + unsafe { buf.advance_unchecked(buf.capacity()) }; Ok(()) } + #[inline] fn read_buf_exact(&mut self, buf: BorrowedCursor<'_>) -> io::Result<()> { self.read_buf(buf) } diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index aea81b4bddee0..5ad19a981d958 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -302,6 +302,7 @@ #![feature(link_cfg)] #![feature(linkage)] #![feature(macro_metavar_expr_concat)] +#![feature(maybe_uninit_fill)] #![feature(min_specialization)] #![feature(must_not_suspend)] #![feature(needs_panic_runtime)] From 2f27236745fab41c73450cdb31cdf9d0db502dda Mon Sep 17 00:00:00 2001 From: Jed Brown Date: Thu, 13 Feb 2025 09:13:33 -0700 Subject: [PATCH 06/12] alloc boxed: docs: use MaybeUninit::write instead of as_mut_ptr In the deferred initialization pattern, the docs were needlessly going through as_mut_ptr().write() to initialize, which is unnecessary use of a pointer, needs to be inside an unsafe block, and may weaken alias analysis. --- library/alloc/src/boxed.rs | 128 +++++++++++++------------------------ 1 file changed, 44 insertions(+), 84 deletions(-) diff --git a/library/alloc/src/boxed.rs b/library/alloc/src/boxed.rs index 8b38e6fc259af..60e46dc7a09cf 100644 --- a/library/alloc/src/boxed.rs +++ b/library/alloc/src/boxed.rs @@ -280,13 +280,9 @@ impl Box { /// /// ``` /// let mut five = Box::::new_uninit(); - /// - /// let five = unsafe { - /// // Deferred initialization: - /// five.as_mut_ptr().write(5); - /// - /// five.assume_init() - /// }; + /// // Deferred initialization: + /// five.write(5); + /// let five = unsafe { five.assume_init() }; /// /// assert_eq!(*five, 5) /// ``` @@ -367,13 +363,9 @@ impl Box { /// #![feature(allocator_api)] /// /// let mut five = Box::::try_new_uninit()?; - /// - /// let five = unsafe { - /// // Deferred initialization: - /// five.as_mut_ptr().write(5); - /// - /// five.assume_init() - /// }; + /// // Deferred initialization: + /// five.write(5); + /// let five = unsafe { five.assume_init() }; /// /// assert_eq!(*five, 5); /// # Ok::<(), std::alloc::AllocError>(()) @@ -435,10 +427,8 @@ impl Box { A: Allocator, { let mut boxed = Self::new_uninit_in(alloc); - unsafe { - boxed.as_mut_ptr().write(x); - boxed.assume_init() - } + boxed.write(x); + unsafe { boxed.assume_init() } } /// Allocates memory in the given allocator then places `x` into it, @@ -463,10 +453,8 @@ impl Box { A: Allocator, { let mut boxed = Self::try_new_uninit_in(alloc)?; - unsafe { - boxed.as_mut_ptr().write(x); - Ok(boxed.assume_init()) - } + boxed.write(x); + unsafe { Ok(boxed.assume_init()) } } /// Constructs a new box with uninitialized contents in the provided allocator. @@ -479,13 +467,9 @@ impl Box { /// use std::alloc::System; /// /// let mut five = Box::::new_uninit_in(System); - /// - /// let five = unsafe { - /// // Deferred initialization: - /// five.as_mut_ptr().write(5); - /// - /// five.assume_init() - /// }; + /// // Deferred initialization: + /// five.write(5); + /// let five = unsafe { five.assume_init() }; /// /// assert_eq!(*five, 5) /// ``` @@ -517,13 +501,9 @@ impl Box { /// use std::alloc::System; /// /// let mut five = Box::::try_new_uninit_in(System)?; - /// - /// let five = unsafe { - /// // Deferred initialization: - /// five.as_mut_ptr().write(5); - /// - /// five.assume_init() - /// }; + /// // Deferred initialization: + /// five.write(5); + /// let five = unsafe { five.assume_init() }; /// /// assert_eq!(*five, 5); /// # Ok::<(), std::alloc::AllocError>(()) @@ -669,15 +649,11 @@ impl Box<[T]> { /// /// ``` /// let mut values = Box::<[u32]>::new_uninit_slice(3); - /// - /// let values = unsafe { - /// // Deferred initialization: - /// values[0].as_mut_ptr().write(1); - /// values[1].as_mut_ptr().write(2); - /// values[2].as_mut_ptr().write(3); - /// - /// values.assume_init() - /// }; + /// // Deferred initialization: + /// values[0].write(1); + /// values[1].write(2); + /// values[2].write(3); + /// let values = unsafe {values.assume_init() }; /// /// assert_eq!(*values, [1, 2, 3]) /// ``` @@ -722,13 +698,11 @@ impl Box<[T]> { /// #![feature(allocator_api)] /// /// let mut values = Box::<[u32]>::try_new_uninit_slice(3)?; - /// let values = unsafe { - /// // Deferred initialization: - /// values[0].as_mut_ptr().write(1); - /// values[1].as_mut_ptr().write(2); - /// values[2].as_mut_ptr().write(3); - /// values.assume_init() - /// }; + /// // Deferred initialization: + /// values[0].write(1); + /// values[1].write(2); + /// values[2].write(3); + /// let values = unsafe { values.assume_init() }; /// /// assert_eq!(*values, [1, 2, 3]); /// # Ok::<(), std::alloc::AllocError>(()) @@ -814,15 +788,11 @@ impl Box<[T], A> { /// use std::alloc::System; /// /// let mut values = Box::<[u32], _>::new_uninit_slice_in(3, System); - /// - /// let values = unsafe { - /// // Deferred initialization: - /// values[0].as_mut_ptr().write(1); - /// values[1].as_mut_ptr().write(2); - /// values[2].as_mut_ptr().write(3); - /// - /// values.assume_init() - /// }; + /// // Deferred initialization: + /// values[0].write(1); + /// values[1].write(2); + /// values[2].write(3); + /// let values = unsafe { values.assume_init() }; /// /// assert_eq!(*values, [1, 2, 3]) /// ``` @@ -873,13 +843,11 @@ impl Box<[T], A> { /// use std::alloc::System; /// /// let mut values = Box::<[u32], _>::try_new_uninit_slice_in(3, System)?; - /// let values = unsafe { - /// // Deferred initialization: - /// values[0].as_mut_ptr().write(1); - /// values[1].as_mut_ptr().write(2); - /// values[2].as_mut_ptr().write(3); - /// values.assume_init() - /// }; + /// // Deferred initialization: + /// values[0].write(1); + /// values[1].write(2); + /// values[2].write(3); + /// let values = unsafe { values.assume_init() }; /// /// assert_eq!(*values, [1, 2, 3]); /// # Ok::<(), std::alloc::AllocError>(()) @@ -959,13 +927,9 @@ impl Box, A> { /// /// ``` /// let mut five = Box::::new_uninit(); - /// - /// let five: Box = unsafe { - /// // Deferred initialization: - /// five.as_mut_ptr().write(5); - /// - /// five.assume_init() - /// }; + /// // Deferred initialization: + /// five.write(5); + /// let five: Box = unsafe { five.assume_init() }; /// /// assert_eq!(*five, 5) /// ``` @@ -1030,15 +994,11 @@ impl Box<[mem::MaybeUninit], A> { /// /// ``` /// let mut values = Box::<[u32]>::new_uninit_slice(3); - /// - /// let values = unsafe { - /// // Deferred initialization: - /// values[0].as_mut_ptr().write(1); - /// values[1].as_mut_ptr().write(2); - /// values[2].as_mut_ptr().write(3); - /// - /// values.assume_init() - /// }; + /// // Deferred initialization: + /// values[0].write(1); + /// values[1].write(2); + /// values[2].write(3); + /// let values = unsafe { values.assume_init() }; /// /// assert_eq!(*values, [1, 2, 3]) /// ``` From fb3a363a493dd461302c66b8f67d3ff66a729dc0 Mon Sep 17 00:00:00 2001 From: Christian Poveda Date: Thu, 13 Feb 2025 23:36:51 -0500 Subject: [PATCH 07/12] Emit MIR for each bit with on `dont_reset_cast_kind_without_updating_operand` --- ...eset_cast_kind_without_updating_operand.rs | 1 + ...g_operand.test.GVN.32bit.panic-abort.diff} | 0 ..._operand.test.GVN.32bit.panic-unwind.diff} | 0 ...ng_operand.test.GVN.64bit.panic-abort.diff | 180 ++++++++++++++++++ ...g_operand.test.GVN.64bit.panic-unwind.diff | 88 +++++++++ 5 files changed, 269 insertions(+) rename tests/mir-opt/{dont_reset_cast_kind_without_updating_operand.test.GVN.panic-abort.diff => dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff} (100%) rename tests/mir-opt/{dont_reset_cast_kind_without_updating_operand.test.GVN.panic-unwind.diff => dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff} (100%) create mode 100644 tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff create mode 100644 tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.rs b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.rs index 635ad825a12ab..4368933dc627f 100644 --- a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.rs +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.rs @@ -1,5 +1,6 @@ // skip-filecheck //@ compile-flags: -Zmir-enable-passes=+Inline,+GVN --crate-type lib +// EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR_FOR_EACH_PANIC_STRATEGY // EMIT_MIR dont_reset_cast_kind_without_updating_operand.test.GVN.diff diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.panic-abort.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff similarity index 100% rename from tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.panic-abort.diff rename to tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.panic-unwind.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff similarity index 100% rename from tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.panic-unwind.diff rename to tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-unwind.diff diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff new file mode 100644 index 0000000000000..1cf0f6de011ed --- /dev/null +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-abort.diff @@ -0,0 +1,180 @@ +- // MIR for `test` before GVN ++ // MIR for `test` after GVN + + fn test() -> () { + let mut _0: (); + let _1: &std::boxed::Box<()>; + let _2: &std::boxed::Box<()>; + let _3: std::boxed::Box<()>; + let mut _6: *const (); + let mut _8: *const [()]; + let mut _9: std::boxed::Box<()>; + let mut _10: *const (); + let mut _23: usize; + scope 1 { + debug vp_ctx => _1; + let _4: *const (); + scope 2 { + debug slf => _10; + let _5: *const [()]; + scope 3 { + debug bytes => _5; + let _7: *mut (); + scope 4 { + debug _x => _7; + } + scope 18 (inlined foo) { + } + } + scope 16 (inlined slice_from_raw_parts::<()>) { + scope 17 (inlined std::ptr::from_raw_parts::<[()], ()>) { + } + } + } + } + scope 5 (inlined Box::<()>::new) { + let mut _11: usize; + let mut _12: usize; + let mut _13: *mut u8; + scope 6 (inlined alloc::alloc::exchange_malloc) { + let _14: std::alloc::Layout; + let mut _15: std::result::Result, std::alloc::AllocError>; + let mut _16: isize; + let mut _18: !; + scope 7 { + let _17: std::ptr::NonNull<[u8]>; + scope 8 { + scope 11 (inlined NonNull::<[u8]>::as_mut_ptr) { + scope 12 (inlined NonNull::<[u8]>::as_non_null_ptr) { + scope 13 (inlined NonNull::<[u8]>::cast::) { + let mut _22: *mut [u8]; + scope 14 (inlined NonNull::<[u8]>::as_ptr) { + } + } + } + scope 15 (inlined NonNull::::as_ptr) { + } + } + } + scope 10 (inlined ::allocate) { + } + } + scope 9 (inlined Layout::from_size_align_unchecked) { + let mut _19: bool; + let _20: (); + let mut _21: std::ptr::Alignment; + } + } + } + + bb0: { + StorageLive(_1); +- StorageLive(_2); ++ nop; + StorageLive(_3); + StorageLive(_11); + StorageLive(_12); + StorageLive(_13); +- _11 = SizeOf(()); +- _12 = AlignOf(()); ++ _11 = const 0_usize; ++ _12 = const 1_usize; + StorageLive(_14); + StorageLive(_16); + StorageLive(_17); + StorageLive(_19); + _19 = const false; +- switchInt(move _19) -> [0: bb6, otherwise: bb5]; ++ switchInt(const false) -> [0: bb6, otherwise: bb5]; + } + + bb1: { + StorageDead(_3); + StorageDead(_1); + return; + } + + bb2: { + unreachable; + } + + bb3: { +- _18 = handle_alloc_error(move _14) -> unwind unreachable; ++ _18 = handle_alloc_error(const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}) -> unwind unreachable; + } + + bb4: { + _17 = copy ((_15 as Ok).0: std::ptr::NonNull<[u8]>); + StorageLive(_22); + _22 = copy _17 as *mut [u8] (Transmute); + _13 = copy _22 as *mut u8 (PtrToPtr); + StorageDead(_22); + StorageDead(_15); + StorageDead(_17); + StorageDead(_16); + StorageDead(_14); + _3 = ShallowInitBox(move _13, ()); + StorageDead(_13); + StorageDead(_12); + StorageDead(_11); + _2 = &_3; + _1 = copy _2; +- StorageDead(_2); ++ nop; + StorageLive(_4); +- _9 = deref_copy _3; ++ _9 = copy _3; + _10 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute); + _4 = copy _10; +- StorageLive(_5); ++ nop; + StorageLive(_6); +- _6 = copy _4; ++ _6 = copy _10; + StorageLive(_23); + _23 = const 1_usize; +- _5 = *const [()] from (copy _6, copy _23); ++ _5 = *const [()] from (copy _10, const 1_usize); + StorageDead(_23); + StorageDead(_6); + StorageLive(_7); + StorageLive(_8); + _8 = copy _5; +- _7 = copy _8 as *mut () (PtrToPtr); ++ _7 = copy _5 as *mut () (PtrToPtr); + StorageDead(_8); + StorageDead(_7); +- StorageDead(_5); ++ nop; + StorageDead(_4); + drop(_3) -> [return: bb1, unwind unreachable]; + } + + bb5: { +- _20 = Layout::from_size_align_unchecked::precondition_check(copy _11, copy _12) -> [return: bb6, unwind unreachable]; ++ _20 = Layout::from_size_align_unchecked::precondition_check(const 0_usize, const 1_usize) -> [return: bb6, unwind unreachable]; + } + + bb6: { + StorageDead(_19); + StorageLive(_21); +- _21 = copy _12 as std::ptr::Alignment (Transmute); +- _14 = Layout { size: copy _11, align: move _21 }; ++ _21 = const std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0); ++ _14 = const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}; + StorageDead(_21); + StorageLive(_15); +- _15 = std::alloc::Global::alloc_impl(const alloc::alloc::exchange_malloc::promoted[0], copy _14, const false) -> [return: bb7, unwind unreachable]; ++ _15 = std::alloc::Global::alloc_impl(const alloc::alloc::exchange_malloc::promoted[0], const Layout {{ size: 0_usize, align: std::ptr::Alignment(std::ptr::alignment::AlignmentEnum::_Align1Shl0) }}, const false) -> [return: bb7, unwind unreachable]; + } + + bb7: { + _16 = discriminant(_15); + switchInt(move _16) -> [0: bb4, 1: bb3, otherwise: bb2]; + } ++ } ++ ++ ALLOC0 (size: 16, align: 8) { ++ 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................ + } + diff --git a/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff new file mode 100644 index 0000000000000..6bac680594319 --- /dev/null +++ b/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.64bit.panic-unwind.diff @@ -0,0 +1,88 @@ +- // MIR for `test` before GVN ++ // MIR for `test` after GVN + + fn test() -> () { + let mut _0: (); + let _1: &std::boxed::Box<()>; + let _2: &std::boxed::Box<()>; + let _3: std::boxed::Box<()>; + let mut _6: *const (); + let mut _8: *const [()]; + let mut _9: std::boxed::Box<()>; + let mut _10: *const (); + let mut _11: usize; + scope 1 { + debug vp_ctx => _1; + let _4: *const (); + scope 2 { + debug slf => _10; + let _5: *const [()]; + scope 3 { + debug bytes => _5; + let _7: *mut (); + scope 4 { + debug _x => _7; + } + scope 7 (inlined foo) { + } + } + scope 5 (inlined slice_from_raw_parts::<()>) { + scope 6 (inlined std::ptr::from_raw_parts::<[()], ()>) { + } + } + } + } + + bb0: { + StorageLive(_1); +- StorageLive(_2); ++ nop; + StorageLive(_3); + _3 = Box::<()>::new(const ()) -> [return: bb1, unwind continue]; + } + + bb1: { + _2 = &_3; + _1 = copy _2; +- StorageDead(_2); ++ nop; + StorageLive(_4); +- _9 = deref_copy _3; ++ _9 = copy _3; + _10 = copy ((_9.0: std::ptr::Unique<()>).0: std::ptr::NonNull<()>) as *const () (Transmute); + _4 = copy _10; +- StorageLive(_5); ++ nop; + StorageLive(_6); +- _6 = copy _4; ++ _6 = copy _10; + StorageLive(_11); + _11 = const 1_usize; +- _5 = *const [()] from (copy _6, copy _11); ++ _5 = *const [()] from (copy _10, const 1_usize); + StorageDead(_11); + StorageDead(_6); + StorageLive(_7); + StorageLive(_8); + _8 = copy _5; +- _7 = copy _8 as *mut () (PtrToPtr); ++ _7 = copy _5 as *mut () (PtrToPtr); + StorageDead(_8); + StorageDead(_7); +- StorageDead(_5); ++ nop; + StorageDead(_4); + drop(_3) -> [return: bb2, unwind: bb3]; + } + + bb2: { + StorageDead(_3); + StorageDead(_1); + return; + } + + bb3 (cleanup): { + resume; + } + } + From 46c72362bcc38e32ba89dea15080f6f9e727f01d Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 14 Feb 2025 15:30:51 +1100 Subject: [PATCH 08/12] Move drop elaboration infrastructure. `rustc_mir_dataflow/src/elaborate_drops.rs` contains some infrastructure used by a few MIR passes: the `elaborate_drop` function, the `DropElaborator` trait, etc. `rustc_mir_transform/src/elaborate_drops.rs` (same file name, different crate) contains the `ElaborateDrops` pass. It relies on a lot of the infrastructure from `rustc_mir_dataflow/src/elaborate_drops.rs`. It turns out that the drop infrastructure is only used in `rustc_mir_transform`, so this commit moves it there. (The only exception is the small `DropFlagState` type, which is moved to the existing `rustc_mir_dataflow/src/drop_flag_effects.rs`.) The file is renamed from `rustc_mir_dataflow/src/elaborate_drops.rs` to `rustc_mir_transform/src/elaborate_drop.rs` (with no trailing `s`) because (a) the `elaborate_drop` function is the most important export, and (b) `rustc_mir_transform/src/elaborate_drops.rs` already exists. All the infrastructure pieces that used to be `pub` are now `pub(crate)`, because they are now only used within `rustc_mir_transform`. --- .../src/drop_flag_effects.rs | 21 ++++++++++++- .../src/impls/initialized.rs | 2 +- compiler/rustc_mir_dataflow/src/lib.rs | 3 +- compiler/rustc_mir_transform/src/coroutine.rs | 2 +- .../src/elaborate_drop.rs} | 30 ++++--------------- .../src/elaborate_drops.rs | 7 ++--- compiler/rustc_mir_transform/src/lib.rs | 1 + compiler/rustc_mir_transform/src/shim.rs | 6 ++-- 8 files changed, 35 insertions(+), 37 deletions(-) rename compiler/{rustc_mir_dataflow/src/elaborate_drops.rs => rustc_mir_transform/src/elaborate_drop.rs} (98%) diff --git a/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs b/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs index e5cddd0e5e4b7..496a342cf4c55 100644 --- a/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs +++ b/compiler/rustc_mir_dataflow/src/drop_flag_effects.rs @@ -3,7 +3,26 @@ use rustc_middle::mir::{self, Body, Location, Terminator, TerminatorKind}; use tracing::debug; use super::move_paths::{InitKind, LookupResult, MoveData, MovePathIndex}; -use crate::elaborate_drops::DropFlagState; + +/// The value of an inserted drop flag. +#[derive(Debug, PartialEq, Eq, Copy, Clone)] +pub enum DropFlagState { + /// The tracked value is initialized and needs to be dropped when leaving its scope. + Present, + + /// The tracked value is uninitialized or was moved out of and does not need to be dropped when + /// leaving its scope. + Absent, +} + +impl DropFlagState { + pub fn value(self) -> bool { + match self { + DropFlagState::Present => true, + DropFlagState::Absent => false, + } + } +} pub fn move_path_children_matching<'tcx, F>( move_data: &MoveData<'tcx>, diff --git a/compiler/rustc_mir_dataflow/src/impls/initialized.rs b/compiler/rustc_mir_dataflow/src/impls/initialized.rs index 760f94af52dd3..3be450a0b3f47 100644 --- a/compiler/rustc_mir_dataflow/src/impls/initialized.rs +++ b/compiler/rustc_mir_dataflow/src/impls/initialized.rs @@ -9,7 +9,7 @@ use rustc_middle::ty::util::Discr; use rustc_middle::ty::{self, TyCtxt}; use tracing::{debug, instrument}; -use crate::elaborate_drops::DropFlagState; +use crate::drop_flag_effects::DropFlagState; use crate::framework::SwitchIntTarget; use crate::move_paths::{HasMoveData, InitIndex, InitKind, LookupResult, MoveData, MovePathIndex}; use crate::{ diff --git a/compiler/rustc_mir_dataflow/src/lib.rs b/compiler/rustc_mir_dataflow/src/lib.rs index 0cc79b0c93903..a8a56baa1ffc0 100644 --- a/compiler/rustc_mir_dataflow/src/lib.rs +++ b/compiler/rustc_mir_dataflow/src/lib.rs @@ -15,7 +15,7 @@ use rustc_middle::ty; // Please change the public `use` directives cautiously, as they might be used by external tools. // See issue #120130. pub use self::drop_flag_effects::{ - drop_flag_effects_for_function_entry, drop_flag_effects_for_location, + DropFlagState, drop_flag_effects_for_function_entry, drop_flag_effects_for_location, move_path_children_matching, on_all_children_bits, on_lookup_result_bits, }; pub use self::framework::{ @@ -26,7 +26,6 @@ use self::move_paths::MoveData; pub mod debuginfo; mod drop_flag_effects; -pub mod elaborate_drops; mod errors; mod framework; pub mod impls; diff --git a/compiler/rustc_mir_transform/src/coroutine.rs b/compiler/rustc_mir_transform/src/coroutine.rs index a9bdbeb9cb806..ba19a2b50040c 100644 --- a/compiler/rustc_mir_transform/src/coroutine.rs +++ b/compiler/rustc_mir_transform/src/coroutine.rs @@ -1062,8 +1062,8 @@ fn insert_switch<'tcx>( fn elaborate_coroutine_drops<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { use rustc_middle::mir::patch::MirPatch; - use rustc_mir_dataflow::elaborate_drops::{Unwind, elaborate_drop}; + use crate::elaborate_drop::{Unwind, elaborate_drop}; use crate::shim::DropShimElaborator; // Note that `elaborate_drops` only drops the upvars of a coroutine, and diff --git a/compiler/rustc_mir_dataflow/src/elaborate_drops.rs b/compiler/rustc_mir_transform/src/elaborate_drop.rs similarity index 98% rename from compiler/rustc_mir_dataflow/src/elaborate_drops.rs rename to compiler/rustc_mir_transform/src/elaborate_drop.rs index c1c47ecccf302..46eb861e3845b 100644 --- a/compiler/rustc_mir_dataflow/src/elaborate_drops.rs +++ b/compiler/rustc_mir_transform/src/elaborate_drop.rs @@ -13,29 +13,9 @@ use rustc_span::DUMMY_SP; use rustc_span::source_map::Spanned; use tracing::{debug, instrument}; -/// The value of an inserted drop flag. -#[derive(Debug, PartialEq, Eq, Copy, Clone)] -pub enum DropFlagState { - /// The tracked value is initialized and needs to be dropped when leaving its scope. - Present, - - /// The tracked value is uninitialized or was moved out of and does not need to be dropped when - /// leaving its scope. - Absent, -} - -impl DropFlagState { - pub fn value(self) -> bool { - match self { - DropFlagState::Present => true, - DropFlagState::Absent => false, - } - } -} - /// Describes how/if a value should be dropped. #[derive(Debug)] -pub enum DropStyle { +pub(crate) enum DropStyle { /// The value is already dead at the drop location, no drop will be executed. Dead, @@ -56,7 +36,7 @@ pub enum DropStyle { /// Which drop flags to affect/check with an operation. #[derive(Debug)] -pub enum DropFlagMode { +pub(crate) enum DropFlagMode { /// Only affect the top-level drop flag, not that of any contained fields. Shallow, /// Affect all nested drop flags in addition to the top-level one. @@ -65,7 +45,7 @@ pub enum DropFlagMode { /// Describes if unwinding is necessary and where to unwind to if a panic occurs. #[derive(Copy, Clone, Debug)] -pub enum Unwind { +pub(crate) enum Unwind { /// Unwind to this block. To(BasicBlock), /// Already in an unwind path, any panic will cause an abort. @@ -98,7 +78,7 @@ impl Unwind { } } -pub trait DropElaborator<'a, 'tcx>: fmt::Debug { +pub(crate) trait DropElaborator<'a, 'tcx>: fmt::Debug { /// The type representing paths that can be moved out of. /// /// Users can move out of individual fields of a struct, such as `a.b.c`. This type is used to @@ -177,7 +157,7 @@ where /// value. /// /// When this returns, the MIR patch in the `elaborator` contains the necessary changes. -pub fn elaborate_drop<'b, 'tcx, D>( +pub(crate) fn elaborate_drop<'b, 'tcx, D>( elaborator: &mut D, source_info: SourceInfo, place: Place<'tcx>, diff --git a/compiler/rustc_mir_transform/src/elaborate_drops.rs b/compiler/rustc_mir_transform/src/elaborate_drops.rs index cb869160c8054..ff42662624933 100644 --- a/compiler/rustc_mir_transform/src/elaborate_drops.rs +++ b/compiler/rustc_mir_transform/src/elaborate_drops.rs @@ -6,18 +6,17 @@ use rustc_index::bit_set::DenseBitSet; use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::ty::{self, TyCtxt}; -use rustc_mir_dataflow::elaborate_drops::{ - DropElaborator, DropFlagMode, DropFlagState, DropStyle, Unwind, elaborate_drop, -}; use rustc_mir_dataflow::impls::{MaybeInitializedPlaces, MaybeUninitializedPlaces}; use rustc_mir_dataflow::move_paths::{LookupResult, MoveData, MovePathIndex}; use rustc_mir_dataflow::{ - Analysis, MoveDataTypingEnv, ResultsCursor, on_all_children_bits, on_lookup_result_bits, + Analysis, DropFlagState, MoveDataTypingEnv, ResultsCursor, on_all_children_bits, + on_lookup_result_bits, }; use rustc_span::Span; use tracing::{debug, instrument}; use crate::deref_separator::deref_finder; +use crate::elaborate_drop::{DropElaborator, DropFlagMode, DropStyle, Unwind, elaborate_drop}; /// During MIR building, Drop terminators are inserted in every place where a drop may occur. /// However, in this phase, the presence of these terminators does not guarantee that a destructor diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 397d21a857f00..b7c72866fba48 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -49,6 +49,7 @@ mod check_pointers; mod cost_checker; mod cross_crate_inline; mod deduce_param_attrs; +mod elaborate_drop; mod errors; mod ffi_unwind_calls; mod lint; diff --git a/compiler/rustc_mir_transform/src/shim.rs b/compiler/rustc_mir_transform/src/shim.rs index f7ec0f740d300..06f154e65b340 100644 --- a/compiler/rustc_mir_transform/src/shim.rs +++ b/compiler/rustc_mir_transform/src/shim.rs @@ -14,11 +14,11 @@ use rustc_middle::ty::{ self, CoroutineArgs, CoroutineArgsExt, EarlyBinder, GenericArgs, Ty, TyCtxt, }; use rustc_middle::{bug, span_bug}; -use rustc_mir_dataflow::elaborate_drops::{self, DropElaborator, DropFlagMode, DropStyle}; use rustc_span::source_map::Spanned; use rustc_span::{DUMMY_SP, Span}; use tracing::{debug, instrument}; +use crate::elaborate_drop::{DropElaborator, DropFlagMode, DropStyle, Unwind, elaborate_drop}; use crate::{ abort_unwinding_calls, add_call_guards, add_moves_for_packed_drops, deref_separator, inline, instsimplify, mentioned_items, pass_manager as pm, remove_noop_landing_pads, simplify, @@ -283,13 +283,13 @@ fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, ty: Option>) DropShimElaborator { body: &body, patch: MirPatch::new(&body), tcx, typing_env }; let dropee = tcx.mk_place_deref(dropee_ptr); let resume_block = elaborator.patch.resume_block(); - elaborate_drops::elaborate_drop( + elaborate_drop( &mut elaborator, source_info, dropee, (), return_block, - elaborate_drops::Unwind::To(resume_block), + Unwind::To(resume_block), START_BLOCK, ); elaborator.patch From 28b75a384e483d654dbe95bb376dc39af8b117c1 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Fri, 14 Feb 2025 15:56:06 +1100 Subject: [PATCH 09/12] Move `MirPatch` from `rustc_middle` to `rustc_mir_transform`. Because it's only used in `rustc_mir_transform`. (Presumably it is currently in `rustc_middle` because lots of other MIR-related stuff is, but that's not a hard requirement.) And because `rustc_middle` is huge and it's always good to make it smaller. --- compiler/rustc_middle/src/mir/mod.rs | 1 - .../src/add_moves_for_packed_drops.rs | 2 +- .../src/add_subtyping_projections.rs | 3 +- compiler/rustc_mir_transform/src/coroutine.rs | 3 +- .../src/deref_separator.rs | 3 +- .../src/early_otherwise_branch.rs | 2 +- .../src/elaborate_box_derefs.rs | 3 +- .../rustc_mir_transform/src/elaborate_drop.rs | 3 +- .../src/elaborate_drops.rs | 2 +- compiler/rustc_mir_transform/src/lib.rs | 1 + .../rustc_mir_transform/src/match_branches.rs | 2 +- .../mir => rustc_mir_transform/src}/patch.rs | 46 ++++++++----------- .../src/remove_noop_landing_pads.rs | 3 +- compiler/rustc_mir_transform/src/shim.rs | 2 +- compiler/rustc_mir_transform/src/sroa.rs | 3 +- .../src/unreachable_enum_branching.rs | 3 +- .../src/unreachable_prop.rs | 3 +- 17 files changed, 43 insertions(+), 42 deletions(-) rename compiler/{rustc_middle/src/mir => rustc_mir_transform/src}/patch.rs (84%) diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 63e20fb0d64e5..795cfcef2d36d 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -49,7 +49,6 @@ pub mod generic_graphviz; pub mod graphviz; pub mod interpret; pub mod mono; -pub mod patch; pub mod pretty; mod query; mod statement; diff --git a/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs b/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs index 8716fd1c098e3..b33326cb873df 100644 --- a/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs +++ b/compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs @@ -1,8 +1,8 @@ -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::ty::{self, TyCtxt}; use tracing::debug; +use crate::patch::MirPatch; use crate::util; /// This pass moves values being dropped that are within a packed diff --git a/compiler/rustc_mir_transform/src/add_subtyping_projections.rs b/compiler/rustc_mir_transform/src/add_subtyping_projections.rs index e41f47db545b8..b5cd41334598b 100644 --- a/compiler/rustc_mir_transform/src/add_subtyping_projections.rs +++ b/compiler/rustc_mir_transform/src/add_subtyping_projections.rs @@ -1,8 +1,9 @@ -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::visit::MutVisitor; use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; +use crate::patch::MirPatch; + pub(super) struct Subtyper; struct SubTypeChecker<'a, 'tcx> { diff --git a/compiler/rustc_mir_transform/src/coroutine.rs b/compiler/rustc_mir_transform/src/coroutine.rs index ba19a2b50040c..afc49c5cc54af 100644 --- a/compiler/rustc_mir_transform/src/coroutine.rs +++ b/compiler/rustc_mir_transform/src/coroutine.rs @@ -1061,9 +1061,8 @@ fn insert_switch<'tcx>( } fn elaborate_coroutine_drops<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - use rustc_middle::mir::patch::MirPatch; - use crate::elaborate_drop::{Unwind, elaborate_drop}; + use crate::patch::MirPatch; use crate::shim::DropShimElaborator; // Note that `elaborate_drops` only drops the upvars of a coroutine, and diff --git a/compiler/rustc_mir_transform/src/deref_separator.rs b/compiler/rustc_mir_transform/src/deref_separator.rs index a54bdaa407593..bc914ea656415 100644 --- a/compiler/rustc_mir_transform/src/deref_separator.rs +++ b/compiler/rustc_mir_transform/src/deref_separator.rs @@ -1,9 +1,10 @@ -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::visit::NonUseContext::VarDebugInfo; use rustc_middle::mir::visit::{MutVisitor, PlaceContext}; use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; +use crate::patch::MirPatch; + pub(super) struct Derefer; struct DerefChecker<'a, 'tcx> { diff --git a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs index eb335a1e4a707..57f7893be1b8c 100644 --- a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs +++ b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs @@ -1,11 +1,11 @@ use std::fmt::Debug; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::ty::{Ty, TyCtxt}; use tracing::trace; use super::simplify::simplify_cfg; +use crate::patch::MirPatch; /// This pass optimizes something like /// ```ignore (syntax-highlighting-only) diff --git a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs index 6d3b5d9851b33..5c344a806880c 100644 --- a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs +++ b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs @@ -4,12 +4,13 @@ use rustc_abi::FieldIdx; use rustc_hir::def_id::DefId; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::visit::MutVisitor; use rustc_middle::mir::*; use rustc_middle::span_bug; use rustc_middle::ty::{Ty, TyCtxt}; +use crate::patch::MirPatch; + /// Constructs the types used when accessing a Box's pointer fn build_ptr_tys<'tcx>( tcx: TyCtxt<'tcx>, diff --git a/compiler/rustc_mir_transform/src/elaborate_drop.rs b/compiler/rustc_mir_transform/src/elaborate_drop.rs index 46eb861e3845b..ed4903017f353 100644 --- a/compiler/rustc_mir_transform/src/elaborate_drop.rs +++ b/compiler/rustc_mir_transform/src/elaborate_drop.rs @@ -3,7 +3,6 @@ use std::{fmt, iter, mem}; use rustc_abi::{FIRST_VARIANT, FieldIdx, VariantIdx}; use rustc_hir::lang_items::LangItem; use rustc_index::Idx; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::span_bug; use rustc_middle::ty::adjustment::PointerCoercion; @@ -13,6 +12,8 @@ use rustc_span::DUMMY_SP; use rustc_span::source_map::Spanned; use tracing::{debug, instrument}; +use crate::patch::MirPatch; + /// Describes how/if a value should be dropped. #[derive(Debug)] pub(crate) enum DropStyle { diff --git a/compiler/rustc_mir_transform/src/elaborate_drops.rs b/compiler/rustc_mir_transform/src/elaborate_drops.rs index ff42662624933..2d74fcff415ed 100644 --- a/compiler/rustc_mir_transform/src/elaborate_drops.rs +++ b/compiler/rustc_mir_transform/src/elaborate_drops.rs @@ -3,7 +3,6 @@ use std::fmt; use rustc_abi::{FieldIdx, VariantIdx}; use rustc_index::IndexVec; use rustc_index::bit_set::DenseBitSet; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::ty::{self, TyCtxt}; use rustc_mir_dataflow::impls::{MaybeInitializedPlaces, MaybeUninitializedPlaces}; @@ -17,6 +16,7 @@ use tracing::{debug, instrument}; use crate::deref_separator::deref_finder; use crate::elaborate_drop::{DropElaborator, DropFlagMode, DropStyle, Unwind, elaborate_drop}; +use crate::patch::MirPatch; /// During MIR building, Drop terminators are inserted in every place where a drop may occur. /// However, in this phase, the presence of these terminators does not guarantee that a destructor diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index b7c72866fba48..46abdcb2a8709 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -54,6 +54,7 @@ mod errors; mod ffi_unwind_calls; mod lint; mod lint_tail_expr_drop_order; +mod patch; mod shim; mod ssa; diff --git a/compiler/rustc_mir_transform/src/match_branches.rs b/compiler/rustc_mir_transform/src/match_branches.rs index 500116580d5d7..9db37bf5a0721 100644 --- a/compiler/rustc_mir_transform/src/match_branches.rs +++ b/compiler/rustc_mir_transform/src/match_branches.rs @@ -2,7 +2,6 @@ use std::iter; use rustc_abi::Integer; use rustc_index::IndexSlice; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::ty::layout::{IntegerExt, TyAndLayout}; use rustc_middle::ty::{self, ScalarInt, Ty, TyCtxt}; @@ -10,6 +9,7 @@ use rustc_type_ir::TyKind::*; use tracing::instrument; use super::simplify::simplify_cfg; +use crate::patch::MirPatch; pub(super) struct MatchBranchSimplification; diff --git a/compiler/rustc_middle/src/mir/patch.rs b/compiler/rustc_mir_transform/src/patch.rs similarity index 84% rename from compiler/rustc_middle/src/mir/patch.rs rename to compiler/rustc_mir_transform/src/patch.rs index 748797fbb8d5c..72cd9c224f648 100644 --- a/compiler/rustc_middle/src/mir/patch.rs +++ b/compiler/rustc_mir_transform/src/patch.rs @@ -1,11 +1,13 @@ +use rustc_index::{Idx, IndexVec}; +use rustc_middle::mir::*; +use rustc_middle::ty::Ty; +use rustc_span::Span; use tracing::debug; -use crate::mir::*; - /// This struct represents a patch to MIR, which can add /// new statements and basic blocks and patch over block /// terminators. -pub struct MirPatch<'tcx> { +pub(crate) struct MirPatch<'tcx> { patch_map: IndexVec>>, new_blocks: Vec>, new_statements: Vec<(Location, StatementKind<'tcx>)>, @@ -22,7 +24,7 @@ pub struct MirPatch<'tcx> { } impl<'tcx> MirPatch<'tcx> { - pub fn new(body: &Body<'tcx>) -> Self { + pub(crate) fn new(body: &Body<'tcx>) -> Self { let mut result = MirPatch { patch_map: IndexVec::from_elem(None, &body.basic_blocks), new_blocks: vec![], @@ -69,7 +71,7 @@ impl<'tcx> MirPatch<'tcx> { result } - pub fn resume_block(&mut self) -> BasicBlock { + pub(crate) fn resume_block(&mut self) -> BasicBlock { if let Some(bb) = self.resume_block { return bb; } @@ -86,7 +88,7 @@ impl<'tcx> MirPatch<'tcx> { bb } - pub fn unreachable_cleanup_block(&mut self) -> BasicBlock { + pub(crate) fn unreachable_cleanup_block(&mut self) -> BasicBlock { if let Some(bb) = self.unreachable_cleanup_block { return bb; } @@ -103,7 +105,7 @@ impl<'tcx> MirPatch<'tcx> { bb } - pub fn unreachable_no_cleanup_block(&mut self) -> BasicBlock { + pub(crate) fn unreachable_no_cleanup_block(&mut self) -> BasicBlock { if let Some(bb) = self.unreachable_no_cleanup_block { return bb; } @@ -120,7 +122,7 @@ impl<'tcx> MirPatch<'tcx> { bb } - pub fn terminate_block(&mut self, reason: UnwindTerminateReason) -> BasicBlock { + pub(crate) fn terminate_block(&mut self, reason: UnwindTerminateReason) -> BasicBlock { if let Some((cached_bb, cached_reason)) = self.terminate_block && reason == cached_reason { @@ -139,19 +141,11 @@ impl<'tcx> MirPatch<'tcx> { bb } - pub fn is_patched(&self, bb: BasicBlock) -> bool { + pub(crate) fn is_patched(&self, bb: BasicBlock) -> bool { self.patch_map[bb].is_some() } - pub fn terminator_loc(&self, body: &Body<'tcx>, bb: BasicBlock) -> Location { - let offset = match bb.index().checked_sub(body.basic_blocks.len()) { - Some(index) => self.new_blocks[index].statements.len(), - None => body[bb].statements.len(), - }; - Location { block: bb, statement_index: offset } - } - - pub fn new_local_with_info( + pub(crate) fn new_local_with_info( &mut self, ty: Ty<'tcx>, span: Span, @@ -165,14 +159,14 @@ impl<'tcx> MirPatch<'tcx> { Local::new(index) } - pub fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local { + pub(crate) fn new_temp(&mut self, ty: Ty<'tcx>, span: Span) -> Local { let index = self.next_local; self.next_local += 1; self.new_locals.push(LocalDecl::new(ty, span)); Local::new(index) } - pub fn new_block(&mut self, data: BasicBlockData<'tcx>) -> BasicBlock { + pub(crate) fn new_block(&mut self, data: BasicBlockData<'tcx>) -> BasicBlock { let block = BasicBlock::new(self.patch_map.len()); debug!("MirPatch: new_block: {:?}: {:?}", block, data); self.new_blocks.push(data); @@ -180,22 +174,22 @@ impl<'tcx> MirPatch<'tcx> { block } - pub fn patch_terminator(&mut self, block: BasicBlock, new: TerminatorKind<'tcx>) { + pub(crate) fn patch_terminator(&mut self, block: BasicBlock, new: TerminatorKind<'tcx>) { assert!(self.patch_map[block].is_none()); debug!("MirPatch: patch_terminator({:?}, {:?})", block, new); self.patch_map[block] = Some(new); } - pub fn add_statement(&mut self, loc: Location, stmt: StatementKind<'tcx>) { + pub(crate) fn add_statement(&mut self, loc: Location, stmt: StatementKind<'tcx>) { debug!("MirPatch: add_statement({:?}, {:?})", loc, stmt); self.new_statements.push((loc, stmt)); } - pub fn add_assign(&mut self, loc: Location, place: Place<'tcx>, rv: Rvalue<'tcx>) { + pub(crate) fn add_assign(&mut self, loc: Location, place: Place<'tcx>, rv: Rvalue<'tcx>) { self.add_statement(loc, StatementKind::Assign(Box::new((place, rv)))); } - pub fn apply(self, body: &mut Body<'tcx>) { + pub(crate) fn apply(self, body: &mut Body<'tcx>) { debug!( "MirPatch: {:?} new temps, starting from index {}: {:?}", self.new_locals.len(), @@ -241,14 +235,14 @@ impl<'tcx> MirPatch<'tcx> { } } - pub fn source_info_for_index(data: &BasicBlockData<'_>, loc: Location) -> SourceInfo { + fn source_info_for_index(data: &BasicBlockData<'_>, loc: Location) -> SourceInfo { match data.statements.get(loc.statement_index) { Some(stmt) => stmt.source_info, None => data.terminator().source_info, } } - pub fn source_info_for_location(&self, body: &Body<'tcx>, loc: Location) -> SourceInfo { + pub(crate) fn source_info_for_location(&self, body: &Body<'tcx>, loc: Location) -> SourceInfo { let data = match loc.block.index().checked_sub(body.basic_blocks.len()) { Some(new) => &self.new_blocks[new], None => &body[loc.block], diff --git a/compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs b/compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs index 9cdd52bec7bb9..1dd34005d6641 100644 --- a/compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs +++ b/compiler/rustc_mir_transform/src/remove_noop_landing_pads.rs @@ -1,10 +1,11 @@ use rustc_index::bit_set::DenseBitSet; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; use rustc_target::spec::PanicStrategy; use tracing::debug; +use crate::patch::MirPatch; + /// A pass that removes noop landing pads and replaces jumps to them with /// `UnwindAction::Continue`. This is important because otherwise LLVM generates /// terrible code for these. diff --git a/compiler/rustc_mir_transform/src/shim.rs b/compiler/rustc_mir_transform/src/shim.rs index 06f154e65b340..e8d86bad98735 100644 --- a/compiler/rustc_mir_transform/src/shim.rs +++ b/compiler/rustc_mir_transform/src/shim.rs @@ -6,7 +6,6 @@ use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::lang_items::LangItem; use rustc_index::{Idx, IndexVec}; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::query::Providers; use rustc_middle::ty::adjustment::PointerCoercion; @@ -19,6 +18,7 @@ use rustc_span::{DUMMY_SP, Span}; use tracing::{debug, instrument}; use crate::elaborate_drop::{DropElaborator, DropFlagMode, DropStyle, Unwind, elaborate_drop}; +use crate::patch::MirPatch; use crate::{ abort_unwinding_calls, add_call_guards, add_moves_for_packed_drops, deref_separator, inline, instsimplify, mentioned_items, pass_manager as pm, remove_noop_landing_pads, simplify, diff --git a/compiler/rustc_mir_transform/src/sroa.rs b/compiler/rustc_mir_transform/src/sroa.rs index 92e5c8a9ca428..28de99f9193d9 100644 --- a/compiler/rustc_mir_transform/src/sroa.rs +++ b/compiler/rustc_mir_transform/src/sroa.rs @@ -4,13 +4,14 @@ use rustc_hir::LangItem; use rustc_index::IndexVec; use rustc_index::bit_set::{DenseBitSet, GrowableBitSet}; use rustc_middle::bug; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::visit::*; use rustc_middle::mir::*; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_mir_dataflow::value_analysis::{excluded_locals, iter_fields}; use tracing::{debug, instrument}; +use crate::patch::MirPatch; + pub(super) struct ScalarReplacementOfAggregates; impl<'tcx> crate::MirPass<'tcx> for ScalarReplacementOfAggregates { diff --git a/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs b/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs index 1ff7043ed14d9..6ccec5b6f2129 100644 --- a/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs +++ b/compiler/rustc_mir_transform/src/unreachable_enum_branching.rs @@ -3,7 +3,6 @@ use rustc_abi::Variants; use rustc_data_structures::fx::FxHashSet; use rustc_middle::bug; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::{ BasicBlock, BasicBlockData, BasicBlocks, Body, Local, Operand, Rvalue, StatementKind, TerminatorKind, @@ -12,6 +11,8 @@ use rustc_middle::ty::layout::TyAndLayout; use rustc_middle::ty::{Ty, TyCtxt}; use tracing::trace; +use crate::patch::MirPatch; + pub(super) struct UnreachableEnumBranching; fn get_discriminant_local(terminator: &TerminatorKind<'_>) -> Option { diff --git a/compiler/rustc_mir_transform/src/unreachable_prop.rs b/compiler/rustc_mir_transform/src/unreachable_prop.rs index 1e5d9469c033e..13fb5b3e56f2f 100644 --- a/compiler/rustc_mir_transform/src/unreachable_prop.rs +++ b/compiler/rustc_mir_transform/src/unreachable_prop.rs @@ -6,10 +6,11 @@ use rustc_abi::Size; use rustc_data_structures::fx::FxHashSet; use rustc_middle::bug; use rustc_middle::mir::interpret::Scalar; -use rustc_middle::mir::patch::MirPatch; use rustc_middle::mir::*; use rustc_middle::ty::{self, TyCtxt}; +use crate::patch::MirPatch; + pub(super) struct UnreachablePropagation; impl crate::MirPass<'_> for UnreachablePropagation { From b480a9214a7037813d29bc04d9e9dbe92ce10cf3 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 13 Feb 2025 02:54:07 +0000 Subject: [PATCH 10/12] Use underline suggestions for purely 'additive' replacements --- compiler/rustc_errors/src/emitter.rs | 3 +- compiler/rustc_errors/src/lib.rs | 11 ++++ .../defaults-suitability.current.stderr | 5 +- .../defaults-suitability.next.stderr | 5 +- tests/ui/associated-types/issue-38821.stderr | 10 ++-- .../issue-54108.current.stderr | 5 +- .../associated-types/issue-54108.next.stderr | 5 +- tests/ui/attributes/rustc_confusables.stderr | 5 +- .../rustc_confusables_std_cases.stderr | 10 ++-- .../issue-115259-suggest-iter-mut.stderr | 5 +- .../issue-62387-suggest-iter-mut-2.stderr | 5 +- .../issue-62387-suggest-iter-mut.stderr | 10 ++-- tests/ui/c-variadic/issue-86053-1.stderr | 5 +- tests/ui/cfg/cfg-method-receiver.stderr | 5 +- tests/ui/check-cfg/diagnotics.cargo.stderr | 5 +- tests/ui/check-cfg/diagnotics.rustc.stderr | 5 +- .../2229_closure_analysis/bad-pattern.stderr | 5 +- tests/ui/closures/issue-78720.stderr | 5 +- tests/ui/compare-method/bad-self-type.stderr | 5 +- .../ensure_is_evaluatable.stderr | 5 +- .../fn_with_two_const_inputs.stderr | 5 +- .../abstract-const-as-cast-3.stderr | 20 +++----- .../doesnt_unify_evaluatable.stderr | 5 +- .../const_kind_expr/issue_114151.stderr | 5 +- .../const_kind_expr/wf_obligation.stderr | 5 +- ...e-a-closure-or-coroutine-ice-113776.stderr | 5 +- .../consts/const-pattern-irrefutable.stderr | 15 +++--- .../dont-suggest-hygienic-fields.stderr | 5 +- .../dropck/explicit-drop-bounds.bad1.stderr | 10 ++-- .../issue-90528-unsizing-suggestion-3.stderr | 5 +- .../ui/empty/empty-struct-braces-expr.stderr | 10 ++-- tests/ui/empty/empty-struct-tuple-pat.stderr | 5 +- tests/ui/extern/not-in-block.stderr | 10 ++-- .../no-inline-literals-out-of-range.stderr | 5 +- .../no-method-suggested-traits.stderr | 30 +++++------ tests/ui/imports/glob-resolve1.stderr | 5 +- .../ui/imports/issue-45829/import-self.stderr | 5 +- tests/ui/issues/issue-32004.stderr | 5 +- .../ui/issues/issue-41652/issue-41652.stderr | 5 +- tests/ui/issues/issue-51874.stderr | 5 +- tests/ui/issues/issue-5358-1.stderr | 5 +- tests/ui/issues/issue-56175.stderr | 5 +- .../issue-119696-err-on-fn.stderr | 5 +- .../issue-119697-extra-let.stderr | 5 +- .../let_underscore/let_underscore_drop.stderr | 5 +- .../let_underscore/let_underscore_lock.stderr | 20 +++----- tests/ui/lint/static-mut-refs.e2021.stderr | 30 +++++------ tests/ui/lint/static-mut-refs.e2024.stderr | 30 +++++------ tests/ui/lint/type-overflow.stderr | 10 ++-- ...ue-67691-unused-field-in-or-pattern.stderr | 10 ++-- tests/ui/lint/wide_pointer_comparisons.stderr | 5 +- .../macros/expr_2021_cargo_fix_edition.stderr | 10 ++-- .../macro-backtrace-invalid-internals.stderr | 10 ++-- tests/ui/methods/issues/issue-90315.stderr | 5 +- .../method-on-ambiguous-numeric-type.stderr | 5 +- tests/ui/mir/issue-112269.stderr | 10 ++-- ...use_of_moved_value_copy_suggestions.stderr | 5 +- .../projection-no-regions-closure.stderr | 10 ++-- .../projection-no-regions-fn.stderr | 10 ++-- ...tion-two-region-trait-bound-closure.stderr | 10 ++-- ...ection-where-clause-env-wrong-bound.stderr | 5 +- ...ion-where-clause-env-wrong-lifetime.stderr | 5 +- .../char/whitespace-character-literal.stderr | 5 +- tests/ui/parser/extern-no-fn.stderr | 5 +- .../issues/issue-87086-colon-path-sep.stderr | 30 +++++------ .../ui/parser/missing-fn-issue-65381-2.stderr | 5 +- .../parser/misspelled-keywords/const.stderr | 5 +- .../turbofish-arg-with-stray-colon.stderr | 5 +- tests/ui/parser/use-colon-as-mod-sep.stderr | 20 +++----- .../pat-tuple-field-count-cross.stderr | 5 +- tests/ui/pattern/pat-tuple-overfield.stderr | 5 +- .../patkind-ref-binding-issue-114896.stderr | 5 +- .../patkind-ref-binding-issue-122415.stderr | 5 +- tests/ui/privacy/privacy5.stderr | 50 ++++++++----------- tests/ui/pub/pub-ident-fn-or-struct.stderr | 5 +- tests/ui/resolve/issue-39226.stderr | 5 +- tests/ui/resolve/issue-55673.stderr | 5 +- tests/ui/resolve/issue-73427.stderr | 35 ++++++------- tests/ui/resolve/privacy-enum-ctor.stderr | 5 +- ...t.import_trait_associated_functions.stderr | 5 +- ...lve-issue-135614-assoc-const.normal.stderr | 5 +- ...e-with-name-similar-to-struct-field.stderr | 5 +- .../typo-suggestion-mistyped-in-path.stderr | 5 +- ...lity-attribute-implies-using-stable.stderr | 5 +- ...ty-attribute-implies-using-unstable.stderr | 5 +- ...lity-attribute-implies-using-stable.stderr | 5 +- ...ty-attribute-implies-using-unstable.stderr | 5 +- tests/ui/statics/issue-15261.stderr | 5 +- .../statics/static-mut-shared-parens.stderr | 5 +- tests/ui/statics/static-mut-xc.stderr | 5 +- tests/ui/statics/static-recursive.stderr | 5 +- .../struct-fields-hints-no-dupe.stderr | 5 +- tests/ui/suggestions/bound-suggestions.stderr | 5 +- ...const-pat-non-exaustive-let-new-var.stderr | 5 +- .../suggestions/crate-or-module-typo.stderr | 10 ++-- ...atible-trait-should-use-where-sized.stderr | 5 +- tests/ui/suggestions/field-access.stderr | 15 +++--- .../imm-ref-trait-object-literal.stderr | 5 +- .../impl-trait-missing-lifetime-gated.stderr | 20 +++----- ...-turbofish-surrounding-angle-braket.stderr | 5 +- ...t-field-type-including-single-colon.stderr | 10 ++-- .../ui/suggestions/suggest-change-mut.stderr | 5 +- tests/ui/suggestions/suggest-methods.stderr | 5 +- tests/ui/suggestions/suggest-variants.stderr | 10 ++-- .../type-ascription-instead-of-path-2.stderr | 5 +- ...-ascription-instead-of-path-in-type.stderr | 5 +- .../type-match-with-late-bound.stderr | 15 +++--- tests/ui/transmutability/assoc-bound.stderr | 5 +- tests/ui/typeck/issue-29181.stderr | 5 +- tests/ui/typeck/method-chain-gats.stderr | 5 +- 110 files changed, 369 insertions(+), 535 deletions(-) diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 4824dc098ada2..7d58e6f29da7c 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -1982,7 +1982,8 @@ impl HumanEmitter { { debug!(?complete, ?parts, ?highlights); - let has_deletion = parts.iter().any(|p| p.is_deletion(sm) || p.is_replacement(sm)); + let has_deletion = + parts.iter().any(|p| p.is_deletion(sm) || p.is_destructive_replacement(sm)); let is_multiline = complete.lines().count() > 1; if i == 0 { diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 9af17db9a6e6c..4a186565a7bfc 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -230,6 +230,17 @@ impl SubstitutionPart { !self.snippet.is_empty() && self.replaces_meaningful_content(sm) } + /// Whether this is a replacement that overwrites source with a snippet + /// in a way that isn't a superset of the original string. For example, + /// replacing "abc" with "abcde" is not destructive, but replacing it + /// it with "abx" is, since the "c" character is lost. + pub fn is_destructive_replacement(&self, sm: &SourceMap) -> bool { + self.is_replacement(sm) + && !sm + .span_to_snippet(self.span) + .is_ok_and(|snippet| self.snippet.trim_start().starts_with(snippet.trim_start())) + } + fn replaces_meaningful_content(&self, sm: &SourceMap) -> bool { sm.span_to_snippet(self.span) .map_or(!self.span.is_empty(), |snippet| !snippet.trim().is_empty()) diff --git a/tests/ui/associated-types/defaults-suitability.current.stderr b/tests/ui/associated-types/defaults-suitability.current.stderr index b9ea541e98119..61247cee1f34d 100644 --- a/tests/ui/associated-types/defaults-suitability.current.stderr +++ b/tests/ui/associated-types/defaults-suitability.current.stderr @@ -134,9 +134,8 @@ LL | type Baz = T; | --- required by a bound in this associated type help: consider further restricting type parameter `T` with trait `Clone` | -LL - Self::Baz: Clone, -LL + Self::Baz: Clone, T: std::clone::Clone - | +LL | Self::Baz: Clone, T: std::clone::Clone + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/associated-types/defaults-suitability.next.stderr b/tests/ui/associated-types/defaults-suitability.next.stderr index b9ea541e98119..61247cee1f34d 100644 --- a/tests/ui/associated-types/defaults-suitability.next.stderr +++ b/tests/ui/associated-types/defaults-suitability.next.stderr @@ -134,9 +134,8 @@ LL | type Baz = T; | --- required by a bound in this associated type help: consider further restricting type parameter `T` with trait `Clone` | -LL - Self::Baz: Clone, -LL + Self::Baz: Clone, T: std::clone::Clone - | +LL | Self::Baz: Clone, T: std::clone::Clone + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/associated-types/issue-38821.stderr b/tests/ui/associated-types/issue-38821.stderr index b29e9cc16e294..58f019704e7a7 100644 --- a/tests/ui/associated-types/issue-38821.stderr +++ b/tests/ui/associated-types/issue-38821.stderr @@ -13,9 +13,8 @@ LL | impl IntoNullable for T { | unsatisfied trait bound introduced here help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | -LL - Expr: Expression::Nullable>, -LL + Expr: Expression::Nullable>, ::SqlType: NotNull - | +LL | Expr: Expression::Nullable>, ::SqlType: NotNull + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:40:1 @@ -38,9 +37,8 @@ LL | impl IntoNullable for T { | unsatisfied trait bound introduced here help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | -LL - Expr: Expression::Nullable>, -LL + Expr: Expression::Nullable>, ::SqlType: NotNull - | +LL | Expr: Expression::Nullable>, ::SqlType: NotNull + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:23:10 diff --git a/tests/ui/associated-types/issue-54108.current.stderr b/tests/ui/associated-types/issue-54108.current.stderr index 1b2285b214fe1..8850b4548e33a 100644 --- a/tests/ui/associated-types/issue-54108.current.stderr +++ b/tests/ui/associated-types/issue-54108.current.stderr @@ -12,9 +12,8 @@ LL | type Size: Add; | ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size` help: consider further restricting the associated type | -LL - T: SubEncoder, -LL + T: SubEncoder, ::ActualSize: Add - | +LL | T: SubEncoder, ::ActualSize: Add + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/issue-54108.next.stderr b/tests/ui/associated-types/issue-54108.next.stderr index cc80ab63901e3..5e2fa551afe30 100644 --- a/tests/ui/associated-types/issue-54108.next.stderr +++ b/tests/ui/associated-types/issue-54108.next.stderr @@ -12,9 +12,8 @@ LL | type Size: Add; | ^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size` help: consider further restricting the associated type | -LL - T: SubEncoder, -LL + T: SubEncoder, ::ActualSize: Add - | +LL | T: SubEncoder, ::ActualSize: Add + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/attributes/rustc_confusables.stderr b/tests/ui/attributes/rustc_confusables.stderr index f475e9c494e0e..9ba1e3270573f 100644 --- a/tests/ui/attributes/rustc_confusables.stderr +++ b/tests/ui/attributes/rustc_confusables.stderr @@ -35,9 +35,8 @@ LL | x.inser(); | help: there is a method `insert` with a similar name | -LL - x.inser(); -LL + x.insert(); - | +LL | x.insert(); + | ~~~~~~ error[E0599]: no method named `foo` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope --> $DIR/rustc_confusables.rs:15:7 diff --git a/tests/ui/attributes/rustc_confusables_std_cases.stderr b/tests/ui/attributes/rustc_confusables_std_cases.stderr index b9acf2d31abe2..7108887043b2c 100644 --- a/tests/ui/attributes/rustc_confusables_std_cases.stderr +++ b/tests/ui/attributes/rustc_confusables_std_cases.stderr @@ -38,9 +38,8 @@ LL | let mut x = VecDeque::new(); | ----- earlier `x` shadowed here with type `VecDeque` help: you might have meant to use `push_back` | -LL - x.push(1); -LL + x.push_back(1); - | +LL | x.push_back(1); + | ~~~~~~~~~ error[E0599]: no method named `length` found for struct `Vec<{integer}>` in the current scope --> $DIR/rustc_confusables_std_cases.rs:15:7 @@ -98,9 +97,8 @@ note: method defined here --> $SRC_DIR/alloc/src/string.rs:LL:COL help: you might have meant to use `push_str` | -LL - String::new().push(""); -LL + String::new().push_str(""); - | +LL | String::new().push_str(""); + | ~~~~~~~~ error[E0599]: no method named `append` found for struct `String` in the current scope --> $DIR/rustc_confusables_std_cases.rs:24:19 diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr index 53b833e7c9194..40ab2e61d6a42 100644 --- a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr +++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr @@ -8,9 +8,8 @@ LL | self.layers.iter().fold(0, |result, mut layer| result + layer.proce | help: you may want to use `iter_mut` here | -LL - self.layers.iter().fold(0, |result, mut layer| result + layer.process()) -LL + self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process()) - | +LL | self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process()) + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr index 86d53012cf357..466f19eb0ab95 100644 --- a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr +++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr @@ -8,9 +8,8 @@ LL | vec.iter().flat_map(|container| container.things()).cloned().co | help: you may want to use `iter_mut` here | -LL - vec.iter().flat_map(|container| container.things()).cloned().collect::>(); -LL + vec.iter_mut().flat_map(|container| container.things()).cloned().collect::>(); - | +LL | vec.iter_mut().flat_map(|container| container.things()).cloned().collect::>(); + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr index f0a17d76a6787..fd58e43302025 100644 --- a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr +++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr @@ -8,9 +8,8 @@ LL | v.iter().for_each(|a| a.double()); | help: you may want to use `iter_mut` here | -LL - v.iter().for_each(|a| a.double()); -LL + v.iter_mut().for_each(|a| a.double()); - | +LL | v.iter_mut().for_each(|a| a.double()); + | ~~~~~~~~ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference --> $DIR/issue-62387-suggest-iter-mut.rs:25:39 @@ -22,9 +21,8 @@ LL | v.iter().rev().rev().for_each(|a| a.double()); | help: you may want to use `iter_mut` here | -LL - v.iter().rev().rev().for_each(|a| a.double()); -LL + v.iter_mut().rev().rev().for_each(|a| a.double()); - | +LL | v.iter_mut().rev().rev().for_each(|a| a.double()); + | ~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/c-variadic/issue-86053-1.stderr b/tests/ui/c-variadic/issue-86053-1.stderr index 4ad3b73fd661a..67a619e46d57d 100644 --- a/tests/ui/c-variadic/issue-86053-1.stderr +++ b/tests/ui/c-variadic/issue-86053-1.stderr @@ -63,9 +63,8 @@ LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize | help: a trait with a similar name exists | -LL - self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { -LL + self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) { - | +LL | self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) { + | ~~ help: you might be missing a type parameter | LL | fn ordering4 < 'a , 'b, F > ( a : , self , self , self , diff --git a/tests/ui/cfg/cfg-method-receiver.stderr b/tests/ui/cfg/cfg-method-receiver.stderr index 639413b90faa3..5767a7c1b4b1c 100644 --- a/tests/ui/cfg/cfg-method-receiver.stderr +++ b/tests/ui/cfg/cfg-method-receiver.stderr @@ -16,9 +16,8 @@ LL | cbor_map! { #[cfg(test)] 4}; = note: this error originates in the macro `cbor_map` (in Nightly builds, run with -Z macro-backtrace for more info) help: you must specify a concrete type for this numeric value, like `i32` | -LL - cbor_map! { #[cfg(test)] 4}; -LL + cbor_map! { #[cfg(test)] 4_i32}; - | +LL | cbor_map! { #[cfg(test)] 4_i32}; + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/check-cfg/diagnotics.cargo.stderr b/tests/ui/check-cfg/diagnotics.cargo.stderr index ab7111eca24ce..a75a45b7d3727 100644 --- a/tests/ui/check-cfg/diagnotics.cargo.stderr +++ b/tests/ui/check-cfg/diagnotics.cargo.stderr @@ -17,9 +17,8 @@ LL | #[cfg(featur = "foo")] = note: see for more information about checking conditional configuration help: there is a config with a similar name and value | -LL - #[cfg(featur = "foo")] -LL + #[cfg(feature = "foo")] - | +LL | #[cfg(feature = "foo")] + | ~~~~~~~ warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:17:7 diff --git a/tests/ui/check-cfg/diagnotics.rustc.stderr b/tests/ui/check-cfg/diagnotics.rustc.stderr index 4aae1f00e7067..df549b31364a3 100644 --- a/tests/ui/check-cfg/diagnotics.rustc.stderr +++ b/tests/ui/check-cfg/diagnotics.rustc.stderr @@ -19,9 +19,8 @@ LL | #[cfg(featur = "foo")] = note: see for more information about checking conditional configuration help: there is a config with a similar name and value | -LL - #[cfg(featur = "foo")] -LL + #[cfg(feature = "foo")] - | +LL | #[cfg(feature = "foo")] + | ~~~~~~~ warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:17:7 diff --git a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr index f5cbecc5704c6..b5ad8eb790f2b 100644 --- a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr +++ b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr @@ -108,9 +108,8 @@ LL | let PAT = v1; = note: the matched value is of type `u32` help: introduce a variable instead | -LL - let PAT = v1; -LL + let PAT_var = v1; - | +LL | let PAT_var = v1; + | ~~~~~~~ error: aborting due to 7 previous errors diff --git a/tests/ui/closures/issue-78720.stderr b/tests/ui/closures/issue-78720.stderr index acce1dc191a2b..5d65c87b0fd61 100644 --- a/tests/ui/closures/issue-78720.stderr +++ b/tests/ui/closures/issue-78720.stderr @@ -15,9 +15,8 @@ LL | _func: F, | help: a trait with a similar name exists | -LL - _func: F, -LL + _func: Fn, - | +LL | _func: Fn, + | ~~ help: you might be missing a type parameter | LL | struct Map2 { diff --git a/tests/ui/compare-method/bad-self-type.stderr b/tests/ui/compare-method/bad-self-type.stderr index f662b5a11cb39..0a05b0a83af4f 100644 --- a/tests/ui/compare-method/bad-self-type.stderr +++ b/tests/ui/compare-method/bad-self-type.stderr @@ -8,9 +8,8 @@ LL | fn poll(self, _: &mut Context<'_>) -> Poll<()> { found signature `fn(MyFuture, &mut Context<'_>) -> Poll<_>` help: change the self-receiver type to match the trait | -LL - fn poll(self, _: &mut Context<'_>) -> Poll<()> { -LL + fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> { - | +LL | fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> { + | ~~~~~~~~~~~~~~~~~~~~~~~~ error[E0053]: method `foo` has an incompatible type for trait --> $DIR/bad-self-type.rs:22:18 diff --git a/tests/ui/const-generics/ensure_is_evaluatable.stderr b/tests/ui/const-generics/ensure_is_evaluatable.stderr index 397902846ecb0..62f8bc34f2edd 100644 --- a/tests/ui/const-generics/ensure_is_evaluatable.stderr +++ b/tests/ui/const-generics/ensure_is_evaluatable.stderr @@ -14,9 +14,8 @@ LL | [(); N + 1]:, | ^^^^^ required by this bound in `bar` help: try adding a `where` bound | -LL - [(); M + 1]:, -LL + [(); M + 1]:, [(); N + 1]: - | +LL | [(); M + 1]:, [(); N + 1]: + | ~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/fn_with_two_const_inputs.stderr b/tests/ui/const-generics/fn_with_two_const_inputs.stderr index 147a2c91fd075..c0a913a21fd2d 100644 --- a/tests/ui/const-generics/fn_with_two_const_inputs.stderr +++ b/tests/ui/const-generics/fn_with_two_const_inputs.stderr @@ -14,9 +14,8 @@ LL | [(); N + 1]:, | ^^^^^ required by this bound in `bar` help: try adding a `where` bound | -LL - [(); both(N + 1, M + 1)]:, -LL + [(); both(N + 1, M + 1)]:, [(); N + 1]: - | +LL | [(); both(N + 1, M + 1)]:, [(); N + 1]: + | ~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr index 9cb71ad8a0966..3622ef16a9608 100644 --- a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr +++ b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr @@ -16,9 +16,8 @@ LL | fn assert_impl() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL - EvaluatableU128<{N as u128}>:, { -LL + EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { - | +LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:17:5 @@ -52,9 +51,8 @@ LL | fn assert_impl() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL - EvaluatableU128<{N as u128}>:, { -LL + EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { - | +LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:20:5 @@ -116,9 +114,8 @@ LL | fn assert_impl() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL - EvaluatableU128<{N as _}>:, { -LL + EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { - | +LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:35:5 @@ -152,9 +149,8 @@ LL | fn assert_impl() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL - EvaluatableU128<{N as _}>:, { -LL + EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { - | +LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:38:5 diff --git a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr index b43ce5eca4359..f3a38fcc00544 100644 --- a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr +++ b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr @@ -6,9 +6,8 @@ LL | bar::<{ T::ASSOC }>(); | help: try adding a `where` bound | -LL - fn foo() where [(); U::ASSOC]:, { -LL + fn foo() where [(); U::ASSOC]:, [(); { T::ASSOC }]: { - | +LL | fn foo() where [(); U::ASSOC]:, [(); { T::ASSOC }]: { + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr index 86e35e17a0771..4d1fb02b59e91 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr @@ -26,9 +26,8 @@ LL | foo::<_, L>([(); L + 1 + L]); | help: try adding a `where` bound | -LL - [(); (L - 1) + 1 + L]:, -LL + [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: - | +LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: + | ~~~~~~~~~~~~~~~~~~ error: unconstrained generic constant --> $DIR/issue_114151.rs:17:17 diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr index c63a79e64ed94..99eab935a094c 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr @@ -15,9 +15,8 @@ LL | foo::<_, L>([(); L + 1 + L]); | help: try adding a `where` bound | -LL - [(); (L - 1) + 1 + L]:, -LL + [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: - | +LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr index c63beeac367b0..86fbca585057a 100644 --- a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr +++ b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr @@ -9,9 +9,8 @@ LL | let f: F = async { 1 }; | help: a trait with a similar name exists | -LL - let f: F = async { 1 }; -LL + let f: Fn = async { 1 }; - | +LL | let f: Fn = async { 1 }; + | ~~ help: you might be missing a type parameter | LL | fn f( diff --git a/tests/ui/consts/const-pattern-irrefutable.stderr b/tests/ui/consts/const-pattern-irrefutable.stderr index a97e35e385fa5..4fa8caa57ce6e 100644 --- a/tests/ui/consts/const-pattern-irrefutable.stderr +++ b/tests/ui/consts/const-pattern-irrefutable.stderr @@ -12,9 +12,8 @@ LL | let a = 4; = note: the matched value is of type `u8` help: introduce a variable instead | -LL - let a = 4; -LL + let a_var = 4; - | +LL | let a_var = 4; + | ~~~~~ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:28:9 @@ -48,9 +47,8 @@ LL | let d = (4, 4); = note: the matched value is of type `(u8, u8)` help: introduce a variable instead | -LL - let d = (4, 4); -LL + let d_var = (4, 4); - | +LL | let d_var = (4, 4); + | ~~~~~ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:36:9 @@ -71,9 +69,8 @@ LL | struct S { = note: the matched value is of type `S` help: introduce a variable instead | -LL - let e = S { -LL + let e_var = S { - | +LL | let e_var = S { + | ~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr index 72b65006a3fb5..473c9a339fc25 100644 --- a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr +++ b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr @@ -10,9 +10,8 @@ LL | const CRATE: Crate = Crate { fiel: () }; = note: this error originates in the macro `environment` (in Nightly builds, run with -Z macro-backtrace for more info) help: a field with a similar name exists | -LL - const CRATE: Crate = Crate { fiel: () }; -LL + const CRATE: Crate = Crate { field: () }; - | +LL | const CRATE: Crate = Crate { field: () }; + | ~~~~~ error[E0609]: no field `field` on type `Compound` --> $DIR/dont-suggest-hygienic-fields.rs:24:16 diff --git a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr index 650244ac02a9e..2caa779ffabac 100644 --- a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr +++ b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr @@ -11,9 +11,8 @@ LL | struct DropMe(T); | ^^^^ required by this bound in `DropMe` help: consider further restricting type parameter `T` with trait `Copy` | -LL - [T; 1]: Copy, // But `[T; 1]: Copy` does not imply `T: Copy` -LL + [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` - | +LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` + | ~~~~~~~~~~~~~~~~~~~~~~ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/explicit-drop-bounds.rs:32:18 @@ -28,9 +27,8 @@ LL | struct DropMe(T); | ^^^^ required by this bound in `DropMe` help: consider further restricting type parameter `T` with trait `Copy` | -LL - [T; 1]: Copy, // But `[T; 1]: Copy` does not imply `T: Copy` -LL + [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` - | +LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr index c54cc858129c3..774d5ba3c892c 100644 --- a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr +++ b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr @@ -67,9 +67,8 @@ LL | fn wants_write(_: impl Write) {} | ^^^^^ required by this bound in `wants_write` help: consider changing this borrow's mutability | -LL - wants_write(&[0u8][..]); -LL + wants_write(&mut [0u8][..]); - | +LL | wants_write(&mut [0u8][..]); + | ~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/empty/empty-struct-braces-expr.stderr b/tests/ui/empty/empty-struct-braces-expr.stderr index 3411702a12dfb..140b6e009b7a2 100644 --- a/tests/ui/empty/empty-struct-braces-expr.stderr +++ b/tests/ui/empty/empty-struct-braces-expr.stderr @@ -14,9 +14,8 @@ LL | pub struct XEmpty2; | help: use struct literal syntax instead | -LL - let e1 = Empty1; -LL + let e1 = Empty1 {}; - | +LL | let e1 = Empty1 {}; + | ~~~~~~~~~ help: a unit struct with a similar name exists | LL - let e1 = Empty1; @@ -38,9 +37,8 @@ LL | pub struct XEmpty2; | help: use struct literal syntax instead | -LL - let xe1 = XEmpty1; -LL + let xe1 = XEmpty1 {}; - | +LL | let xe1 = XEmpty1 {}; + | ~~~~~~~~~~ help: a unit struct with a similar name exists | LL - let xe1 = XEmpty1; diff --git a/tests/ui/empty/empty-struct-tuple-pat.stderr b/tests/ui/empty/empty-struct-tuple-pat.stderr index 3906a0e20608a..19e44bacaa079 100644 --- a/tests/ui/empty/empty-struct-tuple-pat.stderr +++ b/tests/ui/empty/empty-struct-tuple-pat.stderr @@ -46,9 +46,8 @@ LL | XEmpty5(), | help: use the tuple variant pattern syntax instead | -LL - XE::XEmpty5 => (), -LL + XE::XEmpty5() => (), - | +LL | XE::XEmpty5() => (), + | ~~~~~~~~~~~~~ help: a unit variant with a similar name exists | LL - XE::XEmpty5 => (), diff --git a/tests/ui/extern/not-in-block.stderr b/tests/ui/extern/not-in-block.stderr index f35d98e994889..cd1cd0fa50e64 100644 --- a/tests/ui/extern/not-in-block.stderr +++ b/tests/ui/extern/not-in-block.stderr @@ -11,9 +11,8 @@ LL + extern fn none_fn(x: bool) -> i32 { } | help: if you meant to declare an externally defined function, use an `extern` block | -LL - extern fn none_fn(x: bool) -> i32; -LL + extern { fn none_fn(x: bool) -> i32; } - | +LL | extern { fn none_fn(x: bool) -> i32; } + | ~~~~~~~~ + error: free function without a body --> $DIR/not-in-block.rs:6:1 @@ -28,9 +27,8 @@ LL + extern "C" fn c_fn(x: bool) -> i32 { } | help: if you meant to declare an externally defined function, use an `extern` block | -LL - extern "C" fn c_fn(x: bool) -> i32; -LL + extern "C" { fn c_fn(x: bool) -> i32; } - | +LL | extern "C" { fn c_fn(x: bool) -> i32; } + | ~~~~~~~~~~~~ + error: aborting due to 2 previous errors diff --git a/tests/ui/fmt/no-inline-literals-out-of-range.stderr b/tests/ui/fmt/no-inline-literals-out-of-range.stderr index 78047eabf4993..25486b8547295 100644 --- a/tests/ui/fmt/no-inline-literals-out-of-range.stderr +++ b/tests/ui/fmt/no-inline-literals-out-of-range.stderr @@ -51,9 +51,8 @@ LL | format_args!("{}", 0xffff_ffff); // treat unsuffixed literals as i32 = help: consider using the type `u32` instead help: to use as a negative number (decimal `-1`), consider using the type `u32` for the literal and cast it to `i32` | -LL - format_args!("{}", 0xffff_ffff); // treat unsuffixed literals as i32 -LL + format_args!("{}", 0xffff_ffffu32 as i32); // treat unsuffixed literals as i32 - | +LL | format_args!("{}", 0xffff_ffffu32 as i32); // treat unsuffixed literals as i32 + | ~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/impl-trait/no-method-suggested-traits.stderr b/tests/ui/impl-trait/no-method-suggested-traits.stderr index af6d492c74d16..676247d1a423b 100644 --- a/tests/ui/impl-trait/no-method-suggested-traits.stderr +++ b/tests/ui/impl-trait/no-method-suggested-traits.stderr @@ -17,9 +17,8 @@ LL + use no_method_suggested_traits::qux::PrivPub; | help: there is a method `method2` with a similar name | -LL - 1u32.method(); -LL + 1u32.method2(); - | +LL | 1u32.method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Rc<&mut Box<&u32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:26:44 @@ -40,9 +39,8 @@ LL + use no_method_suggested_traits::qux::PrivPub; | help: there is a method `method2` with a similar name | -LL - std::rc::Rc::new(&mut Box::new(&1u32)).method(); -LL + std::rc::Rc::new(&mut Box::new(&1u32)).method2(); - | +LL | std::rc::Rc::new(&mut Box::new(&1u32)).method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for type `char` in the current scope --> $DIR/no-method-suggested-traits.rs:30:9 @@ -60,9 +58,8 @@ LL + use foo::Bar; | help: there is a method `method2` with a similar name | -LL - 'a'.method(); -LL + 'a'.method2(); - | +LL | 'a'.method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Rc<&mut Box<&char>>` in the current scope --> $DIR/no-method-suggested-traits.rs:32:43 @@ -77,9 +74,8 @@ LL + use foo::Bar; | help: there is a method `method2` with a similar name | -LL - std::rc::Rc::new(&mut Box::new(&'a')).method(); -LL + std::rc::Rc::new(&mut Box::new(&'a')).method2(); - | +LL | std::rc::Rc::new(&mut Box::new(&'a')).method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for type `i32` in the current scope --> $DIR/no-method-suggested-traits.rs:35:10 @@ -99,9 +95,8 @@ LL + use no_method_suggested_traits::foo::PubPub; | help: there is a method `method3` with a similar name | -LL - 1i32.method(); -LL + 1i32.method3(); - | +LL | 1i32.method3(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Rc<&mut Box<&i32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:37:44 @@ -116,9 +111,8 @@ LL + use no_method_suggested_traits::foo::PubPub; | help: there is a method `method3` with a similar name | -LL - std::rc::Rc::new(&mut Box::new(&1i32)).method(); -LL + std::rc::Rc::new(&mut Box::new(&1i32)).method3(); - | +LL | std::rc::Rc::new(&mut Box::new(&1i32)).method3(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Foo` in the current scope --> $DIR/no-method-suggested-traits.rs:40:9 diff --git a/tests/ui/imports/glob-resolve1.stderr b/tests/ui/imports/glob-resolve1.stderr index 6a48e36d37894..4401ef58732e8 100644 --- a/tests/ui/imports/glob-resolve1.stderr +++ b/tests/ui/imports/glob-resolve1.stderr @@ -37,9 +37,8 @@ LL | | } | |_____^ help: you might have meant to use the following enum variant | -LL - B; -LL + B::B1; - | +LL | B::B1; + | ~~~~~ error[E0425]: cannot find value `C` in this scope --> $DIR/glob-resolve1.rs:29:5 diff --git a/tests/ui/imports/issue-45829/import-self.stderr b/tests/ui/imports/issue-45829/import-self.stderr index 62bc559b77866..f15beac5e16da 100644 --- a/tests/ui/imports/issue-45829/import-self.stderr +++ b/tests/ui/imports/issue-45829/import-self.stderr @@ -32,9 +32,8 @@ LL | use foo::{self}; = note: `foo` must be defined only once in the type namespace of this module help: you can use `as` to change the binding name of the import | -LL - use foo::{self}; -LL + use foo::{self as other_foo}; - | +LL | use foo::{self as other_foo}; + | ~~~~~~~~~~~~~~~~~ error[E0255]: the name `foo` is defined multiple times --> $DIR/import-self.rs:12:5 diff --git a/tests/ui/issues/issue-32004.stderr b/tests/ui/issues/issue-32004.stderr index 88395cd852092..6fa548015fa28 100644 --- a/tests/ui/issues/issue-32004.stderr +++ b/tests/ui/issues/issue-32004.stderr @@ -11,9 +11,8 @@ LL | Foo::Bar => {} | help: use the tuple variant pattern syntax instead | -LL - Foo::Bar => {} -LL + Foo::Bar(_) => {} - | +LL | Foo::Bar(_) => {} + | ~~~~~~~~~~~ help: a unit variant with a similar name exists | LL - Foo::Bar => {} diff --git a/tests/ui/issues/issue-41652/issue-41652.stderr b/tests/ui/issues/issue-41652/issue-41652.stderr index c8299f28d3454..a5a2fab2ede03 100644 --- a/tests/ui/issues/issue-41652/issue-41652.stderr +++ b/tests/ui/issues/issue-41652/issue-41652.stderr @@ -6,9 +6,8 @@ LL | 3.f() | help: you must specify a concrete type for this numeric value, like `i32` | -LL - 3.f() -LL + 3_i32.f() - | +LL | 3_i32.f() + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-51874.stderr b/tests/ui/issues/issue-51874.stderr index 18328450145b2..5be3695dd4548 100644 --- a/tests/ui/issues/issue-51874.stderr +++ b/tests/ui/issues/issue-51874.stderr @@ -6,9 +6,8 @@ LL | let a = (1.0).pow(1.0); | help: you must specify a concrete type for this numeric value, like `f32` | -LL - let a = (1.0).pow(1.0); -LL + let a = (1.0_f32).pow(1.0); - | +LL | let a = (1.0_f32).pow(1.0); + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-5358-1.stderr b/tests/ui/issues/issue-5358-1.stderr index f598cf33911f3..1bb946ce4cb54 100644 --- a/tests/ui/issues/issue-5358-1.stderr +++ b/tests/ui/issues/issue-5358-1.stderr @@ -14,9 +14,8 @@ LL | S(Either::Right(_)) => {} | ++ + help: you might have meant to use field `0` whose type is `Either` | -LL - match S(Either::Left(5)) { -LL + match S(Either::Left(5)).0 { - | +LL | match S(Either::Left(5)).0 { + | ~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-56175.stderr b/tests/ui/issues/issue-56175.stderr index 695aa2ac79696..50c26b83dd379 100644 --- a/tests/ui/issues/issue-56175.stderr +++ b/tests/ui/issues/issue-56175.stderr @@ -16,9 +16,8 @@ LL + use reexported_trait::Trait; | help: there is a method `trait_method_b` with a similar name | -LL - reexported_trait::FooStruct.trait_method(); -LL + reexported_trait::FooStruct.trait_method_b(); - | +LL | reexported_trait::FooStruct.trait_method_b(); + | ~~~~~~~~~~~~~~ error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope --> $DIR/issue-56175.rs:7:33 diff --git a/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr b/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr index a244d7604d7cf..59f473b14d80c 100644 --- a/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr +++ b/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr @@ -11,9 +11,8 @@ LL | #![deny(let_underscore_drop)] | ^^^^^^^^^^^^^^^^^^^ help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = foo(); -LL + let _unused = foo(); - | +LL | let _unused = foo(); + | ~~~~~~~ help: consider immediately dropping the value | LL - let _ = foo(); diff --git a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr index 8773d5df44310..3cef341ddb008 100644 --- a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr +++ b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr @@ -28,9 +28,8 @@ LL | let _ = field; | help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = field; -LL + let _unused = field; - | +LL | let _unused = field; + | ~~~~~~~ help: consider immediately dropping the value | LL - let _ = field; diff --git a/tests/ui/lint/let_underscore/let_underscore_drop.stderr b/tests/ui/lint/let_underscore/let_underscore_drop.stderr index c7984d629daa0..a326cd4fec4f3 100644 --- a/tests/ui/lint/let_underscore/let_underscore_drop.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_drop.stderr @@ -11,9 +11,8 @@ LL | #![warn(let_underscore_drop)] | ^^^^^^^^^^^^^^^^^^^ help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = NontrivialDrop; -LL + let _unused = NontrivialDrop; - | +LL | let _unused = NontrivialDrop; + | ~~~~~~~ help: consider immediately dropping the value | LL - let _ = NontrivialDrop; diff --git a/tests/ui/lint/let_underscore/let_underscore_lock.stderr b/tests/ui/lint/let_underscore/let_underscore_lock.stderr index 60d5ed649f5ee..90f661d379e64 100644 --- a/tests/ui/lint/let_underscore/let_underscore_lock.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_lock.stderr @@ -7,9 +7,8 @@ LL | let _ = data.lock().unwrap(); = note: `#[deny(let_underscore_lock)]` on by default help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = data.lock().unwrap(); -LL + let _unused = data.lock().unwrap(); - | +LL | let _unused = data.lock().unwrap(); + | ~~~~~~~ help: consider immediately dropping the value | LL - let _ = data.lock().unwrap(); @@ -24,9 +23,8 @@ LL | let _ = data.lock(); | help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let _ = data.lock(); -LL + let _unused = data.lock(); - | +LL | let _unused = data.lock(); + | ~~~~~~~ help: consider immediately dropping the value | LL - let _ = data.lock(); @@ -42,9 +40,8 @@ LL | let (_, _) = (data.lock(), 1); = help: consider immediately dropping the value using `drop(..)` after the `let` statement help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let (_, _) = (data.lock(), 1); -LL + let (_unused, _) = (data.lock(), 1); - | +LL | let (_unused, _) = (data.lock(), 1); + | ~~~~~~~ error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:16:26 @@ -55,9 +52,8 @@ LL | let (_a, Struct { a: _ }) = (0, Struct { a: data.lock() }); = help: consider immediately dropping the value using `drop(..)` after the `let` statement help: consider binding to an unused variable to avoid immediately dropping the value | -LL - let (_a, Struct { a: _ }) = (0, Struct { a: data.lock() }); -LL + let (_a, Struct { a: _unused }) = (0, Struct { a: data.lock() }); - | +LL | let (_a, Struct { a: _unused }) = (0, Struct { a: data.lock() }); + | ~~~~~~~ error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:18:6 diff --git a/tests/ui/lint/static-mut-refs.e2021.stderr b/tests/ui/lint/static-mut-refs.e2021.stderr index abd579b336f07..39a4056dd7f44 100644 --- a/tests/ui/lint/static-mut-refs.e2021.stderr +++ b/tests/ui/lint/static-mut-refs.e2021.stderr @@ -9,9 +9,8 @@ LL | let _y = &X; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - let _y = &X; -LL + let _y = &raw const X; - | +LL | let _y = &raw const X; + | ~~~~~~~~~~ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:42:18 @@ -46,9 +45,8 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let (_b, _c) = (&X, &Y); -LL + let (_b, _c) = (&raw const X, &Y); - | +LL | let (_b, _c) = (&raw const X, &Y); + | ~~~~~~~~~~ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:54:29 @@ -60,9 +58,8 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let (_b, _c) = (&X, &Y); -LL + let (_b, _c) = (&X, &raw const Y); - | +LL | let (_b, _c) = (&X, &raw const Y); + | ~~~~~~~~~~ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:60:13 @@ -74,9 +71,8 @@ LL | foo(&X); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - foo(&X); -LL + foo(&raw const X); - | +LL | foo(&raw const X); + | ~~~~~~~~~~ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:66:17 @@ -106,9 +102,8 @@ LL | let _v = &A.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let _v = &A.value; -LL + let _v = &raw const A.value; - | +LL | let _v = &raw const A.value; + | ~~~~~~~~~~ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:80:18 @@ -120,9 +115,8 @@ LL | let _s = &A.s.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let _s = &A.s.value; -LL + let _s = &raw const A.s.value; - | +LL | let _s = &raw const A.s.value; + | ~~~~~~~~~~ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:84:22 diff --git a/tests/ui/lint/static-mut-refs.e2024.stderr b/tests/ui/lint/static-mut-refs.e2024.stderr index 1387cdf0b3240..51eaf2785d151 100644 --- a/tests/ui/lint/static-mut-refs.e2024.stderr +++ b/tests/ui/lint/static-mut-refs.e2024.stderr @@ -9,9 +9,8 @@ LL | let _y = &X; = note: `#[deny(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - let _y = &X; -LL + let _y = &raw const X; - | +LL | let _y = &raw const X; + | ~~~~~~~~~~ error: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:42:18 @@ -46,9 +45,8 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let (_b, _c) = (&X, &Y); -LL + let (_b, _c) = (&raw const X, &Y); - | +LL | let (_b, _c) = (&raw const X, &Y); + | ~~~~~~~~~~ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:54:29 @@ -60,9 +58,8 @@ LL | let (_b, _c) = (&X, &Y); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let (_b, _c) = (&X, &Y); -LL + let (_b, _c) = (&X, &raw const Y); - | +LL | let (_b, _c) = (&X, &raw const Y); + | ~~~~~~~~~~ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:60:13 @@ -74,9 +71,8 @@ LL | foo(&X); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - foo(&X); -LL + foo(&raw const X); - | +LL | foo(&raw const X); + | ~~~~~~~~~~ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:66:17 @@ -106,9 +102,8 @@ LL | let _v = &A.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let _v = &A.value; -LL + let _v = &raw const A.value; - | +LL | let _v = &raw const A.value; + | ~~~~~~~~~~ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:80:18 @@ -120,9 +115,8 @@ LL | let _s = &A.s.value; = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - let _s = &A.s.value; -LL + let _s = &raw const A.s.value; - | +LL | let _s = &raw const A.s.value; + | ~~~~~~~~~~ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:84:22 diff --git a/tests/ui/lint/type-overflow.stderr b/tests/ui/lint/type-overflow.stderr index 0ac67fddaa72a..4e68e7ee80f0c 100644 --- a/tests/ui/lint/type-overflow.stderr +++ b/tests/ui/lint/type-overflow.stderr @@ -66,9 +66,8 @@ LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; = help: consider using the type `u128` instead help: to use as a negative number (decimal `-170141183460469231731687303715884105728`), consider using the type `u128` for the literal and cast it to `i128` | -LL - let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; -LL + let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000u128 as i128; - | +LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000u128 as i128; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: literal out of range for `i32` --> $DIR/type-overflow.rs:27:16 @@ -117,9 +116,8 @@ LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; = help: consider using the type `u64` instead help: to use as a negative number (decimal `-2`), consider using the type `u32` for the literal and cast it to `i32` | -LL - let fail = 0x8FFF_FFFF_FFFF_FFFE; -LL + let fail = 0x8FFF_FFFF_FFFF_FFFEu32 as i32; - | +LL | let fail = 0x8FFF_FFFF_FFFF_FFFEu32 as i32; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ warning: literal out of range for `i8` --> $DIR/type-overflow.rs:46:17 diff --git a/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr b/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr index 8922f484d3e92..a5bd396f73ff1 100644 --- a/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr +++ b/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr @@ -12,9 +12,8 @@ LL | #![deny(unused)] = note: `#[deny(unused_variables)]` implied by `#[deny(unused)]` help: try ignoring the field | -LL - A { i, j } | B { i, j } => { -LL + A { i, j: _ } | B { i, j: _ } => { - | +LL | A { i, j: _ } | B { i, j: _ } => { + | ~~~~ ~~~~ error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:30:16 @@ -36,9 +35,8 @@ LL | Some(A { i, j } | B { i, j }) => { | help: try ignoring the field | -LL - Some(A { i, j } | B { i, j }) => { -LL + Some(A { i, j: _ } | B { i, j: _ }) => { - | +LL | Some(A { i, j: _ } | B { i, j: _ }) => { + | ~~~~ ~~~~ error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:52:21 diff --git a/tests/ui/lint/wide_pointer_comparisons.stderr b/tests/ui/lint/wide_pointer_comparisons.stderr index f5f8060902bdc..5a0b914d8320e 100644 --- a/tests/ui/lint/wide_pointer_comparisons.stderr +++ b/tests/ui/lint/wide_pointer_comparisons.stderr @@ -627,9 +627,8 @@ LL | cmp!(a, b); | help: use `std::ptr::addr_eq` or untyped pointers to only compare their addresses | -LL - cmp!(a, b); -LL + cmp!(std::ptr::addr_eq(a, b)); - | +LL | cmp!(std::ptr::addr_eq(a, b)); + | ++++++++++++++++++ + warning: ambiguous wide pointer comparison, the comparison includes metadata which may not be expected --> $DIR/wide_pointer_comparisons.rs:159:39 diff --git a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr index 8ab6938fe19c8..fe1fd4a26a028 100644 --- a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr +++ b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr @@ -13,9 +13,8 @@ LL | #![warn(edition_2024_expr_fragment_specifier)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: to keep the existing behavior, use the `expr_2021` fragment specifier | -LL - ($e:expr) => { -LL + ($e:expr_2021) => { - | +LL | ($e:expr_2021) => { + | ~~~~~~~~~ warning: the `expr` fragment specifier will accept more expressions in the 2024 edition --> $DIR/expr_2021_cargo_fix_edition.rs:11:11 @@ -27,9 +26,8 @@ LL | ($($i:expr)*) => { }; = note: for more information, see Migration Guide help: to keep the existing behavior, use the `expr_2021` fragment specifier | -LL - ($($i:expr)*) => { }; -LL + ($($i:expr_2021)*) => { }; - | +LL | ($($i:expr_2021)*) => { }; + | ~~~~~~~~~ warning: 2 warnings emitted diff --git a/tests/ui/macros/macro-backtrace-invalid-internals.stderr b/tests/ui/macros/macro-backtrace-invalid-internals.stderr index bb8250d58b06c..aa8f06a0df13b 100644 --- a/tests/ui/macros/macro-backtrace-invalid-internals.stderr +++ b/tests/ui/macros/macro-backtrace-invalid-internals.stderr @@ -43,9 +43,8 @@ LL | real_method_stmt!(); = note: this error originates in the macro `real_method_stmt` (in Nightly builds, run with -Z macro-backtrace for more info) help: you must specify a concrete type for this numeric value, like `f32` | -LL - 2.0.neg() -LL + 2.0_f32.neg() - | +LL | 2.0_f32.neg() + | ~~~~~~~ error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:23:13 @@ -92,9 +91,8 @@ LL | let _ = real_method_expr!(); = note: this error originates in the macro `real_method_expr` (in Nightly builds, run with -Z macro-backtrace for more info) help: you must specify a concrete type for this numeric value, like `f32` | -LL - 2.0.neg() -LL + 2.0_f32.neg() - | +LL | 2.0_f32.neg() + | ~~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/methods/issues/issue-90315.stderr b/tests/ui/methods/issues/issue-90315.stderr index e194a9188342f..0466bb0a0c997 100644 --- a/tests/ui/methods/issues/issue-90315.stderr +++ b/tests/ui/methods/issues/issue-90315.stderr @@ -181,9 +181,8 @@ LL | let _res: i32 = ..6.take(2).sum(); | help: you must specify a concrete type for this numeric value, like `i32` | -LL - let _res: i32 = ..6.take(2).sum(); -LL + let _res: i32 = ..6_i32.take(2).sum(); - | +LL | let _res: i32 = ..6_i32.take(2).sum(); + | ~~~~~ error: aborting due to 18 previous errors diff --git a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr index d688bcc90c8d3..124270402727d 100644 --- a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr +++ b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr @@ -6,9 +6,8 @@ LL | let x = 2.0.neg(); | help: you must specify a concrete type for this numeric value, like `f32` | -LL - let x = 2.0.neg(); -LL + let x = 2.0_f32.neg(); - | +LL | let x = 2.0_f32.neg(); + | ~~~~~~~ error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` --> $DIR/method-on-ambiguous-numeric-type.rs:17:15 diff --git a/tests/ui/mir/issue-112269.stderr b/tests/ui/mir/issue-112269.stderr index 29b69cb7e2083..80f329e2ce026 100644 --- a/tests/ui/mir/issue-112269.stderr +++ b/tests/ui/mir/issue-112269.stderr @@ -11,9 +11,8 @@ LL | let x: i32 = 3; = note: the matched value is of type `i32` help: introduce a variable instead | -LL - let x: i32 = 3; -LL + let x_var: i32 = 3; - | +LL | let x_var: i32 = 3; + | ~~~~~ error[E0005]: refutable pattern in local binding --> $DIR/issue-112269.rs:7:9 @@ -28,9 +27,8 @@ LL | let y = 4; = note: the matched value is of type `i32` help: introduce a variable instead | -LL - let y = 4; -LL + let y_var = 4; - | +LL | let y_var = 4; + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr index 62f087ca6b736..784945dbbaeae 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr @@ -195,9 +195,8 @@ LL | [t, t]; | - you could clone this value help: consider further restricting type parameter `T` with trait `Copy` | -LL - T:, -LL + T:, T: Copy - | +LL | T:, T: Copy + | ~~~~~~~~~ error: aborting due to 11 previous errors diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr index 980670fee6973..4f93fb4eaea34 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -33,9 +33,8 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | help: consider adding an explicit lifetime bound | -LL - T: Iterator, -LL + T: Iterator, ::Item: 'a - | +LL | T: Iterator, ::Item: 'a + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: external requirements --> $DIR/projection-no-regions-closure.rs:34:23 @@ -96,9 +95,8 @@ LL | with_signature(x, |mut y| Box::new(y.next())) | help: consider adding an explicit lifetime bound | -LL - T: 'b + Iterator, -LL + T: 'b + Iterator, ::Item: 'a - | +LL | T: 'b + Iterator, ::Item: 'a + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: external requirements --> $DIR/projection-no-regions-closure.rs:52:23 diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr index 53da981d70298..da76ac1c474a3 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr @@ -9,9 +9,8 @@ LL | Box::new(x.next()) | help: consider adding an explicit lifetime bound | -LL - T: Iterator, -LL + T: Iterator, ::Item: 'a - | +LL | T: Iterator, ::Item: 'a + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0309]: the associated type `::Item` may not live long enough --> $DIR/projection-no-regions-fn.rs:28:5 @@ -24,9 +23,8 @@ LL | Box::new(x.next()) | help: consider adding an explicit lifetime bound | -LL - T: 'b + Iterator, -LL + T: 'b + Iterator, ::Item: 'a - | +LL | T: 'b + Iterator, ::Item: 'a + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index 34498f68f6795..9eff4bb8c6cd5 100644 --- a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -34,9 +34,8 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | help: consider adding an explicit lifetime bound | -LL - T: Anything<'b, 'c>, -LL + T: Anything<'b, 'c>, >::AssocType: 'a - | +LL | T: Anything<'b, 'c>, >::AssocType: 'a + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:48:29 @@ -74,9 +73,8 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); | help: consider adding an explicit lifetime bound | -LL - 'a: 'a, -LL + 'a: 'a, >::AssocType: 'a - | +LL | 'a: 'a, >::AssocType: 'a + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:61:29 diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr index a53c01e506e50..dfc024baed787 100644 --- a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr +++ b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr @@ -9,9 +9,8 @@ LL | bar::() | help: consider adding an explicit lifetime bound | -LL - >::Output: 'b, -LL + >::Output: 'b, >::Output: 'a - | +LL | >::Output: 'b, >::Output: 'a + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr index 36a0f40246e8a..a43b4629cc304 100644 --- a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr +++ b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr @@ -9,9 +9,8 @@ LL | bar::<>::Output>() | help: consider adding an explicit lifetime bound | -LL - >::Output: 'a, -LL + >::Output: 'a, >::Output: 'a - | +LL | >::Output: 'a, >::Output: 'a + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/char/whitespace-character-literal.stderr b/tests/ui/parser/char/whitespace-character-literal.stderr index 53f2eb3ecbab2..f273b5d61d57f 100644 --- a/tests/ui/parser/char/whitespace-character-literal.stderr +++ b/tests/ui/parser/char/whitespace-character-literal.stderr @@ -11,9 +11,8 @@ LL | let _hair_space_around = ' x​'; | ^^ help: consider removing the non-printing characters | -LL - let _hair_space_around = ' x​'; -LL + let _hair_space_around = 'x​'; - | +LL | let _hair_space_around = 'x​'; + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/extern-no-fn.stderr b/tests/ui/parser/extern-no-fn.stderr index 2ee905429c4ab..03826e4a93b7a 100644 --- a/tests/ui/parser/extern-no-fn.stderr +++ b/tests/ui/parser/extern-no-fn.stderr @@ -11,9 +11,8 @@ LL | } | help: if you meant to call a macro, try | -LL - f(); -LL + f!(); - | +LL | f!(); + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr index fa84836894599..f6330e51e0dce 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr @@ -8,9 +8,8 @@ LL | Foo:Bar => {} | help: maybe write a path separator here | -LL - Foo:Bar => {} -LL + Foo::Bar => {} - | +LL | Foo::Bar => {} + | ~~ error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `{`, or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:23:17 @@ -22,9 +21,8 @@ LL | qux::Foo:Bar => {} | help: maybe write a path separator here | -LL - qux::Foo:Bar => {} -LL + qux::Foo::Bar => {} - | +LL | qux::Foo::Bar => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:29:12 @@ -36,9 +34,8 @@ LL | qux:Foo::Baz => {} | help: maybe write a path separator here | -LL - qux:Foo::Baz => {} -LL + qux::Foo::Baz => {} - | +LL | qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:35:12 @@ -64,9 +61,8 @@ LL | if let Foo:Bar = f() { | help: maybe write a path separator here | -LL - if let Foo:Bar = f() { -LL + if let Foo::Bar = f() { - | +LL | if let Foo::Bar = f() { + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:49:16 @@ -106,9 +102,8 @@ LL | Foo:Bar::Baz => {} | help: maybe write a path separator here | -LL - Foo:Bar::Baz => {} -LL + Foo::Bar::Baz => {} - | +LL | Foo::Bar::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:75:12 @@ -120,9 +115,8 @@ LL | Foo:Bar => {} | help: maybe write a path separator here | -LL - Foo:Bar => {} -LL + Foo::Bar => {} - | +LL | Foo::Bar => {} + | ~~ warning: irrefutable `if let` pattern --> $DIR/issue-87086-colon-path-sep.rs:40:8 diff --git a/tests/ui/parser/missing-fn-issue-65381-2.stderr b/tests/ui/parser/missing-fn-issue-65381-2.stderr index ba2cf497df23e..e13d395d70d7f 100644 --- a/tests/ui/parser/missing-fn-issue-65381-2.stderr +++ b/tests/ui/parser/missing-fn-issue-65381-2.stderr @@ -6,9 +6,8 @@ LL | main(); | help: if you meant to call a macro, try | -LL - main(); -LL + main!(); - | +LL | main!(); + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/const.stderr b/tests/ui/parser/misspelled-keywords/const.stderr index ca76f51f4ed31..35e4d731db768 100644 --- a/tests/ui/parser/misspelled-keywords/const.stderr +++ b/tests/ui/parser/misspelled-keywords/const.stderr @@ -6,9 +6,8 @@ LL | cons A: u8 = 10; | help: there is a keyword `const` with a similar name | -LL - cons A: u8 = 10; -LL + const A: u8 = 10; - | +LL | const A: u8 = 10; + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr index 15866211954bf..551b2e3ff09b0 100644 --- a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr +++ b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr @@ -7,9 +7,8 @@ LL | let x = Tr; = note: type ascription syntax has been removed, see issue #101728 help: maybe write a path separator here | -LL - let x = Tr; -LL + let x = Tr; - | +LL | let x = Tr; + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/use-colon-as-mod-sep.stderr b/tests/ui/parser/use-colon-as-mod-sep.stderr index f25a779f31f3b..347b271df9900 100644 --- a/tests/ui/parser/use-colon-as-mod-sep.stderr +++ b/tests/ui/parser/use-colon-as-mod-sep.stderr @@ -7,9 +7,8 @@ LL | use std::process:Command; = note: import paths are delimited using `::` help: use double colon | -LL - use std::process:Command; -LL + use std::process::Command; - | +LL | use std::process::Command; + | ~~ error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:5:8 @@ -20,9 +19,8 @@ LL | use std:fs::File; = note: import paths are delimited using `::` help: use double colon | -LL - use std:fs::File; -LL + use std::fs::File; - | +LL | use std::fs::File; + | ~~ error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:8 @@ -33,9 +31,8 @@ LL | use std:collections:HashMap; = note: import paths are delimited using `::` help: use double colon | -LL - use std:collections:HashMap; -LL + use std::collections:HashMap; - | +LL | use std::collections:HashMap; + | ~~ error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:20 @@ -46,9 +43,8 @@ LL | use std:collections:HashMap; = note: import paths are delimited using `::` help: use double colon | -LL - use std:collections:HashMap; -LL + use std:collections::HashMap; - | +LL | use std:collections::HashMap; + | ~~ error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/pat-tuple-field-count-cross.stderr b/tests/ui/pattern/pat-tuple-field-count-cross.stderr index c084ec0b532ed..931db37c78ef1 100644 --- a/tests/ui/pattern/pat-tuple-field-count-cross.stderr +++ b/tests/ui/pattern/pat-tuple-field-count-cross.stderr @@ -121,9 +121,8 @@ LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } | help: use the tuple variant pattern syntax instead | -LL - E1::Z1 => {} -LL + E1::Z1() => {} - | +LL | E1::Z1() => {} + | ~~~~~~~~ help: a unit variant with a similar name exists | LL - E1::Z1 => {} diff --git a/tests/ui/pattern/pat-tuple-overfield.stderr b/tests/ui/pattern/pat-tuple-overfield.stderr index 4e8261cb15b84..ea3663ea40e76 100644 --- a/tests/ui/pattern/pat-tuple-overfield.stderr +++ b/tests/ui/pattern/pat-tuple-overfield.stderr @@ -155,9 +155,8 @@ LL | E1::Z1 => {} | help: use the tuple variant pattern syntax instead | -LL - E1::Z1 => {} -LL + E1::Z1() => {} - | +LL | E1::Z1() => {} + | ~~~~~~~~ help: a unit variant with a similar name exists | LL - E1::Z1 => {} diff --git a/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr b/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr index a12b94176c076..e9c2fccaba284 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr +++ b/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr @@ -6,9 +6,8 @@ LL | b.make_ascii_uppercase(); | help: consider changing this to be mutable | -LL - let &b = a; -LL + let &(mut b) = a; - | +LL | let &(mut b) = a; + | ~~~~~ + error: aborting due to 1 previous error diff --git a/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr b/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr index 68141af491068..e93b8bbacccdd 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr +++ b/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr @@ -6,9 +6,8 @@ LL | mutate(&mut x); | help: consider changing this to be mutable | -LL - fn foo(&x: &i32) { -LL + fn foo(&(mut x): &i32) { - | +LL | fn foo(&(mut x): &i32) { + | ~~~~~ + error: aborting due to 1 previous error diff --git a/tests/ui/privacy/privacy5.stderr b/tests/ui/privacy/privacy5.stderr index 8f28f629ba3ba..ec3abe9b81629 100644 --- a/tests/ui/privacy/privacy5.stderr +++ b/tests/ui/privacy/privacy5.stderr @@ -52,9 +52,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:56:12 @@ -262,9 +261,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:69:12 @@ -282,9 +280,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:70:12 @@ -302,9 +299,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:71:12 @@ -322,9 +318,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:72:18 @@ -342,9 +337,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:73:18 @@ -362,9 +356,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:74:18 @@ -382,9 +375,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `C` is private --> $DIR/privacy5.rs:75:18 @@ -402,9 +394,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:83:17 @@ -460,9 +451,8 @@ LL | pub struct C(pub isize, isize); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider making the fields publicly accessible | -LL - pub struct C(pub isize, isize); -LL + pub struct C(pub isize, pub isize); - | +LL | pub struct C(pub isize, pub isize); + | +++ error[E0603]: tuple struct constructor `A` is private --> $DIR/privacy5.rs:90:20 diff --git a/tests/ui/pub/pub-ident-fn-or-struct.stderr b/tests/ui/pub/pub-ident-fn-or-struct.stderr index 1bdb547be1e51..ceadc510c63ef 100644 --- a/tests/ui/pub/pub-ident-fn-or-struct.stderr +++ b/tests/ui/pub/pub-ident-fn-or-struct.stderr @@ -6,9 +6,8 @@ LL | pub S (foo) bar | help: if you meant to call a macro, try | -LL - pub S (foo) bar -LL + pub S! (foo) bar - | +LL | pub S! (foo) bar + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/resolve/issue-39226.stderr b/tests/ui/resolve/issue-39226.stderr index 3d771b4fc42a2..84f9ad531f082 100644 --- a/tests/ui/resolve/issue-39226.stderr +++ b/tests/ui/resolve/issue-39226.stderr @@ -9,9 +9,8 @@ LL | handle: Handle | help: use struct literal syntax instead | -LL - handle: Handle -LL + handle: Handle {} - | +LL | handle: Handle {} + | ~~~~~~~~~ help: a local variable with a similar name exists | LL - handle: Handle diff --git a/tests/ui/resolve/issue-55673.stderr b/tests/ui/resolve/issue-55673.stderr index 30b1cd09085b6..86dfca068a37c 100644 --- a/tests/ui/resolve/issue-55673.stderr +++ b/tests/ui/resolve/issue-55673.stderr @@ -18,9 +18,8 @@ LL | T::Baa: std::fmt::Debug, | help: consider further restricting type parameter `T` with trait `Foo` | -LL - T::Baa: std::fmt::Debug, -LL + T::Baa: std::fmt::Debug, T: Foo - | +LL | T::Baa: std::fmt::Debug, T: Foo + | ~~~~~~~~ help: ...and changing the associated type name | LL - T::Baa: std::fmt::Debug, diff --git a/tests/ui/resolve/issue-73427.stderr b/tests/ui/resolve/issue-73427.stderr index 890bb04f24dac..3c49fe3a8de57 100644 --- a/tests/ui/resolve/issue-73427.stderr +++ b/tests/ui/resolve/issue-73427.stderr @@ -20,9 +20,8 @@ help: you might have meant to use one of the following enum variants LL - A.foo(); LL + (A::Tuple()).foo(); | -LL - A.foo(); -LL + A::Unit.foo(); - | +LL | A::Unit.foo(); + | ~~~~~~~ help: alternatively, the following enum variant is available | LL - A.foo(); @@ -61,9 +60,8 @@ LL | | } | |_^ help: you might have meant to use the following enum variant | -LL - C.foo(); -LL + C::Unit.foo(); - | +LL | C::Unit.foo(); + | ~~~~~~~ help: alternatively, the following enum variant is available | LL - C.foo(); @@ -86,9 +84,8 @@ LL | | } | |_^ help: you might have meant to use the following enum variant | -LL - D.foo(); -LL + D::Unit.foo(); - | +LL | D::Unit.foo(); + | ~~~~~~~ help: alternatively, the following enum variant is available | LL - D.foo(); @@ -144,12 +141,10 @@ LL | | } | |_^ help: try to match against one of the enum's variants | -LL - if let A(3) = x { } -LL + if let A::Tuple(3) = x { } - | -LL - if let A(3) = x { } -LL + if let A::TupleWithFields(3) = x { } - | +LL | if let A::Tuple(3) = x { } + | ~~~~~~~~ +LL | if let A::TupleWithFields(3) = x { } + | ~~~~~~~~~~~~~~~~~~ error[E0423]: expected function, tuple struct or tuple variant, found enum `A` --> $DIR/issue-73427.rs:46:13 @@ -171,12 +166,10 @@ LL | | } | |_^ help: try to construct one of the enum's variants | -LL - let x = A(3); -LL + let x = A::Tuple(3); - | -LL - let x = A(3); -LL + let x = A::TupleWithFields(3); - | +LL | let x = A::Tuple(3); + | ~~~~~~~~ +LL | let x = A::TupleWithFields(3); + | ~~~~~~~~~~~~~~~~~~ error: aborting due to 7 previous errors diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr index 3bbab3716afe7..fb6787274fac8 100644 --- a/tests/ui/resolve/privacy-enum-ctor.stderr +++ b/tests/ui/resolve/privacy-enum-ctor.stderr @@ -124,9 +124,8 @@ LL | | } | |_____^ help: you might have meant to use the following enum variant | -LL - let _: E = E; -LL + let _: E = E::Unit; - | +LL | let _: E = E::Unit; + | ~~~~~~~ help: alternatively, the following enum variant is available | LL - let _: E = E; diff --git a/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr b/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr index 3d6d47578c37a..b41fa1818e25a 100644 --- a/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr +++ b/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr @@ -11,9 +11,8 @@ LL | const DEFAULT: u32 = 0; = note: the matched value is of type `u32` help: introduce a variable instead | -LL - let DEFAULT: u32 = 0; -LL + let DEFAULT_var: u32 = 0; - | +LL | let DEFAULT_var: u32 = 0; + | ~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr b/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr index f041487da41dd..908f5bdd89749 100644 --- a/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr +++ b/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr @@ -21,9 +21,8 @@ LL | const DEFAULT: u32 = 0; = note: the matched value is of type `u32` help: introduce a variable instead | -LL - let DEFAULT: u32 = 0; -LL + let DEFAULT_var: u32 = 0; - | +LL | let DEFAULT_var: u32 = 0; + | ~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr index 15fdb975a1b29..d183f06c5fd4e 100644 --- a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr +++ b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr @@ -66,9 +66,8 @@ LL | Self::BAR; | ++++++ help: a constant with a similar name exists | -LL - BAR; -LL + BARR; - | +LL | BARR; + | ~~~~ error[E0412]: cannot find type `Baz` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:37:18 diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr index 1ea7f1d39cb95..e7651f7704c7c 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr @@ -39,9 +39,8 @@ LL | modul::foo(); | help: there is a crate or module with a similar name | -LL - modul::foo(); -LL + module::foo(); - | +LL | module::foo(); + | ~~~~~~ error[E0433]: failed to resolve: use of undeclared type `Trai` --> $DIR/typo-suggestion-mistyped-in-path.rs:39:5 diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr index 4cbd93d17cfee..050834ab67609 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr @@ -11,9 +11,8 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `const_foobar` | -LL - #![feature(const_foo)] -LL + #![feature(const_foobar)] - | +LL | #![feature(const_foobar)] + | ~~~~~~~~~~~~ help: if you are using features which are now stable, remove this line | LL - #![feature(const_foo)] diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr index 38331919ee8ff..50cc14c3b4f65 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr @@ -11,9 +11,8 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `const_foobar` | -LL - #![feature(const_foo)] -LL + #![feature(const_foobar)] - | +LL | #![feature(const_foobar)] + | ~~~~~~~~~~~~ help: if you are using features which are now stable, remove this line | LL - #![feature(const_foo)] diff --git a/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr index 1080b977410d7..d783f1e8e4044 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr @@ -11,9 +11,8 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `foobar` | -LL - #![feature(foo)] -LL + #![feature(foobar)] - | +LL | #![feature(foobar)] + | ~~~~~~ help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] diff --git a/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr index 02cb25633ab0b..4940650fd4261 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr @@ -11,9 +11,8 @@ LL | #![deny(stable_features)] | ^^^^^^^^^^^^^^^ help: if you are using features which are still unstable, change to using `foobar` | -LL - #![feature(foo)] -LL + #![feature(foobar)] - | +LL | #![feature(foobar)] + | ~~~~~~ help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] diff --git a/tests/ui/statics/issue-15261.stderr b/tests/ui/statics/issue-15261.stderr index 7edd79e08b1ef..4067d151de3d4 100644 --- a/tests/ui/statics/issue-15261.stderr +++ b/tests/ui/statics/issue-15261.stderr @@ -9,9 +9,8 @@ LL | static n: &'static usize = unsafe { &n_mut }; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - static n: &'static usize = unsafe { &n_mut }; -LL + static n: &'static usize = unsafe { &raw const n_mut }; - | +LL | static n: &'static usize = unsafe { &raw const n_mut }; + | ~~~~~~~~~~ warning: 1 warning emitted diff --git a/tests/ui/statics/static-mut-shared-parens.stderr b/tests/ui/statics/static-mut-shared-parens.stderr index f428f9a18d4e6..ad6ad68c3157d 100644 --- a/tests/ui/statics/static-mut-shared-parens.stderr +++ b/tests/ui/statics/static-mut-shared-parens.stderr @@ -9,9 +9,8 @@ LL | let _ = unsafe { (&TEST) as *const usize }; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - let _ = unsafe { (&TEST) as *const usize }; -LL + let _ = unsafe { (&raw const TEST) as *const usize }; - | +LL | let _ = unsafe { (&raw const TEST) as *const usize }; + | ~~~~~~~~~~ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-shared-parens.rs:11:22 diff --git a/tests/ui/statics/static-mut-xc.stderr b/tests/ui/statics/static-mut-xc.stderr index d03835c30d8b0..77ce49b883fce 100644 --- a/tests/ui/statics/static-mut-xc.stderr +++ b/tests/ui/statics/static-mut-xc.stderr @@ -54,9 +54,8 @@ LL | static_bound(&static_mut_xc::a); = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives help: use `&raw const` instead to create a raw pointer | -LL - static_bound(&static_mut_xc::a); -LL + static_bound(&raw const static_mut_xc::a); - | +LL | static_bound(&raw const static_mut_xc::a); + | ~~~~~~~~~~ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-xc.rs:35:22 diff --git a/tests/ui/statics/static-recursive.stderr b/tests/ui/statics/static-recursive.stderr index 8ea997fa21404..f2dd5b8a6cfe8 100644 --- a/tests/ui/statics/static-recursive.stderr +++ b/tests/ui/statics/static-recursive.stderr @@ -9,9 +9,8 @@ LL | static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; = note: `#[warn(static_mut_refs)]` on by default help: use `&raw const` instead to create a raw pointer | -LL - static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; -LL + static mut S: *const u8 = unsafe { &raw const S as *const *const u8 as *const u8 }; - | +LL | static mut S: *const u8 = unsafe { &raw const S as *const *const u8 as *const u8 }; + | ~~~~~~~~~~ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-recursive.rs:19:20 diff --git a/tests/ui/structs/struct-fields-hints-no-dupe.stderr b/tests/ui/structs/struct-fields-hints-no-dupe.stderr index 650f6ddfa88b0..2b88d802833c3 100644 --- a/tests/ui/structs/struct-fields-hints-no-dupe.stderr +++ b/tests/ui/structs/struct-fields-hints-no-dupe.stderr @@ -6,9 +6,8 @@ LL | bar : 42, | help: a field with a similar name exists | -LL - bar : 42, -LL + barr : 42, - | +LL | barr : 42, + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/bound-suggestions.stderr b/tests/ui/suggestions/bound-suggestions.stderr index 51a6a51e7da92..e30deb11398e6 100644 --- a/tests/ui/suggestions/bound-suggestions.stderr +++ b/tests/ui/suggestions/bound-suggestions.stderr @@ -43,9 +43,8 @@ LL | println!("{:?} {:?}", x, y); = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider further restricting type parameter `Y` with trait `Debug` | -LL - fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, { -LL + fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { - | +LL | fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { + | ~~~~~~~~~~~~~~~~~~~~ error[E0277]: `X` doesn't implement `Debug` --> $DIR/bound-suggestions.rs:33:22 diff --git a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr index 55a353c40ca30..4f92d3aceefe0 100644 --- a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr +++ b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr @@ -12,9 +12,8 @@ LL | const A: i32 = 2; = note: the matched value is of type `i32` help: introduce a variable instead | -LL - let A = 3; -LL + let A_var = 3; - | +LL | let A_var = 3; + | ~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/crate-or-module-typo.stderr b/tests/ui/suggestions/crate-or-module-typo.stderr index 0ca0582105be0..cbe765731b46c 100644 --- a/tests/ui/suggestions/crate-or-module-typo.stderr +++ b/tests/ui/suggestions/crate-or-module-typo.stderr @@ -6,9 +6,8 @@ LL | use st::cell::Cell; | help: there is a crate or module with a similar name | -LL - use st::cell::Cell; -LL + use std::cell::Cell; - | +LL | use std::cell::Cell; + | ~~~ error[E0432]: unresolved import `bas` --> $DIR/crate-or-module-typo.rs:11:5 @@ -30,9 +29,8 @@ LL | bar: st::cell::Cell | help: there is a crate or module with a similar name | -LL - bar: st::cell::Cell -LL + bar: std::cell::Cell - | +LL | bar: std::cell::Cell + | ~~~ help: consider importing this module | LL + use std::cell; diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr index ac93c5df05e0d..a58c2a584f75e 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr @@ -20,9 +20,8 @@ LL | fn foo(&self) where Self: Other, { } | +++++ help: alternatively, consider constraining `foo` so it does not apply to trait objects | -LL - fn foo() where Self: Other, { } -LL + fn foo() where Self: Other, Self: Sized { } - | +LL | fn foo() where Self: Other, Self: Sized { } + | ~~~~~~~~~~~~~ help: consider changing method `bar`'s `self` parameter to be `&self` | LL - fn bar(self: ()) {} diff --git a/tests/ui/suggestions/field-access.stderr b/tests/ui/suggestions/field-access.stderr index 4696950930f33..7d816b5bfdd17 100644 --- a/tests/ui/suggestions/field-access.stderr +++ b/tests/ui/suggestions/field-access.stderr @@ -11,9 +11,8 @@ LL | if let B::Fst = a {}; | help: you might have meant to use field `b` whose type is `B` | -LL - if let B::Fst = a {}; -LL + if let B::Fst = a.b {}; - | +LL | if let B::Fst = a.b {}; + | ~~~ error[E0308]: mismatched types --> $DIR/field-access.rs:25:9 @@ -29,9 +28,8 @@ LL | B::Fst => (), | help: you might have meant to use field `b` whose type is `B` | -LL - match a { -LL + match a.b { - | +LL | match a.b { + | ~~~ error[E0308]: mismatched types --> $DIR/field-access.rs:26:9 @@ -47,9 +45,8 @@ LL | B::Snd => (), | help: you might have meant to use field `b` whose type is `B` | -LL - match a { -LL + match a.b { - | +LL | match a.b { + | ~~~ error[E0308]: mismatched types --> $DIR/field-access.rs:32:9 diff --git a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr index 90dee9005abae..79fa468dc4947 100644 --- a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr +++ b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr @@ -14,9 +14,8 @@ LL | fn foo(_: X) {} | ^^^^^ required by this bound in `foo` help: consider changing this borrow's mutability | -LL - foo(&s); -LL + foo(&mut s); - | +LL | foo(&mut s); + | ~~~~ error[E0277]: the trait bound `S: Trait` is not satisfied --> $DIR/imm-ref-trait-object-literal.rs:13:7 diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr index 299cf1d74d51d..89cda2a56e064 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr @@ -11,9 +11,8 @@ LL | fn g(mut x: impl Iterator) -> Option<&'static ()> { x.next( | +++++++ help: consider introducing a named lifetime parameter | -LL - fn g(mut x: impl Iterator) -> Option<&()> { x.next() } -LL + fn g<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } - | +LL | fn g<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } + | ++++ ~~~ ~~~ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Iterator) -> Option<&()> { x.next() } @@ -33,9 +32,8 @@ LL | async fn i(mut x: impl Iterator) -> Option<&'static ()> { x | +++++++ help: consider introducing a named lifetime parameter | -LL - async fn i(mut x: impl Iterator) -> Option<&()> { x.next() } -LL + async fn i<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } - | +LL | async fn i<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } + | ++++ ~~~ ~~~ help: alternatively, you might want to return an owned value | LL - async fn i(mut x: impl Iterator) -> Option<&()> { x.next() } @@ -101,9 +99,8 @@ LL | fn g(mut x: impl Foo) -> Option<&'static ()> { x.next() } | +++++++ help: consider introducing a named lifetime parameter | -LL - fn g(mut x: impl Foo) -> Option<&()> { x.next() } -LL + fn g<'a>(mut x: impl Foo) -> Option<&'a ()> { x.next() } - | +LL | fn g<'a>(mut x: impl Foo) -> Option<&'a ()> { x.next() } + | ++++ ~~~ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo) -> Option<&()> { x.next() } @@ -123,9 +120,8 @@ LL | fn g(mut x: impl Foo<()>) -> Option<&'static ()> { x.next() } | +++++++ help: consider introducing a named lifetime parameter | -LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } -LL + fn g<'a>(mut x: impl Foo<()>) -> Option<&'a ()> { x.next() } - | +LL | fn g<'a>(mut x: impl Foo<()>) -> Option<&'a ()> { x.next() } + | ++++ ~~~ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } diff --git a/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr b/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr index 06f465e9c0d23..d43d1f9bb7e8a 100644 --- a/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr +++ b/tests/ui/suggestions/recover-missing-turbofish-surrounding-angle-braket.stderr @@ -41,9 +41,8 @@ LL | let _ = vec![1, 2, 3].into_iter().collect::Vec<_>>(); | help: surround the type parameters with angle brackets | -LL - let _ = vec![1, 2, 3].into_iter().collect::Vec<_>>(); -LL + let _ = vec![1, 2, 3].into_iter().collect::>(); - | +LL | let _ = vec![1, 2, 3].into_iter().collect::>(); + | + error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/struct-field-type-including-single-colon.stderr b/tests/ui/suggestions/struct-field-type-including-single-colon.stderr index 247454b8710c9..4dd514480da40 100644 --- a/tests/ui/suggestions/struct-field-type-including-single-colon.stderr +++ b/tests/ui/suggestions/struct-field-type-including-single-colon.stderr @@ -6,9 +6,8 @@ LL | a: foo:A, | help: write a path separator here | -LL - a: foo:A, -LL + a: foo::A, - | +LL | a: foo::A, + | ~~ error: expected `,`, or `}`, found `:` --> $DIR/struct-field-type-including-single-colon.rs:9:11 @@ -26,9 +25,8 @@ LL | b: foo::bar:B, | help: write a path separator here | -LL - b: foo::bar:B, -LL + b: foo::bar::B, - | +LL | b: foo::bar::B, + | ~~ error: expected `,`, or `}`, found `:` --> $DIR/struct-field-type-including-single-colon.rs:15:16 diff --git a/tests/ui/suggestions/suggest-change-mut.stderr b/tests/ui/suggestions/suggest-change-mut.stderr index 5315456efea84..216d1e810fd72 100644 --- a/tests/ui/suggestions/suggest-change-mut.stderr +++ b/tests/ui/suggestions/suggest-change-mut.stderr @@ -19,9 +19,8 @@ LL | fn issue_81421(mut stream: T) where &T: std::io::Read { | +++++++++++++++++++++++ help: consider changing this borrow's mutability | -LL - let mut stream_reader = BufReader::new(&stream); -LL + let mut stream_reader = BufReader::new(&mut stream); - | +LL | let mut stream_reader = BufReader::new(&mut stream); + | ~~~~ error[E0599]: the method `read_until` exists for struct `BufReader<&T>`, but its trait bounds were not satisfied --> $DIR/suggest-change-mut.rs:16:23 diff --git a/tests/ui/suggestions/suggest-methods.stderr b/tests/ui/suggestions/suggest-methods.stderr index 6f1c2cc4cab09..f9f6e5f86fc96 100644 --- a/tests/ui/suggestions/suggest-methods.stderr +++ b/tests/ui/suggestions/suggest-methods.stderr @@ -45,9 +45,8 @@ LL | let _ = 63u32.count_o(); | help: there is a method `count_ones` with a similar name | -LL - let _ = 63u32.count_o(); -LL + let _ = 63u32.count_ones(); - | +LL | let _ = 63u32.count_ones(); + | ~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-variants.stderr b/tests/ui/suggestions/suggest-variants.stderr index b422da8fbfac1..7d62604e23f1e 100644 --- a/tests/ui/suggestions/suggest-variants.stderr +++ b/tests/ui/suggestions/suggest-variants.stderr @@ -24,9 +24,8 @@ LL | println!("My shape is {:?}", Shape::Circl { size: 5}); | help: there is a variant with a similar name | -LL - println!("My shape is {:?}", Shape::Circl { size: 5}); -LL + println!("My shape is {:?}", Shape::Circle { size: 5}); - | +LL | println!("My shape is {:?}", Shape::Circle { size: 5}); + | ~~~~~~ error[E0599]: no variant named `Rombus` found for enum `Shape` --> $DIR/suggest-variants.rs:14:41 @@ -63,9 +62,8 @@ LL | Shape::Circl; | help: there is a variant with a similar name | -LL - Shape::Circl; -LL + Shape::Circle { radius: /* value */ }; - | +LL | Shape::Circle { radius: /* value */ }; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0599]: no variant or associated item named `Rombus` found for enum `Shape` in the current scope --> $DIR/suggest-variants.rs:17:12 diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr index 70e8f5b58acb3..ba0682cda3212 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr @@ -7,9 +7,8 @@ LL | let _ = vec![Ok(2)].into_iter().collect:,_>>()?; = note: type ascription syntax has been removed, see issue #101728 help: maybe write a path separator here | -LL - let _ = vec![Ok(2)].into_iter().collect:,_>>()?; -LL + let _ = vec![Ok(2)].into_iter().collect::,_>>()?; - | +LL | let _ = vec![Ok(2)].into_iter().collect::,_>>()?; + | ~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr index 5ba56d095f73d..56b6a69a283f4 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr @@ -6,9 +6,8 @@ LL | let _: Vec = A::B; | help: you might have meant to write a path instead of an associated type bound | -LL - let _: Vec = A::B; -LL + let _: Vec = A::B; - | +LL | let _: Vec = A::B; + | ~~ error[E0107]: struct takes at least 1 generic argument but 0 generic arguments were supplied --> $DIR/type-ascription-instead-of-path-in-type.rs:6:12 diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr index 1117ee7efb30d..40e16dde6e4a4 100644 --- a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr @@ -25,9 +25,8 @@ LL | for F: 'a, | ^^ help: consider adding an explicit lifetime bound | -LL - for F: 'a, -LL + for F: 'a, !1_"F": 'a - | +LL | for F: 'a, !1_"F": 'a + | ~~~~~~~~~~~~ error[E0309]: the placeholder type `!1_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 @@ -40,9 +39,8 @@ LL | {} | help: consider adding an explicit lifetime bound | -LL - for F: 'a, -LL + for F: 'a, !1_"F": 'a - | +LL | for F: 'a, !1_"F": 'a + | ~~~~~~~~~~~~ error[E0309]: the placeholder type `!2_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 @@ -55,9 +53,8 @@ LL | {} | help: consider adding an explicit lifetime bound | -LL - for F: 'a, -LL + for F: 'a, !2_"F": 'a - | +LL | for F: 'a, !2_"F": 'a + | ~~~~~~~~~~~~ error: aborting due to 3 previous errors; 1 warning emitted diff --git a/tests/ui/transmutability/assoc-bound.stderr b/tests/ui/transmutability/assoc-bound.stderr index 4ff67bd636ada..b3c7680bf2949 100644 --- a/tests/ui/transmutability/assoc-bound.stderr +++ b/tests/ui/transmutability/assoc-bound.stderr @@ -12,9 +12,8 @@ LL | type AssocB: std::mem::TransmuteFrom<()>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `B::AssocB` help: consider further restricting the associated type | -LL - T: A, -LL + T: A, ::AssocA: TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }> - | +LL | T: A, ::AssocA: TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }> + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0277]: `()` cannot be safely transmuted into `<&i32 as A>::AssocA` --> $DIR/assoc-bound.rs:24:19 diff --git a/tests/ui/typeck/issue-29181.stderr b/tests/ui/typeck/issue-29181.stderr index e73c3e5188183..53addf2fe4d09 100644 --- a/tests/ui/typeck/issue-29181.stderr +++ b/tests/ui/typeck/issue-29181.stderr @@ -12,9 +12,8 @@ LL | let _ = |x: f64| x * 2.0.exp(); | help: you must specify a concrete type for this numeric value, like `f32` | -LL - let _ = |x: f64| x * 2.0.exp(); -LL + let _ = |x: f64| x * 2.0_f32.exp(); - | +LL | let _ = |x: f64| x * 2.0_f32.exp(); + | ~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/method-chain-gats.stderr b/tests/ui/typeck/method-chain-gats.stderr index 902255a28a621..6338379221471 100644 --- a/tests/ui/typeck/method-chain-gats.stderr +++ b/tests/ui/typeck/method-chain-gats.stderr @@ -19,9 +19,8 @@ LL | Self::Base: Functor; | ^^^^^^^^^^ required by this bound in `Functor::fmap` help: consider further restricting the associated type | -LL - T::Base: Functor = T::Base>, -LL + T::Base: Functor = T::Base>, ::Base: Functor - | +LL | T::Base: Functor = T::Base>, ::Base: Functor + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 1 previous error From f6406dfd4efceb6f713e503aecda587304135ed9 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 13 Feb 2025 03:07:18 +0000 Subject: [PATCH 11/12] Consider add-prefix replacements too --- compiler/rustc_errors/src/lib.rs | 7 ++- .../2229_closure_analysis/issue-118144.stderr | 5 +- .../ui/empty/empty-struct-braces-expr.stderr | 5 +- .../error-recovery-issue-55897.stderr | 5 +- tests/ui/error-codes/E0027.stderr | 15 ++--- ...-gate-unboxed-closures-manual-impls.stderr | 5 +- ...est-import-issue-120074.edition2015.stderr | 5 +- ...est-import-issue-120074.edition2021.stderr | 5 +- .../issue-57741.stderr | 20 +++---- .../let-else/let-else-deref-coercion.stderr | 10 ++-- tests/ui/lexer/lex-bad-char-literals-1.stderr | 5 +- .../lifetimes/borrowck-let-suggestion.stderr | 5 +- .../lint-strict-provenance-lossy-casts.stderr | 5 +- tests/ui/match/issue-56685.stderr | 20 +++---- tests/ui/mismatched_types/issue-112036.stderr | 5 +- tests/ui/namespace/namespace-mix.stderr | 20 +++---- tests/ui/object-pointer-types.stderr | 5 +- tests/ui/parser/bad-char-literals.stderr | 5 +- .../bad-escape-suggest-raw-string.stderr | 5 +- tests/ui/parser/byte-literals.stderr | 5 +- ...sue-65257-invalid-var-decl-recovery.stderr | 10 ++-- .../issues/issue-87086-colon-path-sep.stderr | 15 ++--- .../parser/type-ascription-in-pattern.stderr | 10 ++-- .../usefulness/doc-hidden-fields.stderr | 45 ++++++-------- .../usefulness/stable-gated-fields.stderr | 15 ++--- tests/ui/privacy/suggest-box-new.stderr | 10 ++-- tests/ui/pub/pub-restricted.stderr | 25 ++++---- .../const-with-typo-in-pattern-binding.stderr | 5 +- .../resolve/resolve-inconsistent-names.stderr | 10 ++-- .../rfc-2008-non-exhaustive/struct.stderr | 15 ++--- .../rfc-2008-non-exhaustive/variant.stderr | 10 ++-- .../not-allowed.stderr | 5 +- .../rust-2018/trait-import-suggestions.stderr | 5 +- .../structs/struct-pat-derived-error.stderr | 15 ++--- .../structs/struct-tuple-field-names.stderr | 15 ++--- ...ing-field-when-specifying-same-type.stderr | 60 ++++++++----------- ...suggest-deref-in-match-issue-132784.stderr | 50 +++++++--------- .../type-mismatch-byte-literal.stderr | 15 ++--- .../inaccessible-test-modules.stderr | 5 +- .../assoc_type_bound_with_struct.stderr | 20 +++---- tests/ui/type/issue-100584.stderr | 10 ++-- .../pattern_type_mismatch.stderr | 10 ++-- .../typeck/mismatched-map-under-self.stderr | 5 +- .../unresolved/unresolved-candidates.stderr | 5 +- 44 files changed, 222 insertions(+), 330 deletions(-) diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 4a186565a7bfc..855b9734cdc5e 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -236,9 +236,10 @@ impl SubstitutionPart { /// it with "abx" is, since the "c" character is lost. pub fn is_destructive_replacement(&self, sm: &SourceMap) -> bool { self.is_replacement(sm) - && !sm - .span_to_snippet(self.span) - .is_ok_and(|snippet| self.snippet.trim_start().starts_with(snippet.trim_start())) + && !sm.span_to_snippet(self.span).is_ok_and(|snippet| { + self.snippet.trim_start().starts_with(snippet.trim_start()) + || self.snippet.trim_end().ends_with(snippet.trim_end()) + }) } fn replaces_meaningful_content(&self, sm: &SourceMap) -> bool { diff --git a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr index f717343122ee3..87084e6023729 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr +++ b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr @@ -8,9 +8,8 @@ LL | V(x) = func_arg; | help: consider dereferencing to access the inner value using the Deref trait | -LL - V(x) = func_arg; -LL + V(x) = &*func_arg; - | +LL | V(x) = &*func_arg; + | ~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/empty/empty-struct-braces-expr.stderr b/tests/ui/empty/empty-struct-braces-expr.stderr index 140b6e009b7a2..cdedb3f20aab3 100644 --- a/tests/ui/empty/empty-struct-braces-expr.stderr +++ b/tests/ui/empty/empty-struct-braces-expr.stderr @@ -125,9 +125,8 @@ LL | let xe3 = XE::Empty3; | help: there is a variant with a similar name | -LL - let xe3 = XE::Empty3; -LL + let xe3 = XE::XEmpty3; - | +LL | let xe3 = XE::XEmpty3; + | ~~~~~~~ error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:26:19 diff --git a/tests/ui/env-macro/error-recovery-issue-55897.stderr b/tests/ui/env-macro/error-recovery-issue-55897.stderr index cda9aa330d221..5a20bf8b16869 100644 --- a/tests/ui/env-macro/error-recovery-issue-55897.stderr +++ b/tests/ui/env-macro/error-recovery-issue-55897.stderr @@ -30,9 +30,8 @@ LL | use env; | help: consider importing this module instead | -LL - use env; -LL + use std::env; - | +LL | use std::env; + | ~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/error-codes/E0027.stderr b/tests/ui/error-codes/E0027.stderr index 701e636dc581c..4a102629ad504 100644 --- a/tests/ui/error-codes/E0027.stderr +++ b/tests/ui/error-codes/E0027.stderr @@ -6,19 +6,16 @@ LL | Dog { age: x } => {} | help: include the missing field in the pattern | -LL - Dog { age: x } => {} -LL + Dog { age: x, name } => {} - | +LL | Dog { age: x, name } => {} + | ~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Dog { age: x } => {} -LL + Dog { age: x, name: _ } => {} - | +LL | Dog { age: x, name: _ } => {} + | ~~~~~~~~~~~ help: or always ignore missing fields here | -LL - Dog { age: x } => {} -LL + Dog { age: x, .. } => {} - | +LL | Dog { age: x, .. } => {} + | ~~~~~~ error[E0027]: pattern does not mention field `age` --> $DIR/E0027.rs:15:9 diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index 7271ca48877ab..a50e5f2f73d90 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -95,9 +95,8 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {} found signature `extern "rust-call" fn(Foo, ()) -> ()` help: change the self-receiver type to match the trait | -LL - extern "rust-call" fn call(self, args: ()) -> () {} -LL + extern "rust-call" fn call(&self, args: ()) -> () {} - | +LL | extern "rust-call" fn call(&self, args: ()) -> () {} + | ~~~~~ error[E0183]: manual implementations of `FnOnce` are experimental --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr index c9cfe769aeb29..414eeee0fedc8 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr @@ -6,9 +6,8 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing); | help: a similar path exists | -LL - println!("Hello, {}!", crate::bar::do_the_thing); -LL + println!("Hello, {}!", crate::foo::bar::do_the_thing); - | +LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); + | ~~~~~~~~ help: consider importing this module | LL + use foo::bar; diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr index c9cfe769aeb29..414eeee0fedc8 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr @@ -6,9 +6,8 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing); | help: a similar path exists | -LL - println!("Hello, {}!", crate::bar::do_the_thing); -LL + println!("Hello, {}!", crate::foo::bar::do_the_thing); - | +LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); + | ~~~~~~~~ help: consider importing this module | LL + use foo::bar; diff --git a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr index 713a19f6cb0f7..3c19b68cffbb3 100644 --- a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr +++ b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr @@ -10,9 +10,8 @@ LL | T::A(a) | T::B(a) => a, found enum `T` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | ~~ error[E0308]: mismatched types --> $DIR/issue-57741.rs:20:19 @@ -26,9 +25,8 @@ LL | T::A(a) | T::B(a) => a, found enum `T` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | ~~ error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:9 @@ -42,9 +40,8 @@ LL | S::A { a } | S::B { b: a } => a, found enum `S` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | ~~ error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:22 @@ -58,9 +55,8 @@ LL | S::A { a } | S::B { b: a } => a, found enum `S` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | ~~ error: aborting due to 4 previous errors diff --git a/tests/ui/let-else/let-else-deref-coercion.stderr b/tests/ui/let-else/let-else-deref-coercion.stderr index 07347af76e4d3..da8b1f4c48e97 100644 --- a/tests/ui/let-else/let-else-deref-coercion.stderr +++ b/tests/ui/let-else/let-else-deref-coercion.stderr @@ -8,9 +8,8 @@ LL | let Bar::Present(z) = self else { | help: consider dereferencing to access the inner value using the Deref trait | -LL - let Bar::Present(z) = self else { -LL + let Bar::Present(z) = &**self else { - | +LL | let Bar::Present(z) = &**self else { + | ~~~~~~~ error[E0308]: mismatched types --> $DIR/let-else-deref-coercion.rs:68:13 @@ -22,9 +21,8 @@ LL | let Bar(z) = x; | help: consider dereferencing to access the inner value using the Deref trait | -LL - let Bar(z) = x; -LL + let Bar(z) = &**x; - | +LL | let Bar(z) = &**x; + | ~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/lexer/lex-bad-char-literals-1.stderr b/tests/ui/lexer/lex-bad-char-literals-1.stderr index 49683c10237b3..bf13df90be335 100644 --- a/tests/ui/lexer/lex-bad-char-literals-1.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-1.stderr @@ -32,9 +32,8 @@ LL | "\●" = help: for more information, visit help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | -LL - "\●" -LL + r"\●" - | +LL | r"\●" + | ~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/lifetimes/borrowck-let-suggestion.stderr b/tests/ui/lifetimes/borrowck-let-suggestion.stderr index e0adb16414059..cca7f52957e4c 100644 --- a/tests/ui/lifetimes/borrowck-let-suggestion.stderr +++ b/tests/ui/lifetimes/borrowck-let-suggestion.stderr @@ -12,9 +12,8 @@ LL | x.use_mut(); = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider consuming the `Vec` when turning it into an `Iterator` | -LL - let mut x = vec![1].iter(); -LL + let mut x = vec![1].into_iter(); - | +LL | let mut x = vec![1].into_iter(); + | ~~~~~~~~~ help: consider using a `let` binding to create a longer lived value | LL ~ let binding = vec![1]; diff --git a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr index aeee69ae7afa1..1f528bdb28ff4 100644 --- a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr +++ b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr @@ -25,9 +25,8 @@ LL | let addr_32bit = &x as *const u8 as u32; = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_provenance()` instead help: use `.addr()` to obtain the address of a pointer | -LL - let addr_32bit = &x as *const u8 as u32; -LL + let addr_32bit = (&x as *const u8).addr() as u32; - | +LL | let addr_32bit = (&x as *const u8).addr() as u32; + | + ~~~~~~~~~~~~~~~ error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `usize` --> $DIR/lint-strict-provenance-lossy-casts.rs:14:20 diff --git a/tests/ui/match/issue-56685.stderr b/tests/ui/match/issue-56685.stderr index 9655a38081165..ccf357d4aa00e 100644 --- a/tests/ui/match/issue-56685.stderr +++ b/tests/ui/match/issue-56685.stderr @@ -11,9 +11,8 @@ LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore | -LL - E::A(x) | E::B(x) => {} -LL + E::A(_x) | E::B(_x) => {} - | +LL | E::A(_x) | E::B(_x) => {} + | ~~ ~~ error: unused variable: `x` --> $DIR/issue-56685.rs:25:14 @@ -23,9 +22,8 @@ LL | F::A(x, y) | F::B(x, y) => { y }, | help: if this is intentional, prefix it with an underscore | -LL - F::A(x, y) | F::B(x, y) => { y }, -LL + F::A(_x, y) | F::B(_x, y) => { y }, - | +LL | F::A(_x, y) | F::B(_x, y) => { y }, + | ~~ ~~ error: unused variable: `a` --> $DIR/issue-56685.rs:27:14 @@ -47,9 +45,8 @@ LL | let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { | help: if this is intentional, prefix it with an underscore | -LL - let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { -LL + let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | +LL | let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { + | ~~ ~~ error: unused variable: `x` --> $DIR/issue-56685.rs:39:20 @@ -59,9 +56,8 @@ LL | while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { | help: if this is intentional, prefix it with an underscore | -LL - while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { -LL + while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | +LL | while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { + | ~~ ~~ error: aborting due to 6 previous errors diff --git a/tests/ui/mismatched_types/issue-112036.stderr b/tests/ui/mismatched_types/issue-112036.stderr index 29559980cb45e..bd446b3d78cb2 100644 --- a/tests/ui/mismatched_types/issue-112036.stderr +++ b/tests/ui/mismatched_types/issue-112036.stderr @@ -8,9 +8,8 @@ LL | fn drop(self) {} found signature `fn(Foo)` help: change the self-receiver type to match the trait | -LL - fn drop(self) {} -LL + fn drop(&mut self) {} - | +LL | fn drop(&mut self) {} + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/namespace/namespace-mix.stderr b/tests/ui/namespace/namespace-mix.stderr index 41891c5144ba7..b80363fe8f848 100644 --- a/tests/ui/namespace/namespace-mix.stderr +++ b/tests/ui/namespace/namespace-mix.stderr @@ -10,9 +10,8 @@ LL | check(m1::S); = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists | -LL - check(m1::S); -LL + check(m1::TS); - | +LL | check(m1::TS); + | ~~ help: consider importing one of these constants instead | LL + use m2::S; @@ -39,9 +38,8 @@ LL | pub struct TS(); = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists | -LL - check(xm1::S); -LL + check(xm1::TS); - | +LL | check(xm1::TS); + | ~~ help: consider importing one of these constants instead | LL + use m2::S; @@ -66,9 +64,8 @@ LL | check(m7::V); = note: can't use a type alias as a constructor help: a tuple variant with a similar name exists | -LL - check(m7::V); -LL + check(m7::TV); - | +LL | check(m7::TV); + | ~~ help: consider importing one of these constants instead | LL + use m8::V; @@ -95,9 +92,8 @@ LL | TV(), = note: can't use a type alias as a constructor help: a tuple variant with a similar name exists | -LL - check(xm7::V); -LL + check(xm7::TV); - | +LL | check(xm7::TV); + | ~~ help: consider importing one of these constants instead | LL + use m8::V; diff --git a/tests/ui/object-pointer-types.stderr b/tests/ui/object-pointer-types.stderr index 7e3a13dd90bef..7d915ebdab657 100644 --- a/tests/ui/object-pointer-types.stderr +++ b/tests/ui/object-pointer-types.stderr @@ -9,9 +9,8 @@ LL | x.owned(); | help: there is a method `to_owned` with a similar name | -LL - x.owned(); -LL + x.to_owned(); - | +LL | x.to_owned(); + | ~~~~~~~~ error[E0599]: no method named `owned` found for mutable reference `&mut dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:17:7 diff --git a/tests/ui/parser/bad-char-literals.stderr b/tests/ui/parser/bad-char-literals.stderr index 3513055cb550b..1b047aa46193b 100644 --- a/tests/ui/parser/bad-char-literals.stderr +++ b/tests/ui/parser/bad-char-literals.stderr @@ -6,9 +6,8 @@ LL | '''; | help: escape the character | -LL - '''; -LL + '\''; - | +LL | '\''; + | ~~ error: character constant must be escaped: `\n` --> $DIR/bad-char-literals.rs:10:6 diff --git a/tests/ui/parser/bad-escape-suggest-raw-string.stderr b/tests/ui/parser/bad-escape-suggest-raw-string.stderr index 5afa1f4a7f800..6dd4ad512a8e3 100644 --- a/tests/ui/parser/bad-escape-suggest-raw-string.stderr +++ b/tests/ui/parser/bad-escape-suggest-raw-string.stderr @@ -7,9 +7,8 @@ LL | let bad = "ab\[c"; = help: for more information, visit help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | -LL - let bad = "ab\[c"; -LL + let bad = r"ab\[c"; - | +LL | let bad = r"ab\[c"; + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/byte-literals.stderr b/tests/ui/parser/byte-literals.stderr index fe3cfb23de85b..9e1c2df3e56ef 100644 --- a/tests/ui/parser/byte-literals.stderr +++ b/tests/ui/parser/byte-literals.stderr @@ -39,9 +39,8 @@ LL | b'''; | help: escape the character | -LL - b'''; -LL + b'\''; - | +LL | b'\''; + | ~~ error: non-ASCII character in byte literal --> $DIR/byte-literals.rs:10:7 diff --git a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr index 767f63d69582f..7fc2db0fa5591 100644 --- a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr +++ b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr @@ -54,9 +54,8 @@ LL | mut n = 0; | help: missing keyword | -LL - mut n = 0; -LL + let mut n = 0; - | +LL | let mut n = 0; + | ~~~~~~~ error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:16:5 @@ -66,9 +65,8 @@ LL | mut var; | help: missing keyword | -LL - mut var; -LL + let mut var; - | +LL | let mut var; + | ~~~~~~~ error[E0308]: mismatched types --> $DIR/issue-65257-invalid-var-decl-recovery.rs:20:33 diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr index f6330e51e0dce..b6e24faf5dabb 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr @@ -47,9 +47,8 @@ LL | qux: Foo::Baz if true => {} | help: maybe write a path separator here | -LL - qux: Foo::Baz if true => {} -LL + qux::Foo::Baz if true => {} - | +LL | qux::Foo::Baz if true => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:40:15 @@ -74,9 +73,8 @@ LL | ref qux: Foo::Baz => {} | help: maybe write a path separator here | -LL - ref qux: Foo::Baz => {} -LL + ref qux::Foo::Baz => {} - | +LL | ref qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:58:16 @@ -88,9 +86,8 @@ LL | mut qux: Foo::Baz => {} | help: maybe write a path separator here | -LL - mut qux: Foo::Baz => {} -LL + mut qux::Foo::Baz => {} - | +LL | mut qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:69:12 diff --git a/tests/ui/parser/type-ascription-in-pattern.stderr b/tests/ui/parser/type-ascription-in-pattern.stderr index d29c76baa7b53..0919075499368 100644 --- a/tests/ui/parser/type-ascription-in-pattern.stderr +++ b/tests/ui/parser/type-ascription-in-pattern.stderr @@ -8,9 +8,8 @@ LL | x: i32 => x, | help: maybe write a path separator here | -LL - x: i32 => x, -LL + x::i32 => x, - | +LL | x::i32 => x, + | ~~ error: expected one of `...`, `..=`, `..`, or `|`, found `:` --> $DIR/type-ascription-in-pattern.rs:12:11 @@ -38,9 +37,8 @@ LL | x: i32 => (), | help: maybe write a path separator here | -LL - x: i32 => (), -LL + x::i32 => (), - | +LL | x::i32 => (), + | ~~ error[E0308]: mismatched types --> $DIR/type-ascription-in-pattern.rs:3:19 diff --git a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr index 2f53ebe6f3f58..158eac9a1bd14 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr @@ -17,19 +17,16 @@ LL | let HiddenStruct { one } = HiddenStruct::default(); | help: include the missing field in the pattern and ignore the inaccessible fields | -LL - let HiddenStruct { one } = HiddenStruct::default(); -LL + let HiddenStruct { one, two, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, two, .. } = HiddenStruct::default(); + | ~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let HiddenStruct { one } = HiddenStruct::default(); -LL + let HiddenStruct { one, two: _, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, two: _, .. } = HiddenStruct::default(); + | ~~~~~~~~~~~~~~ help: or always ignore missing fields here | -LL - let HiddenStruct { one } = HiddenStruct::default(); -LL + let HiddenStruct { one, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, .. } = HiddenStruct::default(); + | ~~~~~~ error[E0027]: pattern does not mention field `two` --> $DIR/doc-hidden-fields.rs:21:9 @@ -39,19 +36,16 @@ LL | let HiddenStruct { one, hide } = HiddenStruct::default(); | help: include the missing field in the pattern | -LL - let HiddenStruct { one, hide } = HiddenStruct::default(); -LL + let HiddenStruct { one, hide, two } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, hide, two } = HiddenStruct::default(); + | ~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let HiddenStruct { one, hide } = HiddenStruct::default(); -LL + let HiddenStruct { one, hide, two: _ } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, hide, two: _ } = HiddenStruct::default(); + | ~~~~~~~~~~ help: or always ignore missing fields here | -LL - let HiddenStruct { one, hide } = HiddenStruct::default(); -LL + let HiddenStruct { one, hide, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, hide, .. } = HiddenStruct::default(); + | ~~~~~~ error[E0027]: pattern does not mention field `im_hidden` --> $DIR/doc-hidden-fields.rs:24:9 @@ -61,19 +55,16 @@ LL | let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; | help: include the missing field in the pattern | -LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; -LL + let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden: 0 }; - | +LL | let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden: 0 }; + | ~~~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; -LL + let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 }; - | +LL | let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 }; + | ~~~~~~~~~~~~~~~~ help: or always ignore missing fields here | -LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; -LL + let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 }; - | +LL | let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 }; + | ~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/usefulness/stable-gated-fields.stderr b/tests/ui/pattern/usefulness/stable-gated-fields.stderr index 7b44bc79acff3..d6e9bac7c136b 100644 --- a/tests/ui/pattern/usefulness/stable-gated-fields.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-fields.stderr @@ -6,19 +6,16 @@ LL | let UnstableStruct { stable } = UnstableStruct::default(); | help: include the missing field in the pattern and ignore the inaccessible fields | -LL - let UnstableStruct { stable } = UnstableStruct::default(); -LL + let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); - | +LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); + | ~~~~~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let UnstableStruct { stable } = UnstableStruct::default(); -LL + let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default(); - | +LL | let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default(); + | ~~~~~~~~~~~~~~~~~~ help: or always ignore missing fields here | -LL - let UnstableStruct { stable } = UnstableStruct::default(); -LL + let UnstableStruct { stable, .. } = UnstableStruct::default(); - | +LL | let UnstableStruct { stable, .. } = UnstableStruct::default(); + | ~~~~~~ error: pattern requires `..` due to inaccessible fields --> $DIR/stable-gated-fields.rs:11:9 diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr index da8405fd0e850..80885a8f2f1d7 100644 --- a/tests/ui/privacy/suggest-box-new.stderr +++ b/tests/ui/privacy/suggest-box-new.stderr @@ -9,9 +9,8 @@ LL | let _ = std::collections::HashMap(); | help: you might have meant to use an associated function to build this type | -LL - let _ = std::collections::HashMap(); -LL + let _ = std::collections::HashMap::new(); - | +LL | let _ = std::collections::HashMap::new(); + | ~~~~~~~ LL - let _ = std::collections::HashMap(); LL + let _ = std::collections::HashMap::with_capacity(_); | @@ -23,9 +22,8 @@ LL + let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); | help: consider using the `Default` trait | -LL - let _ = std::collections::HashMap(); -LL + let _ = ::default(); - | +LL | let _ = ::default(); + | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/suggest-box-new.rs:8:19 diff --git a/tests/ui/pub/pub-restricted.stderr b/tests/ui/pub/pub-restricted.stderr index 35c48c6d7692c..fc177aa2033e1 100644 --- a/tests/ui/pub/pub-restricted.stderr +++ b/tests/ui/pub/pub-restricted.stderr @@ -10,9 +10,8 @@ LL | pub (a) fn afn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `a` with `in` | -LL - pub (a) fn afn() {} -LL + pub (in a) fn afn() {} - | +LL | pub (in a) fn afn() {} + | ~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:4:6 @@ -26,9 +25,8 @@ LL | pub (b) fn bfn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `b` with `in` | -LL - pub (b) fn bfn() {} -LL + pub (in b) fn bfn() {} - | +LL | pub (in b) fn bfn() {} + | ~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:5:6 @@ -42,9 +40,8 @@ LL | pub (crate::a) fn cfn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `crate::a` with `in` | -LL - pub (crate::a) fn cfn() {} -LL + pub (in crate::a) fn cfn() {} - | +LL | pub (in crate::a) fn cfn() {} + | ~~~~~~~~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:22:14 @@ -58,9 +55,8 @@ LL | pub (a) invalid: usize, `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `a` with `in` | -LL - pub (a) invalid: usize, -LL + pub (in a) invalid: usize, - | +LL | pub (in a) invalid: usize, + | ~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:31:6 @@ -74,9 +70,8 @@ LL | pub (xyz) fn xyz() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `xyz` with `in` | -LL - pub (xyz) fn xyz() {} -LL + pub (in xyz) fn xyz() {} - | +LL | pub (in xyz) fn xyz() {} + | ~~~~~~ error[E0742]: visibilities can only be restricted to ancestor modules --> $DIR/pub-restricted.rs:23:17 diff --git a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr index f142f91064fad..b3cc90ff1f501 100644 --- a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr +++ b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr @@ -73,9 +73,8 @@ LL | _ => {} | help: you might have meant to pattern match against the value of constant `ARCH` instead of introducing a new catch-all binding | -LL - ARCH => {} -LL + std::env::consts::ARCH => {} - | +LL | std::env::consts::ARCH => {} + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr index 3197e0b08949b..d6240fb8f872c 100644 --- a/tests/ui/resolve/resolve-inconsistent-names.stderr +++ b/tests/ui/resolve/resolve-inconsistent-names.stderr @@ -34,9 +34,8 @@ LL | (A, B) | (ref B, c) | (c, A) => () | help: if you meant to match on unit variant `E::A`, use the full path in the pattern | -LL - (A, B) | (ref B, c) | (c, A) => () -LL + (E::A, B) | (ref B, c) | (c, A) => () - | +LL | (E::A, B) | (ref B, c) | (c, A) => () + | ~~~~ error[E0408]: variable `B` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:19:31 @@ -65,9 +64,8 @@ LL | (CONST1, _) | (_, Const2) => () | help: if you meant to match on constant `m::Const2`, use the full path in the pattern | -LL - (CONST1, _) | (_, Const2) => () -LL + (CONST1, _) | (_, m::Const2) => () - | +LL | (CONST1, _) | (_, m::Const2) => () + | ~~~~~~~~~ error[E0408]: variable `CONST1` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:31:23 diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr index d0244f39769a7..39b1ef1e078c7 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr @@ -58,9 +58,8 @@ LL | let NormalStruct { first_field, second_field } = ns; | help: add `..` at the end of the field list to ignore all other fields | -LL - let NormalStruct { first_field, second_field } = ns; -LL + let NormalStruct { first_field, second_field , .. } = ns; - | +LL | let NormalStruct { first_field, second_field , .. } = ns; + | ~~~~~~ error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/struct.rs:20:14 @@ -76,9 +75,8 @@ LL | let TupleStruct { 0: first_field, 1: second_field } = ts; | help: add `..` at the end of the field list to ignore all other fields | -LL - let TupleStruct { 0: first_field, 1: second_field } = ts; -LL + let TupleStruct { 0: first_field, 1: second_field , .. } = ts; - | +LL | let TupleStruct { 0: first_field, 1: second_field , .. } = ts; + | ~~~~~~ error[E0638]: `..` required with struct marked as non-exhaustive --> $DIR/struct.rs:35:9 @@ -88,9 +86,8 @@ LL | let UnitStruct { } = us; | help: add `..` at the end of the field list to ignore all other fields | -LL - let UnitStruct { } = us; -LL + let UnitStruct { .. } = us; - | +LL | let UnitStruct { .. } = us; + | ~~~~ error: aborting due to 9 previous errors diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr index 4cabd5a81402c..4083f57a9cdf9 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr @@ -82,9 +82,8 @@ LL | NonExhaustiveVariants::Struct { field } => "" | help: add `..` at the end of the field list to ignore all other fields | -LL - NonExhaustiveVariants::Struct { field } => "" -LL + NonExhaustiveVariants::Struct { field , .. } => "" - | +LL | NonExhaustiveVariants::Struct { field , .. } => "" + | ~~~~~~ error[E0638]: `..` required with variant marked as non-exhaustive --> $DIR/variant.rs:30:12 @@ -94,9 +93,8 @@ LL | if let NonExhaustiveVariants::Struct { field } = variant_struct { | help: add `..` at the end of the field list to ignore all other fields | -LL - if let NonExhaustiveVariants::Struct { field } = variant_struct { -LL + if let NonExhaustiveVariants::Struct { field , .. } = variant_struct { - | +LL | if let NonExhaustiveVariants::Struct { field , .. } = variant_struct { + | ~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr index 37a0f2bcaa882..d0c084f7bd5d0 100644 --- a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr +++ b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr @@ -6,9 +6,8 @@ LL | use alloc; | help: consider importing this module instead | -LL - use alloc; -LL + use std::alloc; - | +LL | use std::alloc; + | ~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr index 077b4a6cf2f71..8632bca6b1023 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.stderr +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -34,9 +34,8 @@ LL + use crate::foo::Bar; | help: there is a method `foobar` with a similar name | -LL - x.bar(); -LL + x.foobar(); - | +LL | x.foobar(); + | ~~~~~~ error[E0599]: no method named `baz` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:29:7 diff --git a/tests/ui/structs/struct-pat-derived-error.stderr b/tests/ui/structs/struct-pat-derived-error.stderr index a086de0898302..628a007e7693f 100644 --- a/tests/ui/structs/struct-pat-derived-error.stderr +++ b/tests/ui/structs/struct-pat-derived-error.stderr @@ -24,19 +24,16 @@ LL | let A { x, y } = self.d; | help: include the missing fields in the pattern | -LL - let A { x, y } = self.d; -LL + let A { x, y, b, c } = self.d; - | +LL | let A { x, y, b, c } = self.d; + | ~~~~~~~~ help: if you don't care about these missing fields, you can explicitly ignore them | -LL - let A { x, y } = self.d; -LL + let A { x, y, b: _, c: _ } = self.d; - | +LL | let A { x, y, b: _, c: _ } = self.d; + | ~~~~~~~~~~~~~~ help: or always ignore missing fields here | -LL - let A { x, y } = self.d; -LL + let A { x, y, .. } = self.d; - | +LL | let A { x, y, .. } = self.d; + | ~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/structs/struct-tuple-field-names.stderr b/tests/ui/structs/struct-tuple-field-names.stderr index 7692010aa5430..ef3869dda5355 100644 --- a/tests/ui/structs/struct-tuple-field-names.stderr +++ b/tests/ui/structs/struct-tuple-field-names.stderr @@ -30,19 +30,16 @@ LL | if let E::S { 0: a } = x { | help: include the missing field in the pattern | -LL - if let E::S { 0: a } = x { -LL + if let E::S { 0: a, 1: _ } = x { - | +LL | if let E::S { 0: a, 1: _ } = x { + | ~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - if let E::S { 0: a } = x { -LL + if let E::S { 0: a, 1: _ } = x { - | +LL | if let E::S { 0: a, 1: _ } = x { + | ~~~~~~~~ help: or always ignore missing fields here | -LL - if let E::S { 0: a } = x { -LL + if let E::S { 0: a, .. } = x { - | +LL | if let E::S { 0: a, .. } = x { + | ~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr index befc6a1b538a3..af530e2b75931 100644 --- a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr +++ b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr @@ -15,19 +15,16 @@ LL | Foo::Bar { a, aa: 1, c } => (), | help: include the missing field in the pattern | -LL - Foo::Bar { a, aa: 1, c } => (), -LL + Foo::Bar { a, aa: 1, c, b } => (), - | +LL | Foo::Bar { a, aa: 1, c, b } => (), + | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Bar { a, aa: 1, c } => (), -LL + Foo::Bar { a, aa: 1, c, b: _ } => (), - | +LL | Foo::Bar { a, aa: 1, c, b: _ } => (), + | ~~~~~~~~ help: or always ignore missing fields here | -LL - Foo::Bar { a, aa: 1, c } => (), -LL + Foo::Bar { a, aa: 1, c, .. } => (), - | +LL | Foo::Bar { a, aa: 1, c, .. } => (), + | ~~~~~~ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:13:20 @@ -46,19 +43,16 @@ LL | Foo::Baz { bb: 1.0 } => (), | help: include the missing field in the pattern | -LL - Foo::Baz { bb: 1.0 } => (), -LL + Foo::Baz { bb: 1.0, a } => (), - | +LL | Foo::Baz { bb: 1.0, a } => (), + | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Baz { bb: 1.0 } => (), -LL + Foo::Baz { bb: 1.0, a: _ } => (), - | +LL | Foo::Baz { bb: 1.0, a: _ } => (), + | ~~~~~~~~ help: or always ignore missing fields here | -LL - Foo::Baz { bb: 1.0 } => (), -LL + Foo::Baz { bb: 1.0, .. } => (), - | +LL | Foo::Baz { bb: 1.0, .. } => (), + | ~~~~~~ error[E0026]: variant `Foo::Bar` does not have a field named `aa` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:20:23 @@ -74,19 +68,16 @@ LL | Foo::Bar { a, aa: "", c } => (), | help: include the missing field in the pattern | -LL - Foo::Bar { a, aa: "", c } => (), -LL + Foo::Bar { a, aa: "", c, b } => (), - | +LL | Foo::Bar { a, aa: "", c, b } => (), + | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Bar { a, aa: "", c } => (), -LL + Foo::Bar { a, aa: "", c, b: _ } => (), - | +LL | Foo::Bar { a, aa: "", c, b: _ } => (), + | ~~~~~~~~ help: or always ignore missing fields here | -LL - Foo::Bar { a, aa: "", c } => (), -LL + Foo::Bar { a, aa: "", c, .. } => (), - | +LL | Foo::Bar { a, aa: "", c, .. } => (), + | ~~~~~~ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:23:20 @@ -102,19 +93,16 @@ LL | Foo::Baz { bb: "" } => (), | help: include the missing field in the pattern | -LL - Foo::Baz { bb: "" } => (), -LL + Foo::Baz { bb: "", a } => (), - | +LL | Foo::Baz { bb: "", a } => (), + | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Baz { bb: "" } => (), -LL + Foo::Baz { bb: "", a: _ } => (), - | +LL | Foo::Baz { bb: "", a: _ } => (), + | ~~~~~~~~ help: or always ignore missing fields here | -LL - Foo::Baz { bb: "" } => (), -LL + Foo::Baz { bb: "", .. } => (), - | +LL | Foo::Baz { bb: "", .. } => (), + | ~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr index 54c927b59d47f..5af2c3fbd9b98 100644 --- a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr +++ b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr @@ -11,9 +11,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match x { -LL + match *x { - | +LL | match *x { + | ~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:9:9 @@ -28,9 +27,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match x { -LL + match *x { - | +LL | match *x { + | ~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:16:9 @@ -79,9 +77,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y { -LL + match *y { - | +LL | match *y { + | ~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:28:9 @@ -96,9 +93,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y { -LL + match *y { - | +LL | match *y { + | ~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:36:9 @@ -147,9 +143,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_const { -LL + match &**z_const { - | +LL | match &**z_const { + | ~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:48:9 @@ -164,9 +159,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_const { -LL + match &**z_const { - | +LL | match &**z_const { + | ~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:57:9 @@ -181,9 +175,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_mut { -LL + match &**z_mut { - | +LL | match &**z_mut { + | ~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:59:9 @@ -198,9 +191,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_mut { -LL + match &**z_mut { - | +LL | match &**z_mut { + | ~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:68:9 @@ -215,9 +207,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y_mut { -LL + match &**y_mut { - | +LL | match &**y_mut { + | ~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:70:9 @@ -232,9 +223,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y_mut { -LL + match &**y_mut { - | +LL | match &**y_mut { + | ~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:79:9 diff --git a/tests/ui/suggestions/type-mismatch-byte-literal.stderr b/tests/ui/suggestions/type-mismatch-byte-literal.stderr index e96ead569d980..3d27149f0dcf1 100644 --- a/tests/ui/suggestions/type-mismatch-byte-literal.stderr +++ b/tests/ui/suggestions/type-mismatch-byte-literal.stderr @@ -8,9 +8,8 @@ LL | let _x: u8 = 'X'; | help: if you meant to write a byte literal, prefix with `b` | -LL - let _x: u8 = 'X'; -LL + let _x: u8 = b'X'; - | +LL | let _x: u8 = b'X'; + | ~~~~ error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:11:9 @@ -27,9 +26,8 @@ LL | fn foo(_t: u8) {} | ^^^ ------ help: if you meant to write a byte literal, prefix with `b` | -LL - foo('#'); -LL + foo(b'#'); - | +LL | foo(b'#'); + | ~~~~ error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:15:18 @@ -41,9 +39,8 @@ LL | let _a: u8 = '\x20'; | help: if you meant to write a byte literal, prefix with `b` | -LL - let _a: u8 = '\x20'; -LL + let _a: u8 = b'\x20'; - | +LL | let _a: u8 = b'\x20'; + | ~~~~~~~ error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:20:9 diff --git a/tests/ui/test-attrs/inaccessible-test-modules.stderr b/tests/ui/test-attrs/inaccessible-test-modules.stderr index 39f69b164fb00..7635f579d66b9 100644 --- a/tests/ui/test-attrs/inaccessible-test-modules.stderr +++ b/tests/ui/test-attrs/inaccessible-test-modules.stderr @@ -12,9 +12,8 @@ LL | use test as y; | help: consider importing this module instead | -LL - use test as y; -LL + use test::test as y; - | +LL | use test::test as y; + | ~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr index 23974c5b4aaa4..7985b611a4f60 100644 --- a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr +++ b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr @@ -14,9 +14,8 @@ LL + struct Foo where T: Bar, T: Bar { | help: a trait with a similar name exists | -LL - struct Foo where T: Bar, ::Baz: String { -LL + struct Foo where T: Bar, ::Baz: ToString { - | +LL | struct Foo where T: Bar, ::Baz: ToString { + | ~~~~~~~~ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:9:54 @@ -34,9 +33,8 @@ LL + struct Qux<'a, T> where T: Bar, &'a T: Bar { | help: a trait with a similar name exists | -LL - struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { -LL + struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: ToString { - | +LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: ToString { + | ~~~~~~~~ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:13:45 @@ -54,9 +52,8 @@ LL + fn foo(_: T) where T: Bar { | help: a trait with a similar name exists | -LL - fn foo(_: T) where ::Baz: String { -LL + fn foo(_: T) where ::Baz: ToString { - | +LL | fn foo(_: T) where ::Baz: ToString { + | ~~~~~~~~ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:16:57 @@ -74,9 +71,8 @@ LL + fn qux<'a, T: Bar>(_: &'a T) where &'a T: Bar { | help: a trait with a similar name exists | -LL - fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { -LL + fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString { - | +LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString { + | ~~~~~~~~ error[E0405]: cannot find trait `Unresolved` in this scope --> $DIR/assoc_type_bound_with_struct.rs:19:31 diff --git a/tests/ui/type/issue-100584.stderr b/tests/ui/type/issue-100584.stderr index 7cbab1540660c..e1db14d1f001b 100644 --- a/tests/ui/type/issue-100584.stderr +++ b/tests/ui/type/issue-100584.stderr @@ -19,9 +19,8 @@ LL | let _ = format!("{xyza}"); | ++++++++ + help: if this is intentional, prefix it with an underscore | -LL - fn foo(xyza: &str) { -LL + fn foo(_xyza: &str) { - | +LL | fn foo(_xyza: &str) { + | ~~~~~ error: unused variable: `xyza` --> $DIR/issue-100584.rs:7:9 @@ -38,9 +37,8 @@ LL | let _ = format!("aaa{xyza}bbb"); | ++++++++ + help: if this is intentional, prefix it with an underscore | -LL - fn foo3(xyza: &str) { -LL + fn foo3(_xyza: &str) { - | +LL | fn foo3(_xyza: &str) { + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr index aaf41ed6eba23..19b0c1059c86f 100644 --- a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr +++ b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr @@ -6,9 +6,8 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); | help: if you meant to write a byte literal, prefix with `b` | -LL - const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); -LL + const BAD_NESTING4: pattern_type!(u8 is b'a'..='a') = todo!(); - | +LL | const BAD_NESTING4: pattern_type!(u8 is b'a'..='a') = todo!(); + | ~~~~ error[E0308]: mismatched types --> $DIR/pattern_type_mismatch.rs:8:47 @@ -18,9 +17,8 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); | help: if you meant to write a byte literal, prefix with `b` | -LL - const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); -LL + const BAD_NESTING4: pattern_type!(u8 is 'a'..=b'a') = todo!(); - | +LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..=b'a') = todo!(); + | ~~~~ error[E0308]: mismatched types --> $DIR/pattern_type_mismatch.rs:12:43 diff --git a/tests/ui/typeck/mismatched-map-under-self.stderr b/tests/ui/typeck/mismatched-map-under-self.stderr index fd6b3093ec977..59de00a58bbea 100644 --- a/tests/ui/typeck/mismatched-map-under-self.stderr +++ b/tests/ui/typeck/mismatched-map-under-self.stderr @@ -13,9 +13,8 @@ LL | fn values(&self) -> Self::Values; found signature `fn(Option<_>)` help: change the self-receiver type to match the trait | -LL - fn values(self) -> Self::Values { -LL + fn values(&self) -> Self::Values { - | +LL | fn values(&self) -> Self::Values { + | ~~~~~ error[E0631]: type mismatch in function arguments --> $DIR/mismatched-map-under-self.rs:12:18 diff --git a/tests/ui/unresolved/unresolved-candidates.stderr b/tests/ui/unresolved/unresolved-candidates.stderr index 0810f90306e89..7ef2f6b1a2922 100644 --- a/tests/ui/unresolved/unresolved-candidates.stderr +++ b/tests/ui/unresolved/unresolved-candidates.stderr @@ -6,9 +6,8 @@ LL | use Trait; | help: consider importing this trait instead | -LL - use Trait; -LL + use a::Trait; - | +LL | use a::Trait; + | ~~~~~~~~ error[E0405]: cannot find trait `Trait` in this scope --> $DIR/unresolved-candidates.rs:10:10 From 6d71251cf9e40326461f90f8ff9a7024706aea87 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 13 Feb 2025 03:21:25 +0000 Subject: [PATCH 12/12] Trim suggestion parts to the subset that is purely additive --- compiler/rustc_errors/src/emitter.rs | 22 +++++++--- compiler/rustc_errors/src/lib.rs | 18 ++++++++ .../clippy/tests/ui/implicit_return.stderr | 42 +++++++------------ .../tests/ui/legacy_numeric_constants.stderr | 5 +-- .../defaults-suitability.current.stderr | 2 +- .../defaults-suitability.next.stderr | 2 +- tests/ui/associated-types/issue-38821.stderr | 4 +- .../issue-54108.current.stderr | 2 +- .../associated-types/issue-54108.next.stderr | 2 +- tests/ui/attributes/rustc_confusables.stderr | 2 +- .../rustc_confusables_std_cases.stderr | 4 +- .../issue-115259-suggest-iter-mut.stderr | 2 +- .../issue-62387-suggest-iter-mut-2.stderr | 2 +- .../issue-62387-suggest-iter-mut.stderr | 4 +- tests/ui/c-variadic/issue-86053-1.stderr | 2 +- tests/ui/cfg/cfg-method-receiver.stderr | 2 +- tests/ui/check-cfg/diagnotics.cargo.stderr | 2 +- tests/ui/check-cfg/diagnotics.rustc.stderr | 2 +- .../2229_closure_analysis/bad-pattern.stderr | 2 +- .../2229_closure_analysis/issue-118144.stderr | 2 +- tests/ui/closures/issue-78720.stderr | 2 +- tests/ui/compare-method/bad-self-type.stderr | 2 +- .../ensure_is_evaluatable.stderr | 2 +- .../fn_with_two_const_inputs.stderr | 2 +- .../abstract-const-as-cast-3.stderr | 8 ++-- .../doesnt_unify_evaluatable.stderr | 2 +- .../const_kind_expr/issue_114151.stderr | 2 +- .../const_kind_expr/wf_obligation.stderr | 2 +- ...e-a-closure-or-coroutine-ice-113776.stderr | 2 +- .../consts/const-pattern-irrefutable.stderr | 6 +-- .../dont-suggest-hygienic-fields.stderr | 2 +- .../dropck/explicit-drop-bounds.bad1.stderr | 4 +- .../issue-90528-unsizing-suggestion-3.stderr | 2 +- .../ui/empty/empty-struct-braces-expr.stderr | 6 +-- tests/ui/empty/empty-struct-tuple-pat.stderr | 2 +- .../error-recovery-issue-55897.stderr | 2 +- tests/ui/error-codes/E0027.stderr | 6 +-- tests/ui/extern/not-in-block.stderr | 4 +- ...-gate-unboxed-closures-manual-impls.stderr | 2 +- .../no-inline-literals-out-of-range.stderr | 2 +- .../no-method-suggested-traits.stderr | 12 +++--- tests/ui/imports/glob-resolve1.stderr | 2 +- .../ui/imports/issue-45829/import-self.stderr | 2 +- ...est-import-issue-120074.edition2015.stderr | 2 +- ...est-import-issue-120074.edition2021.stderr | 2 +- tests/ui/issues/issue-32004.stderr | 2 +- .../ui/issues/issue-41652/issue-41652.stderr | 2 +- tests/ui/issues/issue-51874.stderr | 2 +- tests/ui/issues/issue-5358-1.stderr | 2 +- tests/ui/issues/issue-56175.stderr | 2 +- .../issue-57741.stderr | 8 ++-- .../let-else/let-else-deref-coercion.stderr | 4 +- tests/ui/lexer/lex-bad-char-literals-1.stderr | 2 +- .../lifetimes/borrowck-let-suggestion.stderr | 2 +- .../issue-119696-err-on-fn.stderr | 2 +- .../issue-119697-extra-let.stderr | 2 +- .../let_underscore/let_underscore_drop.stderr | 2 +- .../let_underscore/let_underscore_lock.stderr | 8 ++-- .../lint-strict-provenance-lossy-casts.stderr | 2 +- tests/ui/lint/static-mut-refs.e2021.stderr | 12 +++--- tests/ui/lint/static-mut-refs.e2024.stderr | 12 +++--- tests/ui/lint/type-overflow.stderr | 4 +- ...ue-67691-unused-field-in-or-pattern.stderr | 4 +- .../macros/expr_2021_cargo_fix_edition.stderr | 4 +- .../macro-backtrace-invalid-internals.stderr | 4 +- tests/ui/match/issue-56685.stderr | 8 ++-- tests/ui/methods/issues/issue-90315.stderr | 2 +- .../method-on-ambiguous-numeric-type.stderr | 2 +- tests/ui/mir/issue-112269.stderr | 4 +- tests/ui/mismatched_types/issue-112036.stderr | 2 +- ...use_of_moved_value_copy_suggestions.stderr | 2 +- tests/ui/namespace/namespace-mix.stderr | 8 ++-- .../projection-no-regions-closure.stderr | 4 +- .../projection-no-regions-fn.stderr | 4 +- ...tion-two-region-trait-bound-closure.stderr | 4 +- ...ection-where-clause-env-wrong-bound.stderr | 2 +- ...ion-where-clause-env-wrong-lifetime.stderr | 2 +- tests/ui/object-pointer-types.stderr | 2 +- tests/ui/parser/bad-char-literals.stderr | 2 +- .../bad-escape-suggest-raw-string.stderr | 2 +- tests/ui/parser/byte-literals.stderr | 2 +- tests/ui/parser/extern-no-fn.stderr | 2 +- ...sue-65257-invalid-var-decl-recovery.stderr | 4 +- .../issues/issue-87086-colon-path-sep.stderr | 12 +++--- .../ui/parser/missing-fn-issue-65381-2.stderr | 2 +- .../parser/misspelled-keywords/const.stderr | 2 +- .../turbofish-arg-with-stray-colon.stderr | 2 +- tests/ui/parser/use-colon-as-mod-sep.stderr | 8 ++-- .../pat-tuple-field-count-cross.stderr | 2 +- tests/ui/pattern/pat-tuple-overfield.stderr | 2 +- .../patkind-ref-binding-issue-114896.stderr | 2 +- .../patkind-ref-binding-issue-122415.stderr | 2 +- .../usefulness/doc-hidden-fields.stderr | 18 ++++---- .../usefulness/stable-gated-fields.stderr | 6 +-- tests/ui/privacy/suggest-box-new.stderr | 4 +- tests/ui/pub/pub-ident-fn-or-struct.stderr | 2 +- tests/ui/pub/pub-restricted.stderr | 10 ++--- .../const-with-typo-in-pattern-binding.stderr | 2 +- tests/ui/resolve/issue-39226.stderr | 2 +- tests/ui/resolve/issue-55673.stderr | 2 +- tests/ui/resolve/issue-73427.stderr | 14 +++---- tests/ui/resolve/privacy-enum-ctor.stderr | 2 +- .../resolve/resolve-inconsistent-names.stderr | 4 +- ...t.import_trait_associated_functions.stderr | 2 +- ...lve-issue-135614-assoc-const.normal.stderr | 2 +- ...e-with-name-similar-to-struct-field.stderr | 2 +- .../typo-suggestion-mistyped-in-path.stderr | 2 +- .../rfc-2008-non-exhaustive/struct.stderr | 6 +-- .../rfc-2008-non-exhaustive/variant.stderr | 4 +- .../not-allowed.stderr | 2 +- .../rust-2018/trait-import-suggestions.stderr | 2 +- ...lity-attribute-implies-using-stable.stderr | 2 +- ...ty-attribute-implies-using-unstable.stderr | 2 +- ...lity-attribute-implies-using-stable.stderr | 2 +- ...ty-attribute-implies-using-unstable.stderr | 2 +- tests/ui/statics/issue-15261.stderr | 2 +- .../statics/static-mut-shared-parens.stderr | 2 +- tests/ui/statics/static-mut-xc.stderr | 2 +- tests/ui/statics/static-recursive.stderr | 2 +- .../struct-fields-hints-no-dupe.stderr | 2 +- .../structs/struct-pat-derived-error.stderr | 6 +-- .../structs/struct-tuple-field-names.stderr | 6 +-- ...ing-field-when-specifying-same-type.stderr | 24 +++++------ tests/ui/suggestions/bound-suggestions.stderr | 2 +- ...const-pat-non-exaustive-let-new-var.stderr | 2 +- .../suggestions/crate-or-module-typo.stderr | 4 +- ...atible-trait-should-use-where-sized.stderr | 2 +- tests/ui/suggestions/field-access.stderr | 6 +-- .../imm-ref-trait-object-literal.stderr | 2 +- .../impl-trait-missing-lifetime-gated.stderr | 8 ++-- ...t-field-type-including-single-colon.stderr | 4 +- .../ui/suggestions/suggest-change-mut.stderr | 2 +- ...suggest-deref-in-match-issue-132784.stderr | 20 ++++----- tests/ui/suggestions/suggest-methods.stderr | 2 +- tests/ui/suggestions/suggest-variants.stderr | 4 +- .../type-ascription-instead-of-path-2.stderr | 2 +- ...-ascription-instead-of-path-in-type.stderr | 2 +- .../type-mismatch-byte-literal.stderr | 6 +-- .../inaccessible-test-modules.stderr | 2 +- .../assoc_type_bound_with_struct.stderr | 8 ++-- .../type-match-with-late-bound.stderr | 6 +-- tests/ui/transmutability/assoc-bound.stderr | 2 +- tests/ui/type/issue-100584.stderr | 4 +- .../pattern_type_mismatch.stderr | 4 +- tests/ui/typeck/issue-29181.stderr | 2 +- tests/ui/typeck/method-chain-gats.stderr | 2 +- .../typeck/mismatched-map-under-self.stderr | 2 +- .../unresolved/unresolved-candidates.stderr | 2 +- 148 files changed, 321 insertions(+), 304 deletions(-) diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 7d58e6f29da7c..634afacf53900 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -1976,9 +1976,11 @@ impl HumanEmitter { Some(Style::HeaderMsg), ); + let other_suggestions = suggestions.len().saturating_sub(MAX_SUGGESTIONS); + let mut row_num = 2; for (i, (complete, parts, highlights, _)) in - suggestions.iter().enumerate().take(MAX_SUGGESTIONS) + suggestions.into_iter().enumerate().take(MAX_SUGGESTIONS) { debug!(?complete, ?parts, ?highlights); @@ -2168,7 +2170,7 @@ impl HumanEmitter { self.draw_code_line( &mut buffer, &mut row_num, - highlight_parts, + &highlight_parts, line_pos + line_start, line, show_code_change, @@ -2214,7 +2216,12 @@ impl HumanEmitter { if let DisplaySuggestion::Diff | DisplaySuggestion::Underline | DisplaySuggestion::Add = show_code_change { - for part in parts { + for mut part in parts { + // If this is a replacement of, e.g. `"a"` into `"ab"`, adjust the + // suggestion and snippet to look as if we just suggested to add + // `"b"`, which is typically much easier for the user to understand. + part.trim_trivial_replacements(sm); + let snippet = if let Ok(snippet) = sm.span_to_snippet(part.span) { snippet } else { @@ -2377,9 +2384,12 @@ impl HumanEmitter { row_num = row + 1; } } - if suggestions.len() > MAX_SUGGESTIONS { - let others = suggestions.len() - MAX_SUGGESTIONS; - let msg = format!("and {} other candidate{}", others, pluralize!(others)); + if other_suggestions > 0 { + let msg = format!( + "and {} other candidate{}", + other_suggestions, + pluralize!(other_suggestions) + ); buffer.puts(row_num, max_line_num_len + 3, &msg, Style::NoStyle); } diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 855b9734cdc5e..8ff5dc1259697 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -246,6 +246,24 @@ impl SubstitutionPart { sm.span_to_snippet(self.span) .map_or(!self.span.is_empty(), |snippet| !snippet.trim().is_empty()) } + + /// Try to turn a replacement into an addition when the span that is being + /// overwritten matches either the prefix or suffix of the replacement. + fn trim_trivial_replacements(&mut self, sm: &SourceMap) { + if self.snippet.is_empty() { + return; + } + let Ok(snippet) = sm.span_to_snippet(self.span) else { + return; + }; + if self.snippet.starts_with(&snippet) { + self.span = self.span.shrink_to_hi(); + self.snippet = self.snippet[snippet.len()..].to_string(); + } else if self.snippet.ends_with(&snippet) { + self.span = self.span.shrink_to_lo(); + self.snippet = self.snippet[..self.snippet.len() - snippet.len()].to_string(); + } + } } impl CodeSuggestion { diff --git a/src/tools/clippy/tests/ui/implicit_return.stderr b/src/tools/clippy/tests/ui/implicit_return.stderr index 0d2faa5e067bf..7ea72307450c7 100644 --- a/src/tools/clippy/tests/ui/implicit_return.stderr +++ b/src/tools/clippy/tests/ui/implicit_return.stderr @@ -8,8 +8,7 @@ LL | true = help: to override `-D warnings` add `#[allow(clippy::implicit_return)]` help: add `return` as shown | -LL - true -LL + return true +LL | return true | error: missing `return` statement @@ -20,9 +19,8 @@ LL | if true { true } else { false } | help: add `return` as shown | -LL - if true { true } else { false } -LL + if true { return true } else { false } - | +LL | if true { return true } else { false } + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:19:29 @@ -32,9 +30,8 @@ LL | if true { true } else { false } | help: add `return` as shown | -LL - if true { true } else { false } -LL + if true { true } else { return false } - | +LL | if true { true } else { return false } + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:25:17 @@ -44,9 +41,8 @@ LL | true => false, | help: add `return` as shown | -LL - true => false, -LL + true => return false, - | +LL | true => return false, + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:26:20 @@ -56,9 +52,8 @@ LL | false => { true }, | help: add `return` as shown | -LL - false => { true }, -LL + false => { return true }, - | +LL | false => { return true }, + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:39:9 @@ -104,9 +99,8 @@ LL | let _ = || { true }; | help: add `return` as shown | -LL - let _ = || { true }; -LL + let _ = || { return true }; - | +LL | let _ = || { return true }; + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:73:16 @@ -116,9 +110,8 @@ LL | let _ = || true; | help: add `return` as shown | -LL - let _ = || true; -LL + let _ = || return true; - | +LL | let _ = || return true; + | ++++++ error: missing `return` statement --> tests/ui/implicit_return.rs:81:5 @@ -128,8 +121,7 @@ LL | format!("test {}", "test") | help: add `return` as shown | -LL - format!("test {}", "test") -LL + return format!("test {}", "test") +LL | return format!("test {}", "test") | error: missing `return` statement @@ -140,8 +132,7 @@ LL | m!(true, false) | help: add `return` as shown | -LL - m!(true, false) -LL + return m!(true, false) +LL | return m!(true, false) | error: missing `return` statement @@ -191,8 +182,7 @@ LL | true | help: add `return` as shown | -LL - true -LL + return true +LL | return true | error: aborting due to 16 previous errors diff --git a/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr b/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr index 74fe09e0f5c60..91dfe79d55bab 100644 --- a/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr +++ b/src/tools/clippy/tests/ui/legacy_numeric_constants.stderr @@ -68,9 +68,8 @@ LL | MAX; | help: use the associated constant instead | -LL - MAX; -LL + u32::MAX; - | +LL | u32::MAX; + | +++++ error: usage of a legacy numeric method --> tests/ui/legacy_numeric_constants.rs:49:10 diff --git a/tests/ui/associated-types/defaults-suitability.current.stderr b/tests/ui/associated-types/defaults-suitability.current.stderr index 61247cee1f34d..5e19674250f0b 100644 --- a/tests/ui/associated-types/defaults-suitability.current.stderr +++ b/tests/ui/associated-types/defaults-suitability.current.stderr @@ -135,7 +135,7 @@ LL | type Baz = T; help: consider further restricting type parameter `T` with trait `Clone` | LL | Self::Baz: Clone, T: std::clone::Clone - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error: aborting due to 8 previous errors diff --git a/tests/ui/associated-types/defaults-suitability.next.stderr b/tests/ui/associated-types/defaults-suitability.next.stderr index 61247cee1f34d..5e19674250f0b 100644 --- a/tests/ui/associated-types/defaults-suitability.next.stderr +++ b/tests/ui/associated-types/defaults-suitability.next.stderr @@ -135,7 +135,7 @@ LL | type Baz = T; help: consider further restricting type parameter `T` with trait `Clone` | LL | Self::Baz: Clone, T: std::clone::Clone - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error: aborting due to 8 previous errors diff --git a/tests/ui/associated-types/issue-38821.stderr b/tests/ui/associated-types/issue-38821.stderr index 58f019704e7a7..dc919299710bc 100644 --- a/tests/ui/associated-types/issue-38821.stderr +++ b/tests/ui/associated-types/issue-38821.stderr @@ -14,7 +14,7 @@ LL | impl IntoNullable for T { help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | LL | Expr: Expression::Nullable>, ::SqlType: NotNull - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++++++++++ error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:40:1 @@ -38,7 +38,7 @@ LL | impl IntoNullable for T { help: consider extending the `where` clause, but there might be an alternative better way to express this requirement | LL | Expr: Expression::Nullable>, ::SqlType: NotNull - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++++++++++ error[E0277]: the trait bound `::SqlType: NotNull` is not satisfied --> $DIR/issue-38821.rs:23:10 diff --git a/tests/ui/associated-types/issue-54108.current.stderr b/tests/ui/associated-types/issue-54108.current.stderr index 8850b4548e33a..115a591c68f16 100644 --- a/tests/ui/associated-types/issue-54108.current.stderr +++ b/tests/ui/associated-types/issue-54108.current.stderr @@ -13,7 +13,7 @@ LL | type Size: Add; help: consider further restricting the associated type | LL | T: SubEncoder, ::ActualSize: Add - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/issue-54108.next.stderr b/tests/ui/associated-types/issue-54108.next.stderr index 5e2fa551afe30..e6d65d8246a11 100644 --- a/tests/ui/associated-types/issue-54108.next.stderr +++ b/tests/ui/associated-types/issue-54108.next.stderr @@ -13,7 +13,7 @@ LL | type Size: Add; help: consider further restricting the associated type | LL | T: SubEncoder, ::ActualSize: Add - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/attributes/rustc_confusables.stderr b/tests/ui/attributes/rustc_confusables.stderr index 9ba1e3270573f..dc71d974daf56 100644 --- a/tests/ui/attributes/rustc_confusables.stderr +++ b/tests/ui/attributes/rustc_confusables.stderr @@ -36,7 +36,7 @@ LL | x.inser(); help: there is a method `insert` with a similar name | LL | x.insert(); - | ~~~~~~ + | + error[E0599]: no method named `foo` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope --> $DIR/rustc_confusables.rs:15:7 diff --git a/tests/ui/attributes/rustc_confusables_std_cases.stderr b/tests/ui/attributes/rustc_confusables_std_cases.stderr index 7108887043b2c..f2d9ebe2c0eae 100644 --- a/tests/ui/attributes/rustc_confusables_std_cases.stderr +++ b/tests/ui/attributes/rustc_confusables_std_cases.stderr @@ -39,7 +39,7 @@ LL | let mut x = VecDeque::new(); help: you might have meant to use `push_back` | LL | x.push_back(1); - | ~~~~~~~~~ + | +++++ error[E0599]: no method named `length` found for struct `Vec<{integer}>` in the current scope --> $DIR/rustc_confusables_std_cases.rs:15:7 @@ -98,7 +98,7 @@ note: method defined here help: you might have meant to use `push_str` | LL | String::new().push_str(""); - | ~~~~~~~~ + | ++++ error[E0599]: no method named `append` found for struct `String` in the current scope --> $DIR/rustc_confusables_std_cases.rs:24:19 diff --git a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr index 40ab2e61d6a42..61c01f0f024fe 100644 --- a/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr +++ b/tests/ui/borrowck/issue-115259-suggest-iter-mut.stderr @@ -9,7 +9,7 @@ LL | self.layers.iter().fold(0, |result, mut layer| result + layer.proce help: you may want to use `iter_mut` here | LL | self.layers.iter_mut().fold(0, |result, mut layer| result + layer.process()) - | ~~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr index 466f19eb0ab95..c6955317d87d5 100644 --- a/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr +++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut-2.stderr @@ -9,7 +9,7 @@ LL | vec.iter().flat_map(|container| container.things()).cloned().co help: you may want to use `iter_mut` here | LL | vec.iter_mut().flat_map(|container| container.things()).cloned().collect::>(); - | ~~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr index fd58e43302025..ae4920b2a8cb0 100644 --- a/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr +++ b/tests/ui/borrowck/issue-62387-suggest-iter-mut.stderr @@ -9,7 +9,7 @@ LL | v.iter().for_each(|a| a.double()); help: you may want to use `iter_mut` here | LL | v.iter_mut().for_each(|a| a.double()); - | ~~~~~~~~ + | ++++ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference --> $DIR/issue-62387-suggest-iter-mut.rs:25:39 @@ -22,7 +22,7 @@ LL | v.iter().rev().rev().for_each(|a| a.double()); help: you may want to use `iter_mut` here | LL | v.iter_mut().rev().rev().for_each(|a| a.double()); - | ~~~~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/c-variadic/issue-86053-1.stderr b/tests/ui/c-variadic/issue-86053-1.stderr index 67a619e46d57d..ce31f0d300f1f 100644 --- a/tests/ui/c-variadic/issue-86053-1.stderr +++ b/tests/ui/c-variadic/issue-86053-1.stderr @@ -64,7 +64,7 @@ LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize help: a trait with a similar name exists | LL | self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) { - | ~~ + | + help: you might be missing a type parameter | LL | fn ordering4 < 'a , 'b, F > ( a : , self , self , self , diff --git a/tests/ui/cfg/cfg-method-receiver.stderr b/tests/ui/cfg/cfg-method-receiver.stderr index 5767a7c1b4b1c..44f3d8d058e04 100644 --- a/tests/ui/cfg/cfg-method-receiver.stderr +++ b/tests/ui/cfg/cfg-method-receiver.stderr @@ -17,7 +17,7 @@ LL | cbor_map! { #[cfg(test)] 4}; help: you must specify a concrete type for this numeric value, like `i32` | LL | cbor_map! { #[cfg(test)] 4_i32}; - | ~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/check-cfg/diagnotics.cargo.stderr b/tests/ui/check-cfg/diagnotics.cargo.stderr index a75a45b7d3727..ebfc9a935d20c 100644 --- a/tests/ui/check-cfg/diagnotics.cargo.stderr +++ b/tests/ui/check-cfg/diagnotics.cargo.stderr @@ -18,7 +18,7 @@ LL | #[cfg(featur = "foo")] help: there is a config with a similar name and value | LL | #[cfg(feature = "foo")] - | ~~~~~~~ + | + warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:17:7 diff --git a/tests/ui/check-cfg/diagnotics.rustc.stderr b/tests/ui/check-cfg/diagnotics.rustc.stderr index df549b31364a3..8860b3ff5da57 100644 --- a/tests/ui/check-cfg/diagnotics.rustc.stderr +++ b/tests/ui/check-cfg/diagnotics.rustc.stderr @@ -20,7 +20,7 @@ LL | #[cfg(featur = "foo")] help: there is a config with a similar name and value | LL | #[cfg(feature = "foo")] - | ~~~~~~~ + | + warning: unexpected `cfg` condition name: `featur` --> $DIR/diagnotics.rs:17:7 diff --git a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr index b5ad8eb790f2b..ced582c9ff5a0 100644 --- a/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr +++ b/tests/ui/closures/2229_closure_analysis/bad-pattern.stderr @@ -109,7 +109,7 @@ LL | let PAT = v1; help: introduce a variable instead | LL | let PAT_var = v1; - | ~~~~~~~ + | ++++ error: aborting due to 7 previous errors diff --git a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr index 87084e6023729..bfe4afc4b58cb 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr +++ b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr @@ -9,7 +9,7 @@ LL | V(x) = func_arg; help: consider dereferencing to access the inner value using the Deref trait | LL | V(x) = &*func_arg; - | ~~~~~~~~~~ + | ++ error: aborting due to 1 previous error diff --git a/tests/ui/closures/issue-78720.stderr b/tests/ui/closures/issue-78720.stderr index 5d65c87b0fd61..90672cd83d7cf 100644 --- a/tests/ui/closures/issue-78720.stderr +++ b/tests/ui/closures/issue-78720.stderr @@ -16,7 +16,7 @@ LL | _func: F, help: a trait with a similar name exists | LL | _func: Fn, - | ~~ + | + help: you might be missing a type parameter | LL | struct Map2 { diff --git a/tests/ui/compare-method/bad-self-type.stderr b/tests/ui/compare-method/bad-self-type.stderr index 0a05b0a83af4f..bc1587883a352 100644 --- a/tests/ui/compare-method/bad-self-type.stderr +++ b/tests/ui/compare-method/bad-self-type.stderr @@ -9,7 +9,7 @@ LL | fn poll(self, _: &mut Context<'_>) -> Poll<()> { help: change the self-receiver type to match the trait | LL | fn poll(self: Pin<&mut MyFuture>, _: &mut Context<'_>) -> Poll<()> { - | ~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error[E0053]: method `foo` has an incompatible type for trait --> $DIR/bad-self-type.rs:22:18 diff --git a/tests/ui/const-generics/ensure_is_evaluatable.stderr b/tests/ui/const-generics/ensure_is_evaluatable.stderr index 62f8bc34f2edd..0a03ea49de179 100644 --- a/tests/ui/const-generics/ensure_is_evaluatable.stderr +++ b/tests/ui/const-generics/ensure_is_evaluatable.stderr @@ -15,7 +15,7 @@ LL | [(); N + 1]:, help: try adding a `where` bound | LL | [(); M + 1]:, [(); N + 1]: - | ~~~~~~~~~~~~~~ + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/fn_with_two_const_inputs.stderr b/tests/ui/const-generics/fn_with_two_const_inputs.stderr index c0a913a21fd2d..7fb79da2d6143 100644 --- a/tests/ui/const-generics/fn_with_two_const_inputs.stderr +++ b/tests/ui/const-generics/fn_with_two_const_inputs.stderr @@ -15,7 +15,7 @@ LL | [(); N + 1]:, help: try adding a `where` bound | LL | [(); both(N + 1, M + 1)]:, [(); N + 1]: - | ~~~~~~~~~~~~~~ + | ++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr index 3622ef16a9608..8d0b2e914732d 100644 --- a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr +++ b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr @@ -17,7 +17,7 @@ LL | fn assert_impl() {} help: try adding a `where` bound | LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:17:5 @@ -52,7 +52,7 @@ LL | fn assert_impl() {} help: try adding a `where` bound | LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:20:5 @@ -115,7 +115,7 @@ LL | fn assert_impl() {} help: try adding a `where` bound | LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:35:5 @@ -150,7 +150,7 @@ LL | fn assert_impl() {} help: try adding a `where` bound | LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++++++ error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:38:5 diff --git a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr index f3a38fcc00544..6cf4e881adae8 100644 --- a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr +++ b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr @@ -7,7 +7,7 @@ LL | bar::<{ T::ASSOC }>(); help: try adding a `where` bound | LL | fn foo() where [(); U::ASSOC]:, [(); { T::ASSOC }]: { - | ~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr index 4d1fb02b59e91..3c79cbeb730d5 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr @@ -27,7 +27,7 @@ LL | foo::<_, L>([(); L + 1 + L]); help: try adding a `where` bound | LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: - | ~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++ error: unconstrained generic constant --> $DIR/issue_114151.rs:17:17 diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr index 99eab935a094c..af4543e7ef2bb 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr @@ -16,7 +16,7 @@ LL | foo::<_, L>([(); L + 1 + L]); help: try adding a `where` bound | LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: - | ~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr index 86fbca585057a..b9db7461699fe 100644 --- a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr +++ b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr @@ -10,7 +10,7 @@ LL | let f: F = async { 1 }; help: a trait with a similar name exists | LL | let f: Fn = async { 1 }; - | ~~ + | + help: you might be missing a type parameter | LL | fn f( diff --git a/tests/ui/consts/const-pattern-irrefutable.stderr b/tests/ui/consts/const-pattern-irrefutable.stderr index 4fa8caa57ce6e..06bd01bff79f0 100644 --- a/tests/ui/consts/const-pattern-irrefutable.stderr +++ b/tests/ui/consts/const-pattern-irrefutable.stderr @@ -13,7 +13,7 @@ LL | let a = 4; help: introduce a variable instead | LL | let a_var = 4; - | ~~~~~ + | ++++ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:28:9 @@ -48,7 +48,7 @@ LL | let d = (4, 4); help: introduce a variable instead | LL | let d_var = (4, 4); - | ~~~~~ + | ++++ error[E0005]: refutable pattern in local binding --> $DIR/const-pattern-irrefutable.rs:36:9 @@ -70,7 +70,7 @@ LL | struct S { help: introduce a variable instead | LL | let e_var = S { - | ~~~~~ + | ++++ error: aborting due to 4 previous errors diff --git a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr index 473c9a339fc25..411eec8496339 100644 --- a/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr +++ b/tests/ui/did_you_mean/dont-suggest-hygienic-fields.stderr @@ -11,7 +11,7 @@ LL | const CRATE: Crate = Crate { fiel: () }; help: a field with a similar name exists | LL | const CRATE: Crate = Crate { field: () }; - | ~~~~~ + | + error[E0609]: no field `field` on type `Compound` --> $DIR/dont-suggest-hygienic-fields.rs:24:16 diff --git a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr index 2caa779ffabac..12d7f5b6cd301 100644 --- a/tests/ui/dropck/explicit-drop-bounds.bad1.stderr +++ b/tests/ui/dropck/explicit-drop-bounds.bad1.stderr @@ -12,7 +12,7 @@ LL | struct DropMe(T); help: consider further restricting type parameter `T` with trait `Copy` | LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error[E0277]: the trait bound `T: Copy` is not satisfied --> $DIR/explicit-drop-bounds.rs:32:18 @@ -28,7 +28,7 @@ LL | struct DropMe(T); help: consider further restricting type parameter `T` with trait `Copy` | LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply `T: Copy` - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr index 774d5ba3c892c..db749436855d5 100644 --- a/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr +++ b/tests/ui/dst/issue-90528-unsizing-suggestion-3.stderr @@ -68,7 +68,7 @@ LL | fn wants_write(_: impl Write) {} help: consider changing this borrow's mutability | LL | wants_write(&mut [0u8][..]); - | ~~~~ + | +++ error: aborting due to 4 previous errors diff --git a/tests/ui/empty/empty-struct-braces-expr.stderr b/tests/ui/empty/empty-struct-braces-expr.stderr index cdedb3f20aab3..8ec8ecf46bf06 100644 --- a/tests/ui/empty/empty-struct-braces-expr.stderr +++ b/tests/ui/empty/empty-struct-braces-expr.stderr @@ -15,7 +15,7 @@ LL | pub struct XEmpty2; help: use struct literal syntax instead | LL | let e1 = Empty1 {}; - | ~~~~~~~~~ + | ++ help: a unit struct with a similar name exists | LL - let e1 = Empty1; @@ -38,7 +38,7 @@ LL | pub struct XEmpty2; help: use struct literal syntax instead | LL | let xe1 = XEmpty1 {}; - | ~~~~~~~~~~ + | ++ help: a unit struct with a similar name exists | LL - let xe1 = XEmpty1; @@ -126,7 +126,7 @@ LL | let xe3 = XE::Empty3; help: there is a variant with a similar name | LL | let xe3 = XE::XEmpty3; - | ~~~~~~~ + | + error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:26:19 diff --git a/tests/ui/empty/empty-struct-tuple-pat.stderr b/tests/ui/empty/empty-struct-tuple-pat.stderr index 19e44bacaa079..09b454653f62f 100644 --- a/tests/ui/empty/empty-struct-tuple-pat.stderr +++ b/tests/ui/empty/empty-struct-tuple-pat.stderr @@ -47,7 +47,7 @@ LL | XEmpty5(), help: use the tuple variant pattern syntax instead | LL | XE::XEmpty5() => (), - | ~~~~~~~~~~~~~ + | ++ help: a unit variant with a similar name exists | LL - XE::XEmpty5 => (), diff --git a/tests/ui/env-macro/error-recovery-issue-55897.stderr b/tests/ui/env-macro/error-recovery-issue-55897.stderr index 5a20bf8b16869..f1cacf5420eb6 100644 --- a/tests/ui/env-macro/error-recovery-issue-55897.stderr +++ b/tests/ui/env-macro/error-recovery-issue-55897.stderr @@ -31,7 +31,7 @@ LL | use env; help: consider importing this module instead | LL | use std::env; - | ~~~~~~~~ + | +++++ error: aborting due to 4 previous errors diff --git a/tests/ui/error-codes/E0027.stderr b/tests/ui/error-codes/E0027.stderr index 4a102629ad504..3a1ebf2971946 100644 --- a/tests/ui/error-codes/E0027.stderr +++ b/tests/ui/error-codes/E0027.stderr @@ -7,15 +7,15 @@ LL | Dog { age: x } => {} help: include the missing field in the pattern | LL | Dog { age: x, name } => {} - | ~~~~~~~~ + | ++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Dog { age: x, name: _ } => {} - | ~~~~~~~~~~~ + | +++++++++ help: or always ignore missing fields here | LL | Dog { age: x, .. } => {} - | ~~~~~~ + | ++++ error[E0027]: pattern does not mention field `age` --> $DIR/E0027.rs:15:9 diff --git a/tests/ui/extern/not-in-block.stderr b/tests/ui/extern/not-in-block.stderr index cd1cd0fa50e64..e35c50343fcc4 100644 --- a/tests/ui/extern/not-in-block.stderr +++ b/tests/ui/extern/not-in-block.stderr @@ -12,7 +12,7 @@ LL + extern fn none_fn(x: bool) -> i32 { } help: if you meant to declare an externally defined function, use an `extern` block | LL | extern { fn none_fn(x: bool) -> i32; } - | ~~~~~~~~ + + | + + error: free function without a body --> $DIR/not-in-block.rs:6:1 @@ -28,7 +28,7 @@ LL + extern "C" fn c_fn(x: bool) -> i32 { } help: if you meant to declare an externally defined function, use an `extern` block | LL | extern "C" { fn c_fn(x: bool) -> i32; } - | ~~~~~~~~~~~~ + + | + + error: aborting due to 2 previous errors diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index a50e5f2f73d90..214725b77c049 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -96,7 +96,7 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {} help: change the self-receiver type to match the trait | LL | extern "rust-call" fn call(&self, args: ()) -> () {} - | ~~~~~ + | + error[E0183]: manual implementations of `FnOnce` are experimental --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 diff --git a/tests/ui/fmt/no-inline-literals-out-of-range.stderr b/tests/ui/fmt/no-inline-literals-out-of-range.stderr index 25486b8547295..e17023887046f 100644 --- a/tests/ui/fmt/no-inline-literals-out-of-range.stderr +++ b/tests/ui/fmt/no-inline-literals-out-of-range.stderr @@ -52,7 +52,7 @@ LL | format_args!("{}", 0xffff_ffff); // treat unsuffixed literals as i32 help: to use as a negative number (decimal `-1`), consider using the type `u32` for the literal and cast it to `i32` | LL | format_args!("{}", 0xffff_ffffu32 as i32); // treat unsuffixed literals as i32 - | ~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/impl-trait/no-method-suggested-traits.stderr b/tests/ui/impl-trait/no-method-suggested-traits.stderr index 676247d1a423b..0a974668188e2 100644 --- a/tests/ui/impl-trait/no-method-suggested-traits.stderr +++ b/tests/ui/impl-trait/no-method-suggested-traits.stderr @@ -18,7 +18,7 @@ LL + use no_method_suggested_traits::qux::PrivPub; help: there is a method `method2` with a similar name | LL | 1u32.method2(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for struct `Rc<&mut Box<&u32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:26:44 @@ -40,7 +40,7 @@ LL + use no_method_suggested_traits::qux::PrivPub; help: there is a method `method2` with a similar name | LL | std::rc::Rc::new(&mut Box::new(&1u32)).method2(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for type `char` in the current scope --> $DIR/no-method-suggested-traits.rs:30:9 @@ -59,7 +59,7 @@ LL + use foo::Bar; help: there is a method `method2` with a similar name | LL | 'a'.method2(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for struct `Rc<&mut Box<&char>>` in the current scope --> $DIR/no-method-suggested-traits.rs:32:43 @@ -75,7 +75,7 @@ LL + use foo::Bar; help: there is a method `method2` with a similar name | LL | std::rc::Rc::new(&mut Box::new(&'a')).method2(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for type `i32` in the current scope --> $DIR/no-method-suggested-traits.rs:35:10 @@ -96,7 +96,7 @@ LL + use no_method_suggested_traits::foo::PubPub; help: there is a method `method3` with a similar name | LL | 1i32.method3(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for struct `Rc<&mut Box<&i32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:37:44 @@ -112,7 +112,7 @@ LL + use no_method_suggested_traits::foo::PubPub; help: there is a method `method3` with a similar name | LL | std::rc::Rc::new(&mut Box::new(&1i32)).method3(); - | ~~~~~~~ + | + error[E0599]: no method named `method` found for struct `Foo` in the current scope --> $DIR/no-method-suggested-traits.rs:40:9 diff --git a/tests/ui/imports/glob-resolve1.stderr b/tests/ui/imports/glob-resolve1.stderr index 4401ef58732e8..75e65681c3ab8 100644 --- a/tests/ui/imports/glob-resolve1.stderr +++ b/tests/ui/imports/glob-resolve1.stderr @@ -38,7 +38,7 @@ LL | | } help: you might have meant to use the following enum variant | LL | B::B1; - | ~~~~~ + | ++++ error[E0425]: cannot find value `C` in this scope --> $DIR/glob-resolve1.rs:29:5 diff --git a/tests/ui/imports/issue-45829/import-self.stderr b/tests/ui/imports/issue-45829/import-self.stderr index f15beac5e16da..b392d93c15410 100644 --- a/tests/ui/imports/issue-45829/import-self.stderr +++ b/tests/ui/imports/issue-45829/import-self.stderr @@ -33,7 +33,7 @@ LL | use foo::{self}; help: you can use `as` to change the binding name of the import | LL | use foo::{self as other_foo}; - | ~~~~~~~~~~~~~~~~~ + | ++++++++++++ error[E0255]: the name `foo` is defined multiple times --> $DIR/import-self.rs:12:5 diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr index 414eeee0fedc8..10b8db62edc91 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr @@ -7,7 +7,7 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing); help: a similar path exists | LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); - | ~~~~~~~~ + | +++++ help: consider importing this module | LL + use foo::bar; diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr index 414eeee0fedc8..10b8db62edc91 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr @@ -7,7 +7,7 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing); help: a similar path exists | LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); - | ~~~~~~~~ + | +++++ help: consider importing this module | LL + use foo::bar; diff --git a/tests/ui/issues/issue-32004.stderr b/tests/ui/issues/issue-32004.stderr index 6fa548015fa28..fcbec97661b4b 100644 --- a/tests/ui/issues/issue-32004.stderr +++ b/tests/ui/issues/issue-32004.stderr @@ -12,7 +12,7 @@ LL | Foo::Bar => {} help: use the tuple variant pattern syntax instead | LL | Foo::Bar(_) => {} - | ~~~~~~~~~~~ + | +++ help: a unit variant with a similar name exists | LL - Foo::Bar => {} diff --git a/tests/ui/issues/issue-41652/issue-41652.stderr b/tests/ui/issues/issue-41652/issue-41652.stderr index a5a2fab2ede03..4a81e76af75ec 100644 --- a/tests/ui/issues/issue-41652/issue-41652.stderr +++ b/tests/ui/issues/issue-41652/issue-41652.stderr @@ -7,7 +7,7 @@ LL | 3.f() help: you must specify a concrete type for this numeric value, like `i32` | LL | 3_i32.f() - | ~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-51874.stderr b/tests/ui/issues/issue-51874.stderr index 5be3695dd4548..5c9331b4e1e1a 100644 --- a/tests/ui/issues/issue-51874.stderr +++ b/tests/ui/issues/issue-51874.stderr @@ -7,7 +7,7 @@ LL | let a = (1.0).pow(1.0); help: you must specify a concrete type for this numeric value, like `f32` | LL | let a = (1.0_f32).pow(1.0); - | ~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-5358-1.stderr b/tests/ui/issues/issue-5358-1.stderr index 1bb946ce4cb54..e68db865dc414 100644 --- a/tests/ui/issues/issue-5358-1.stderr +++ b/tests/ui/issues/issue-5358-1.stderr @@ -15,7 +15,7 @@ LL | S(Either::Right(_)) => {} help: you might have meant to use field `0` whose type is `Either` | LL | match S(Either::Left(5)).0 { - | ~~~~~~~~~~~~~~~~~~~~ + | ++ error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-56175.stderr b/tests/ui/issues/issue-56175.stderr index 50c26b83dd379..df4cd6ce8a700 100644 --- a/tests/ui/issues/issue-56175.stderr +++ b/tests/ui/issues/issue-56175.stderr @@ -17,7 +17,7 @@ LL + use reexported_trait::Trait; help: there is a method `trait_method_b` with a similar name | LL | reexported_trait::FooStruct.trait_method_b(); - | ~~~~~~~~~~~~~~ + | ++ error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope --> $DIR/issue-56175.rs:7:33 diff --git a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr index 3c19b68cffbb3..62d83a5461484 100644 --- a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr +++ b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr @@ -11,7 +11,7 @@ LL | T::A(a) | T::B(a) => a, help: consider dereferencing the boxed value | LL | let y = match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/issue-57741.rs:20:19 @@ -26,7 +26,7 @@ LL | T::A(a) | T::B(a) => a, help: consider dereferencing the boxed value | LL | let y = match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:9 @@ -41,7 +41,7 @@ LL | S::A { a } | S::B { b: a } => a, help: consider dereferencing the boxed value | LL | let y = match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:22 @@ -56,7 +56,7 @@ LL | S::A { a } | S::B { b: a } => a, help: consider dereferencing the boxed value | LL | let y = match *x { - | ~~ + | + error: aborting due to 4 previous errors diff --git a/tests/ui/let-else/let-else-deref-coercion.stderr b/tests/ui/let-else/let-else-deref-coercion.stderr index da8b1f4c48e97..543737868c9ff 100644 --- a/tests/ui/let-else/let-else-deref-coercion.stderr +++ b/tests/ui/let-else/let-else-deref-coercion.stderr @@ -9,7 +9,7 @@ LL | let Bar::Present(z) = self else { help: consider dereferencing to access the inner value using the Deref trait | LL | let Bar::Present(z) = &**self else { - | ~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/let-else-deref-coercion.rs:68:13 @@ -22,7 +22,7 @@ LL | let Bar(z) = x; help: consider dereferencing to access the inner value using the Deref trait | LL | let Bar(z) = &**x; - | ~~~~ + | +++ error: aborting due to 2 previous errors diff --git a/tests/ui/lexer/lex-bad-char-literals-1.stderr b/tests/ui/lexer/lex-bad-char-literals-1.stderr index bf13df90be335..0985e274c0284 100644 --- a/tests/ui/lexer/lex-bad-char-literals-1.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-1.stderr @@ -33,7 +33,7 @@ LL | "\●" help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | LL | r"\●" - | ~~~~~ + | + error: aborting due to 4 previous errors diff --git a/tests/ui/lifetimes/borrowck-let-suggestion.stderr b/tests/ui/lifetimes/borrowck-let-suggestion.stderr index cca7f52957e4c..4703d7f10dc28 100644 --- a/tests/ui/lifetimes/borrowck-let-suggestion.stderr +++ b/tests/ui/lifetimes/borrowck-let-suggestion.stderr @@ -13,7 +13,7 @@ LL | x.use_mut(); help: consider consuming the `Vec` when turning it into an `Iterator` | LL | let mut x = vec![1].into_iter(); - | ~~~~~~~~~ + | +++++ help: consider using a `let` binding to create a longer lived value | LL ~ let binding = vec![1]; diff --git a/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr b/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr index 59f473b14d80c..105506968b16a 100644 --- a/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr +++ b/tests/ui/lint/let_underscore/issue-119696-err-on-fn.stderr @@ -12,7 +12,7 @@ LL | #![deny(let_underscore_drop)] help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = foo(); - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | LL - let _ = foo(); diff --git a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr index 3cef341ddb008..3ff57ab441dc9 100644 --- a/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr +++ b/tests/ui/lint/let_underscore/issue-119697-extra-let.stderr @@ -29,7 +29,7 @@ LL | let _ = field; help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = field; - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | LL - let _ = field; diff --git a/tests/ui/lint/let_underscore/let_underscore_drop.stderr b/tests/ui/lint/let_underscore/let_underscore_drop.stderr index a326cd4fec4f3..001827b0d37f5 100644 --- a/tests/ui/lint/let_underscore/let_underscore_drop.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_drop.stderr @@ -12,7 +12,7 @@ LL | #![warn(let_underscore_drop)] help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = NontrivialDrop; - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | LL - let _ = NontrivialDrop; diff --git a/tests/ui/lint/let_underscore/let_underscore_lock.stderr b/tests/ui/lint/let_underscore/let_underscore_lock.stderr index 90f661d379e64..a54a23e364b3b 100644 --- a/tests/ui/lint/let_underscore/let_underscore_lock.stderr +++ b/tests/ui/lint/let_underscore/let_underscore_lock.stderr @@ -8,7 +8,7 @@ LL | let _ = data.lock().unwrap(); help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = data.lock().unwrap(); - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | LL - let _ = data.lock().unwrap(); @@ -24,7 +24,7 @@ LL | let _ = data.lock(); help: consider binding to an unused variable to avoid immediately dropping the value | LL | let _unused = data.lock(); - | ~~~~~~~ + | ++++++ help: consider immediately dropping the value | LL - let _ = data.lock(); @@ -41,7 +41,7 @@ LL | let (_, _) = (data.lock(), 1); help: consider binding to an unused variable to avoid immediately dropping the value | LL | let (_unused, _) = (data.lock(), 1); - | ~~~~~~~ + | ++++++ error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:16:26 @@ -53,7 +53,7 @@ LL | let (_a, Struct { a: _ }) = (0, Struct { a: data.lock() }); help: consider binding to an unused variable to avoid immediately dropping the value | LL | let (_a, Struct { a: _unused }) = (0, Struct { a: data.lock() }); - | ~~~~~~~ + | ++++++ error: non-binding let on a synchronization lock --> $DIR/let_underscore_lock.rs:18:6 diff --git a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr index 1f528bdb28ff4..bcef0ae424e68 100644 --- a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr +++ b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr @@ -26,7 +26,7 @@ LL | let addr_32bit = &x as *const u8 as u32; help: use `.addr()` to obtain the address of a pointer | LL | let addr_32bit = (&x as *const u8).addr() as u32; - | + ~~~~~~~~~~~~~~~ + | + ++++++++ error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `usize` --> $DIR/lint-strict-provenance-lossy-casts.rs:14:20 diff --git a/tests/ui/lint/static-mut-refs.e2021.stderr b/tests/ui/lint/static-mut-refs.e2021.stderr index 39a4056dd7f44..337d5d0b307ee 100644 --- a/tests/ui/lint/static-mut-refs.e2021.stderr +++ b/tests/ui/lint/static-mut-refs.e2021.stderr @@ -10,7 +10,7 @@ LL | let _y = &X; help: use `&raw const` instead to create a raw pointer | LL | let _y = &raw const X; - | ~~~~~~~~~~ + | +++++++++ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:42:18 @@ -46,7 +46,7 @@ LL | let (_b, _c) = (&X, &Y); help: use `&raw const` instead to create a raw pointer | LL | let (_b, _c) = (&raw const X, &Y); - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:54:29 @@ -59,7 +59,7 @@ LL | let (_b, _c) = (&X, &Y); help: use `&raw const` instead to create a raw pointer | LL | let (_b, _c) = (&X, &raw const Y); - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:60:13 @@ -72,7 +72,7 @@ LL | foo(&X); help: use `&raw const` instead to create a raw pointer | LL | foo(&raw const X); - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:66:17 @@ -103,7 +103,7 @@ LL | let _v = &A.value; help: use `&raw const` instead to create a raw pointer | LL | let _v = &raw const A.value; - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:80:18 @@ -116,7 +116,7 @@ LL | let _s = &A.s.value; help: use `&raw const` instead to create a raw pointer | LL | let _s = &raw const A.s.value; - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:84:22 diff --git a/tests/ui/lint/static-mut-refs.e2024.stderr b/tests/ui/lint/static-mut-refs.e2024.stderr index 51eaf2785d151..cf7f0a86f4fe7 100644 --- a/tests/ui/lint/static-mut-refs.e2024.stderr +++ b/tests/ui/lint/static-mut-refs.e2024.stderr @@ -10,7 +10,7 @@ LL | let _y = &X; help: use `&raw const` instead to create a raw pointer | LL | let _y = &raw const X; - | ~~~~~~~~~~ + | +++++++++ error: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:42:18 @@ -46,7 +46,7 @@ LL | let (_b, _c) = (&X, &Y); help: use `&raw const` instead to create a raw pointer | LL | let (_b, _c) = (&raw const X, &Y); - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:54:29 @@ -59,7 +59,7 @@ LL | let (_b, _c) = (&X, &Y); help: use `&raw const` instead to create a raw pointer | LL | let (_b, _c) = (&X, &raw const Y); - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:60:13 @@ -72,7 +72,7 @@ LL | foo(&X); help: use `&raw const` instead to create a raw pointer | LL | foo(&raw const X); - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:66:17 @@ -103,7 +103,7 @@ LL | let _v = &A.value; help: use `&raw const` instead to create a raw pointer | LL | let _v = &raw const A.value; - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:80:18 @@ -116,7 +116,7 @@ LL | let _s = &A.s.value; help: use `&raw const` instead to create a raw pointer | LL | let _s = &raw const A.s.value; - | ~~~~~~~~~~ + | +++++++++ error: creating a shared reference to mutable static is discouraged --> $DIR/static-mut-refs.rs:84:22 diff --git a/tests/ui/lint/type-overflow.stderr b/tests/ui/lint/type-overflow.stderr index 4e68e7ee80f0c..6ba0c9d907c5e 100644 --- a/tests/ui/lint/type-overflow.stderr +++ b/tests/ui/lint/type-overflow.stderr @@ -67,7 +67,7 @@ LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000; help: to use as a negative number (decimal `-170141183460469231731687303715884105728`), consider using the type `u128` for the literal and cast it to `i128` | LL | let fail: i128 = 0x8000_0000_0000_0000_0000_0000_0000_0000u128 as i128; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++ warning: literal out of range for `i32` --> $DIR/type-overflow.rs:27:16 @@ -117,7 +117,7 @@ LL | let fail = 0x8FFF_FFFF_FFFF_FFFE; help: to use as a negative number (decimal `-2`), consider using the type `u32` for the literal and cast it to `i32` | LL | let fail = 0x8FFF_FFFF_FFFF_FFFEu32 as i32; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++ warning: literal out of range for `i8` --> $DIR/type-overflow.rs:46:17 diff --git a/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr b/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr index a5bd396f73ff1..2d43e61258069 100644 --- a/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr +++ b/tests/ui/lint/unused/issue-67691-unused-field-in-or-pattern.stderr @@ -13,7 +13,7 @@ LL | #![deny(unused)] help: try ignoring the field | LL | A { i, j: _ } | B { i, j: _ } => { - | ~~~~ ~~~~ + | +++ +++ error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:30:16 @@ -36,7 +36,7 @@ LL | Some(A { i, j } | B { i, j }) => { help: try ignoring the field | LL | Some(A { i, j: _ } | B { i, j: _ }) => { - | ~~~~ ~~~~ + | +++ +++ error: unused variable: `j` --> $DIR/issue-67691-unused-field-in-or-pattern.rs:52:21 diff --git a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr index fe1fd4a26a028..a2c281d9c0a11 100644 --- a/tests/ui/macros/expr_2021_cargo_fix_edition.stderr +++ b/tests/ui/macros/expr_2021_cargo_fix_edition.stderr @@ -14,7 +14,7 @@ LL | #![warn(edition_2024_expr_fragment_specifier)] help: to keep the existing behavior, use the `expr_2021` fragment specifier | LL | ($e:expr_2021) => { - | ~~~~~~~~~ + | +++++ warning: the `expr` fragment specifier will accept more expressions in the 2024 edition --> $DIR/expr_2021_cargo_fix_edition.rs:11:11 @@ -27,7 +27,7 @@ LL | ($($i:expr)*) => { }; help: to keep the existing behavior, use the `expr_2021` fragment specifier | LL | ($($i:expr_2021)*) => { }; - | ~~~~~~~~~ + | +++++ warning: 2 warnings emitted diff --git a/tests/ui/macros/macro-backtrace-invalid-internals.stderr b/tests/ui/macros/macro-backtrace-invalid-internals.stderr index aa8f06a0df13b..836098bd9c04e 100644 --- a/tests/ui/macros/macro-backtrace-invalid-internals.stderr +++ b/tests/ui/macros/macro-backtrace-invalid-internals.stderr @@ -44,7 +44,7 @@ LL | real_method_stmt!(); help: you must specify a concrete type for this numeric value, like `f32` | LL | 2.0_f32.neg() - | ~~~~~~~ + | ++++ error[E0599]: no method named `fake` found for type `{integer}` in the current scope --> $DIR/macro-backtrace-invalid-internals.rs:23:13 @@ -92,7 +92,7 @@ LL | let _ = real_method_expr!(); help: you must specify a concrete type for this numeric value, like `f32` | LL | 2.0_f32.neg() - | ~~~~~~~ + | ++++ error: aborting due to 8 previous errors diff --git a/tests/ui/match/issue-56685.stderr b/tests/ui/match/issue-56685.stderr index ccf357d4aa00e..6a1d152ed5bb1 100644 --- a/tests/ui/match/issue-56685.stderr +++ b/tests/ui/match/issue-56685.stderr @@ -12,7 +12,7 @@ LL | #![deny(unused_variables)] help: if this is intentional, prefix it with an underscore | LL | E::A(_x) | E::B(_x) => {} - | ~~ ~~ + | + + error: unused variable: `x` --> $DIR/issue-56685.rs:25:14 @@ -23,7 +23,7 @@ LL | F::A(x, y) | F::B(x, y) => { y }, help: if this is intentional, prefix it with an underscore | LL | F::A(_x, y) | F::B(_x, y) => { y }, - | ~~ ~~ + | + + error: unused variable: `a` --> $DIR/issue-56685.rs:27:14 @@ -46,7 +46,7 @@ LL | let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { help: if this is intentional, prefix it with an underscore | LL | let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | ~~ ~~ + | + + error: unused variable: `x` --> $DIR/issue-56685.rs:39:20 @@ -57,7 +57,7 @@ LL | while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { help: if this is intentional, prefix it with an underscore | LL | while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | ~~ ~~ + | + + error: aborting due to 6 previous errors diff --git a/tests/ui/methods/issues/issue-90315.stderr b/tests/ui/methods/issues/issue-90315.stderr index 0466bb0a0c997..e495701a3d7bc 100644 --- a/tests/ui/methods/issues/issue-90315.stderr +++ b/tests/ui/methods/issues/issue-90315.stderr @@ -182,7 +182,7 @@ LL | let _res: i32 = ..6.take(2).sum(); help: you must specify a concrete type for this numeric value, like `i32` | LL | let _res: i32 = ..6_i32.take(2).sum(); - | ~~~~~ + | ++++ error: aborting due to 18 previous errors diff --git a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr index 124270402727d..c9a549513077e 100644 --- a/tests/ui/methods/method-on-ambiguous-numeric-type.stderr +++ b/tests/ui/methods/method-on-ambiguous-numeric-type.stderr @@ -7,7 +7,7 @@ LL | let x = 2.0.neg(); help: you must specify a concrete type for this numeric value, like `f32` | LL | let x = 2.0_f32.neg(); - | ~~~~~~~ + | ++++ error[E0689]: can't call method `neg` on ambiguous numeric type `{float}` --> $DIR/method-on-ambiguous-numeric-type.rs:17:15 diff --git a/tests/ui/mir/issue-112269.stderr b/tests/ui/mir/issue-112269.stderr index 80f329e2ce026..fc8bf5d67b559 100644 --- a/tests/ui/mir/issue-112269.stderr +++ b/tests/ui/mir/issue-112269.stderr @@ -12,7 +12,7 @@ LL | let x: i32 = 3; help: introduce a variable instead | LL | let x_var: i32 = 3; - | ~~~~~ + | ++++ error[E0005]: refutable pattern in local binding --> $DIR/issue-112269.rs:7:9 @@ -28,7 +28,7 @@ LL | let y = 4; help: introduce a variable instead | LL | let y_var = 4; - | ~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/mismatched_types/issue-112036.stderr b/tests/ui/mismatched_types/issue-112036.stderr index bd446b3d78cb2..fed6b11a7b292 100644 --- a/tests/ui/mismatched_types/issue-112036.stderr +++ b/tests/ui/mismatched_types/issue-112036.stderr @@ -9,7 +9,7 @@ LL | fn drop(self) {} help: change the self-receiver type to match the trait | LL | fn drop(&mut self) {} - | ~~~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr index 784945dbbaeae..d69e83cce9a7f 100644 --- a/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr +++ b/tests/ui/moves/use_of_moved_value_copy_suggestions.stderr @@ -196,7 +196,7 @@ LL | [t, t]; help: consider further restricting type parameter `T` with trait `Copy` | LL | T:, T: Copy - | ~~~~~~~~~ + | +++++++ error: aborting due to 11 previous errors diff --git a/tests/ui/namespace/namespace-mix.stderr b/tests/ui/namespace/namespace-mix.stderr index b80363fe8f848..412ea4aba30b8 100644 --- a/tests/ui/namespace/namespace-mix.stderr +++ b/tests/ui/namespace/namespace-mix.stderr @@ -11,7 +11,7 @@ LL | check(m1::S); help: a tuple struct with a similar name exists | LL | check(m1::TS); - | ~~ + | + help: consider importing one of these constants instead | LL + use m2::S; @@ -39,7 +39,7 @@ LL | pub struct TS(); help: a tuple struct with a similar name exists | LL | check(xm1::TS); - | ~~ + | + help: consider importing one of these constants instead | LL + use m2::S; @@ -65,7 +65,7 @@ LL | check(m7::V); help: a tuple variant with a similar name exists | LL | check(m7::TV); - | ~~ + | + help: consider importing one of these constants instead | LL + use m8::V; @@ -93,7 +93,7 @@ LL | TV(), help: a tuple variant with a similar name exists | LL | check(xm7::TV); - | ~~ + | + help: consider importing one of these constants instead | LL + use m8::V; diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr index 4f93fb4eaea34..a01b1d5174df4 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-closure.stderr @@ -34,7 +34,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) help: consider adding an explicit lifetime bound | LL | T: Iterator, ::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ note: external requirements --> $DIR/projection-no-regions-closure.rs:34:23 @@ -96,7 +96,7 @@ LL | with_signature(x, |mut y| Box::new(y.next())) help: consider adding an explicit lifetime bound | LL | T: 'b + Iterator, ::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ note: external requirements --> $DIR/projection-no-regions-closure.rs:52:23 diff --git a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr index da76ac1c474a3..07debd308c204 100644 --- a/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr +++ b/tests/ui/nll/ty-outlives/projection-no-regions-fn.stderr @@ -10,7 +10,7 @@ LL | Box::new(x.next()) help: consider adding an explicit lifetime bound | LL | T: Iterator, ::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ error[E0309]: the associated type `::Item` may not live long enough --> $DIR/projection-no-regions-fn.rs:28:5 @@ -24,7 +24,7 @@ LL | Box::new(x.next()) help: consider adding an explicit lifetime bound | LL | T: 'b + Iterator, ::Item: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr index 9eff4bb8c6cd5..4b779103a6dd8 100644 --- a/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr +++ b/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.stderr @@ -35,7 +35,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); help: consider adding an explicit lifetime bound | LL | T: Anything<'b, 'c>, >::AssocType: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++++++++++++++++ note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:48:29 @@ -74,7 +74,7 @@ LL | with_signature(cell, t, |cell, t| require(cell, t)); help: consider adding an explicit lifetime bound | LL | 'a: 'a, >::AssocType: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++++++++++++++++ note: external requirements --> $DIR/projection-two-region-trait-bound-closure.rs:61:29 diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr index dfc024baed787..4b1e59053c939 100644 --- a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr +++ b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.stderr @@ -10,7 +10,7 @@ LL | bar::() help: consider adding an explicit lifetime bound | LL | >::Output: 'b, >::Output: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr index a43b4629cc304..9c93d663e2d37 100644 --- a/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr +++ b/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.stderr @@ -10,7 +10,7 @@ LL | bar::<>::Output>() help: consider adding an explicit lifetime bound | LL | >::Output: 'a, >::Output: 'a - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/object-pointer-types.stderr b/tests/ui/object-pointer-types.stderr index 7d915ebdab657..ac8e069cfd2c8 100644 --- a/tests/ui/object-pointer-types.stderr +++ b/tests/ui/object-pointer-types.stderr @@ -10,7 +10,7 @@ LL | x.owned(); help: there is a method `to_owned` with a similar name | LL | x.to_owned(); - | ~~~~~~~~ + | +++ error[E0599]: no method named `owned` found for mutable reference `&mut dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:17:7 diff --git a/tests/ui/parser/bad-char-literals.stderr b/tests/ui/parser/bad-char-literals.stderr index 1b047aa46193b..b5b05c2c142cd 100644 --- a/tests/ui/parser/bad-char-literals.stderr +++ b/tests/ui/parser/bad-char-literals.stderr @@ -7,7 +7,7 @@ LL | '''; help: escape the character | LL | '\''; - | ~~ + | + error: character constant must be escaped: `\n` --> $DIR/bad-char-literals.rs:10:6 diff --git a/tests/ui/parser/bad-escape-suggest-raw-string.stderr b/tests/ui/parser/bad-escape-suggest-raw-string.stderr index 6dd4ad512a8e3..15e99b3cb32ff 100644 --- a/tests/ui/parser/bad-escape-suggest-raw-string.stderr +++ b/tests/ui/parser/bad-escape-suggest-raw-string.stderr @@ -8,7 +8,7 @@ LL | let bad = "ab\[c"; help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | LL | let bad = r"ab\[c"; - | ~~~~~~~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/byte-literals.stderr b/tests/ui/parser/byte-literals.stderr index 9e1c2df3e56ef..1c89e8e2864b6 100644 --- a/tests/ui/parser/byte-literals.stderr +++ b/tests/ui/parser/byte-literals.stderr @@ -40,7 +40,7 @@ LL | b'''; help: escape the character | LL | b'\''; - | ~~ + | + error: non-ASCII character in byte literal --> $DIR/byte-literals.rs:10:7 diff --git a/tests/ui/parser/extern-no-fn.stderr b/tests/ui/parser/extern-no-fn.stderr index 03826e4a93b7a..67acbf9b87fc2 100644 --- a/tests/ui/parser/extern-no-fn.stderr +++ b/tests/ui/parser/extern-no-fn.stderr @@ -12,7 +12,7 @@ LL | } help: if you meant to call a macro, try | LL | f!(); - | ~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr index 7fc2db0fa5591..7146949ca2f8f 100644 --- a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr +++ b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr @@ -55,7 +55,7 @@ LL | mut n = 0; help: missing keyword | LL | let mut n = 0; - | ~~~~~~~ + | +++ error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:16:5 @@ -66,7 +66,7 @@ LL | mut var; help: missing keyword | LL | let mut var; - | ~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/issue-65257-invalid-var-decl-recovery.rs:20:33 diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr index b6e24faf5dabb..a9bad96f9af76 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr @@ -9,7 +9,7 @@ LL | Foo:Bar => {} help: maybe write a path separator here | LL | Foo::Bar => {} - | ~~ + | + error: expected one of `!`, `(`, `...`, `..=`, `..`, `::`, `{`, or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:23:17 @@ -22,7 +22,7 @@ LL | qux::Foo:Bar => {} help: maybe write a path separator here | LL | qux::Foo::Bar => {} - | ~~ + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:29:12 @@ -35,7 +35,7 @@ LL | qux:Foo::Baz => {} help: maybe write a path separator here | LL | qux::Foo::Baz => {} - | ~~ + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:35:12 @@ -61,7 +61,7 @@ LL | if let Foo:Bar = f() { help: maybe write a path separator here | LL | if let Foo::Bar = f() { - | ~~ + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:49:16 @@ -100,7 +100,7 @@ LL | Foo:Bar::Baz => {} help: maybe write a path separator here | LL | Foo::Bar::Baz => {} - | ~~ + | + error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:75:12 @@ -113,7 +113,7 @@ LL | Foo:Bar => {} help: maybe write a path separator here | LL | Foo::Bar => {} - | ~~ + | + warning: irrefutable `if let` pattern --> $DIR/issue-87086-colon-path-sep.rs:40:8 diff --git a/tests/ui/parser/missing-fn-issue-65381-2.stderr b/tests/ui/parser/missing-fn-issue-65381-2.stderr index e13d395d70d7f..17a25bc6671af 100644 --- a/tests/ui/parser/missing-fn-issue-65381-2.stderr +++ b/tests/ui/parser/missing-fn-issue-65381-2.stderr @@ -7,7 +7,7 @@ LL | main(); help: if you meant to call a macro, try | LL | main!(); - | ~~~~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/misspelled-keywords/const.stderr b/tests/ui/parser/misspelled-keywords/const.stderr index 35e4d731db768..59346461ce775 100644 --- a/tests/ui/parser/misspelled-keywords/const.stderr +++ b/tests/ui/parser/misspelled-keywords/const.stderr @@ -7,7 +7,7 @@ LL | cons A: u8 = 10; help: there is a keyword `const` with a similar name | LL | const A: u8 = 10; - | ~~~~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr index 551b2e3ff09b0..583b98c650f03 100644 --- a/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr +++ b/tests/ui/parser/recover/turbofish-arg-with-stray-colon.stderr @@ -8,7 +8,7 @@ LL | let x = Tr; help: maybe write a path separator here | LL | let x = Tr; - | ~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/parser/use-colon-as-mod-sep.stderr b/tests/ui/parser/use-colon-as-mod-sep.stderr index 347b271df9900..9b4cc0ca23776 100644 --- a/tests/ui/parser/use-colon-as-mod-sep.stderr +++ b/tests/ui/parser/use-colon-as-mod-sep.stderr @@ -8,7 +8,7 @@ LL | use std::process:Command; help: use double colon | LL | use std::process::Command; - | ~~ + | + error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:5:8 @@ -20,7 +20,7 @@ LL | use std:fs::File; help: use double colon | LL | use std::fs::File; - | ~~ + | + error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:8 @@ -32,7 +32,7 @@ LL | use std:collections:HashMap; help: use double colon | LL | use std::collections:HashMap; - | ~~ + | + error: expected `::`, found `:` --> $DIR/use-colon-as-mod-sep.rs:7:20 @@ -44,7 +44,7 @@ LL | use std:collections:HashMap; help: use double colon | LL | use std:collections::HashMap; - | ~~ + | + error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/pat-tuple-field-count-cross.stderr b/tests/ui/pattern/pat-tuple-field-count-cross.stderr index 931db37c78ef1..e164281826bf1 100644 --- a/tests/ui/pattern/pat-tuple-field-count-cross.stderr +++ b/tests/ui/pattern/pat-tuple-field-count-cross.stderr @@ -122,7 +122,7 @@ LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } help: use the tuple variant pattern syntax instead | LL | E1::Z1() => {} - | ~~~~~~~~ + | ++ help: a unit variant with a similar name exists | LL - E1::Z1 => {} diff --git a/tests/ui/pattern/pat-tuple-overfield.stderr b/tests/ui/pattern/pat-tuple-overfield.stderr index ea3663ea40e76..b19b9d1934727 100644 --- a/tests/ui/pattern/pat-tuple-overfield.stderr +++ b/tests/ui/pattern/pat-tuple-overfield.stderr @@ -156,7 +156,7 @@ LL | E1::Z1 => {} help: use the tuple variant pattern syntax instead | LL | E1::Z1() => {} - | ~~~~~~~~ + | ++ help: a unit variant with a similar name exists | LL - E1::Z1 => {} diff --git a/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr b/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr index e9c2fccaba284..a6623c6306b5b 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr +++ b/tests/ui/pattern/patkind-ref-binding-issue-114896.stderr @@ -7,7 +7,7 @@ LL | b.make_ascii_uppercase(); help: consider changing this to be mutable | LL | let &(mut b) = a; - | ~~~~~ + + | ++++ + error: aborting due to 1 previous error diff --git a/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr b/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr index e93b8bbacccdd..7fa65e3d6bda6 100644 --- a/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr +++ b/tests/ui/pattern/patkind-ref-binding-issue-122415.stderr @@ -7,7 +7,7 @@ LL | mutate(&mut x); help: consider changing this to be mutable | LL | fn foo(&(mut x): &i32) { - | ~~~~~ + + | ++++ + error: aborting due to 1 previous error diff --git a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr index 158eac9a1bd14..d7e1b54e7499f 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr @@ -18,15 +18,15 @@ LL | let HiddenStruct { one } = HiddenStruct::default(); help: include the missing field in the pattern and ignore the inaccessible fields | LL | let HiddenStruct { one, two, .. } = HiddenStruct::default(); - | ~~~~~~~~~~~ + | +++++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | let HiddenStruct { one, two: _, .. } = HiddenStruct::default(); - | ~~~~~~~~~~~~~~ + | ++++++++++++ help: or always ignore missing fields here | LL | let HiddenStruct { one, .. } = HiddenStruct::default(); - | ~~~~~~ + | ++++ error[E0027]: pattern does not mention field `two` --> $DIR/doc-hidden-fields.rs:21:9 @@ -37,15 +37,15 @@ LL | let HiddenStruct { one, hide } = HiddenStruct::default(); help: include the missing field in the pattern | LL | let HiddenStruct { one, hide, two } = HiddenStruct::default(); - | ~~~~~~~ + | +++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | let HiddenStruct { one, hide, two: _ } = HiddenStruct::default(); - | ~~~~~~~~~~ + | ++++++++ help: or always ignore missing fields here | LL | let HiddenStruct { one, hide, .. } = HiddenStruct::default(); - | ~~~~~~ + | ++++ error[E0027]: pattern does not mention field `im_hidden` --> $DIR/doc-hidden-fields.rs:24:9 @@ -56,15 +56,15 @@ LL | let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; help: include the missing field in the pattern | LL | let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden: 0 }; - | ~~~~~~~~~~~~~ + | +++++++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 }; - | ~~~~~~~~~~~~~~~~ + | ++++++++++++++ help: or always ignore missing fields here | LL | let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 }; - | ~~~~~~ + | ++++ error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/usefulness/stable-gated-fields.stderr b/tests/ui/pattern/usefulness/stable-gated-fields.stderr index d6e9bac7c136b..7c30b530d6d21 100644 --- a/tests/ui/pattern/usefulness/stable-gated-fields.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-fields.stderr @@ -7,15 +7,15 @@ LL | let UnstableStruct { stable } = UnstableStruct::default(); help: include the missing field in the pattern and ignore the inaccessible fields | LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); - | ~~~~~~~~~~~~~~~ + | +++++++++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default(); - | ~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++ help: or always ignore missing fields here | LL | let UnstableStruct { stable, .. } = UnstableStruct::default(); - | ~~~~~~ + | ++++ error: pattern requires `..` due to inaccessible fields --> $DIR/stable-gated-fields.rs:11:9 diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr index 80885a8f2f1d7..b651348de29ea 100644 --- a/tests/ui/privacy/suggest-box-new.stderr +++ b/tests/ui/privacy/suggest-box-new.stderr @@ -10,7 +10,7 @@ LL | let _ = std::collections::HashMap(); help: you might have meant to use an associated function to build this type | LL | let _ = std::collections::HashMap::new(); - | ~~~~~~~ + | +++++ LL - let _ = std::collections::HashMap(); LL + let _ = std::collections::HashMap::with_capacity(_); | @@ -23,7 +23,7 @@ LL + let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); help: consider using the `Default` trait | LL | let _ = ::default(); - | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | + ++++++++++++++++++++++++++++++++++ error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/suggest-box-new.rs:8:19 diff --git a/tests/ui/pub/pub-ident-fn-or-struct.stderr b/tests/ui/pub/pub-ident-fn-or-struct.stderr index ceadc510c63ef..99c8e5754ef73 100644 --- a/tests/ui/pub/pub-ident-fn-or-struct.stderr +++ b/tests/ui/pub/pub-ident-fn-or-struct.stderr @@ -7,7 +7,7 @@ LL | pub S (foo) bar help: if you meant to call a macro, try | LL | pub S! (foo) bar - | ~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/pub/pub-restricted.stderr b/tests/ui/pub/pub-restricted.stderr index fc177aa2033e1..6c913938bb89a 100644 --- a/tests/ui/pub/pub-restricted.stderr +++ b/tests/ui/pub/pub-restricted.stderr @@ -11,7 +11,7 @@ LL | pub (a) fn afn() {} help: make this visible only to module `a` with `in` | LL | pub (in a) fn afn() {} - | ~~~~ + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:4:6 @@ -26,7 +26,7 @@ LL | pub (b) fn bfn() {} help: make this visible only to module `b` with `in` | LL | pub (in b) fn bfn() {} - | ~~~~ + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:5:6 @@ -41,7 +41,7 @@ LL | pub (crate::a) fn cfn() {} help: make this visible only to module `crate::a` with `in` | LL | pub (in crate::a) fn cfn() {} - | ~~~~~~~~~~~ + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:22:14 @@ -56,7 +56,7 @@ LL | pub (a) invalid: usize, help: make this visible only to module `a` with `in` | LL | pub (in a) invalid: usize, - | ~~~~ + | ++ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:31:6 @@ -71,7 +71,7 @@ LL | pub (xyz) fn xyz() {} help: make this visible only to module `xyz` with `in` | LL | pub (in xyz) fn xyz() {} - | ~~~~~~ + | ++ error[E0742]: visibilities can only be restricted to ancestor modules --> $DIR/pub-restricted.rs:23:17 diff --git a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr index b3cc90ff1f501..ef641eb5681bf 100644 --- a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr +++ b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr @@ -74,7 +74,7 @@ LL | _ => {} help: you might have meant to pattern match against the value of constant `ARCH` instead of introducing a new catch-all binding | LL | std::env::consts::ARCH => {} - | ~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++ error: aborting due to 5 previous errors diff --git a/tests/ui/resolve/issue-39226.stderr b/tests/ui/resolve/issue-39226.stderr index 84f9ad531f082..1cd2a5fb2216e 100644 --- a/tests/ui/resolve/issue-39226.stderr +++ b/tests/ui/resolve/issue-39226.stderr @@ -10,7 +10,7 @@ LL | handle: Handle help: use struct literal syntax instead | LL | handle: Handle {} - | ~~~~~~~~~ + | ++ help: a local variable with a similar name exists | LL - handle: Handle diff --git a/tests/ui/resolve/issue-55673.stderr b/tests/ui/resolve/issue-55673.stderr index 86dfca068a37c..2695868b77187 100644 --- a/tests/ui/resolve/issue-55673.stderr +++ b/tests/ui/resolve/issue-55673.stderr @@ -19,7 +19,7 @@ LL | T::Baa: std::fmt::Debug, help: consider further restricting type parameter `T` with trait `Foo` | LL | T::Baa: std::fmt::Debug, T: Foo - | ~~~~~~~~ + | ++++++ help: ...and changing the associated type name | LL - T::Baa: std::fmt::Debug, diff --git a/tests/ui/resolve/issue-73427.stderr b/tests/ui/resolve/issue-73427.stderr index 3c49fe3a8de57..fccbfe547cb21 100644 --- a/tests/ui/resolve/issue-73427.stderr +++ b/tests/ui/resolve/issue-73427.stderr @@ -21,7 +21,7 @@ LL - A.foo(); LL + (A::Tuple()).foo(); | LL | A::Unit.foo(); - | ~~~~~~~ + | ++++++ help: alternatively, the following enum variant is available | LL - A.foo(); @@ -61,7 +61,7 @@ LL | | } help: you might have meant to use the following enum variant | LL | C::Unit.foo(); - | ~~~~~~~ + | ++++++ help: alternatively, the following enum variant is available | LL - C.foo(); @@ -85,7 +85,7 @@ LL | | } help: you might have meant to use the following enum variant | LL | D::Unit.foo(); - | ~~~~~~~ + | ++++++ help: alternatively, the following enum variant is available | LL - D.foo(); @@ -142,9 +142,9 @@ LL | | } help: try to match against one of the enum's variants | LL | if let A::Tuple(3) = x { } - | ~~~~~~~~ + | +++++++ LL | if let A::TupleWithFields(3) = x { } - | ~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++ error[E0423]: expected function, tuple struct or tuple variant, found enum `A` --> $DIR/issue-73427.rs:46:13 @@ -167,9 +167,9 @@ LL | | } help: try to construct one of the enum's variants | LL | let x = A::Tuple(3); - | ~~~~~~~~ + | +++++++ LL | let x = A::TupleWithFields(3); - | ~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++ error: aborting due to 7 previous errors diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr index fb6787274fac8..f349b9391d15a 100644 --- a/tests/ui/resolve/privacy-enum-ctor.stderr +++ b/tests/ui/resolve/privacy-enum-ctor.stderr @@ -125,7 +125,7 @@ LL | | } help: you might have meant to use the following enum variant | LL | let _: E = E::Unit; - | ~~~~~~~ + | ++++++ help: alternatively, the following enum variant is available | LL - let _: E = E; diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr index d6240fb8f872c..5fac622eef263 100644 --- a/tests/ui/resolve/resolve-inconsistent-names.stderr +++ b/tests/ui/resolve/resolve-inconsistent-names.stderr @@ -35,7 +35,7 @@ LL | (A, B) | (ref B, c) | (c, A) => () help: if you meant to match on unit variant `E::A`, use the full path in the pattern | LL | (E::A, B) | (ref B, c) | (c, A) => () - | ~~~~ + | +++ error[E0408]: variable `B` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:19:31 @@ -65,7 +65,7 @@ LL | (CONST1, _) | (_, Const2) => () help: if you meant to match on constant `m::Const2`, use the full path in the pattern | LL | (CONST1, _) | (_, m::Const2) => () - | ~~~~~~~~~ + | +++ error[E0408]: variable `CONST1` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:31:23 diff --git a/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr b/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr index b41fa1818e25a..366bc1bf03cc7 100644 --- a/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr +++ b/tests/ui/resolve/resolve-issue-135614-assoc-const.import_trait_associated_functions.stderr @@ -12,7 +12,7 @@ LL | const DEFAULT: u32 = 0; help: introduce a variable instead | LL | let DEFAULT_var: u32 = 0; - | ~~~~~~~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr b/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr index 908f5bdd89749..1392eb48f8ccb 100644 --- a/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr +++ b/tests/ui/resolve/resolve-issue-135614-assoc-const.normal.stderr @@ -22,7 +22,7 @@ LL | const DEFAULT: u32 = 0; help: introduce a variable instead | LL | let DEFAULT_var: u32 = 0; - | ~~~~~~~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr index d183f06c5fd4e..5832cb69a3dd8 100644 --- a/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr +++ b/tests/ui/resolve/typo-suggestion-for-variable-with-name-similar-to-struct-field.stderr @@ -67,7 +67,7 @@ LL | Self::BAR; help: a constant with a similar name exists | LL | BARR; - | ~~~~ + | + error[E0412]: cannot find type `Baz` in this scope --> $DIR/typo-suggestion-for-variable-with-name-similar-to-struct-field.rs:37:18 diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr index e7651f7704c7c..2d0d0d0f38670 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr @@ -40,7 +40,7 @@ LL | modul::foo(); help: there is a crate or module with a similar name | LL | module::foo(); - | ~~~~~~ + | + error[E0433]: failed to resolve: use of undeclared type `Trai` --> $DIR/typo-suggestion-mistyped-in-path.rs:39:5 diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr index 39b1ef1e078c7..88411f29b16e4 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr @@ -59,7 +59,7 @@ LL | let NormalStruct { first_field, second_field } = ns; help: add `..` at the end of the field list to ignore all other fields | LL | let NormalStruct { first_field, second_field , .. } = ns; - | ~~~~~~ + | ++++ error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/struct.rs:20:14 @@ -76,7 +76,7 @@ LL | let TupleStruct { 0: first_field, 1: second_field } = ts; help: add `..` at the end of the field list to ignore all other fields | LL | let TupleStruct { 0: first_field, 1: second_field , .. } = ts; - | ~~~~~~ + | ++++ error[E0638]: `..` required with struct marked as non-exhaustive --> $DIR/struct.rs:35:9 @@ -87,7 +87,7 @@ LL | let UnitStruct { } = us; help: add `..` at the end of the field list to ignore all other fields | LL | let UnitStruct { .. } = us; - | ~~~~ + | ++ error: aborting due to 9 previous errors diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr index 4083f57a9cdf9..dcecd53d38a1e 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr @@ -83,7 +83,7 @@ LL | NonExhaustiveVariants::Struct { field } => "" help: add `..` at the end of the field list to ignore all other fields | LL | NonExhaustiveVariants::Struct { field , .. } => "" - | ~~~~~~ + | ++++ error[E0638]: `..` required with variant marked as non-exhaustive --> $DIR/variant.rs:30:12 @@ -94,7 +94,7 @@ LL | if let NonExhaustiveVariants::Struct { field } = variant_struct { help: add `..` at the end of the field list to ignore all other fields | LL | if let NonExhaustiveVariants::Struct { field , .. } = variant_struct { - | ~~~~~~ + | ++++ error: aborting due to 8 previous errors diff --git a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr index d0c084f7bd5d0..38360e06cbe79 100644 --- a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr +++ b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr @@ -7,7 +7,7 @@ LL | use alloc; help: consider importing this module instead | LL | use std::alloc; - | ~~~~~~~~~~ + | +++++ error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr index 8632bca6b1023..488044ee85245 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.stderr +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -35,7 +35,7 @@ LL + use crate::foo::Bar; help: there is a method `foobar` with a similar name | LL | x.foobar(); - | ~~~~~~ + | +++ error[E0599]: no method named `baz` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:29:7 diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr index 050834ab67609..34bf1c6c10ac4 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-stable.stderr @@ -12,7 +12,7 @@ LL | #![deny(stable_features)] help: if you are using features which are still unstable, change to using `const_foobar` | LL | #![feature(const_foobar)] - | ~~~~~~~~~~~~ + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(const_foo)] diff --git a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr index 50cc14c3b4f65..095c37fd0b680 100644 --- a/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr +++ b/tests/ui/stability-attribute/const-stability-attribute-implies-using-unstable.stderr @@ -12,7 +12,7 @@ LL | #![deny(stable_features)] help: if you are using features which are still unstable, change to using `const_foobar` | LL | #![feature(const_foobar)] - | ~~~~~~~~~~~~ + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(const_foo)] diff --git a/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr b/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr index d783f1e8e4044..86cb764a4b3e7 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-using-stable.stderr @@ -12,7 +12,7 @@ LL | #![deny(stable_features)] help: if you are using features which are still unstable, change to using `foobar` | LL | #![feature(foobar)] - | ~~~~~~ + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] diff --git a/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr b/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr index 4940650fd4261..2537646eb9835 100644 --- a/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr +++ b/tests/ui/stability-attribute/stability-attribute-implies-using-unstable.stderr @@ -12,7 +12,7 @@ LL | #![deny(stable_features)] help: if you are using features which are still unstable, change to using `foobar` | LL | #![feature(foobar)] - | ~~~~~~ + | +++ help: if you are using features which are now stable, remove this line | LL - #![feature(foo)] diff --git a/tests/ui/statics/issue-15261.stderr b/tests/ui/statics/issue-15261.stderr index 4067d151de3d4..7e6aebcbb1f0e 100644 --- a/tests/ui/statics/issue-15261.stderr +++ b/tests/ui/statics/issue-15261.stderr @@ -10,7 +10,7 @@ LL | static n: &'static usize = unsafe { &n_mut }; help: use `&raw const` instead to create a raw pointer | LL | static n: &'static usize = unsafe { &raw const n_mut }; - | ~~~~~~~~~~ + | +++++++++ warning: 1 warning emitted diff --git a/tests/ui/statics/static-mut-shared-parens.stderr b/tests/ui/statics/static-mut-shared-parens.stderr index ad6ad68c3157d..3d4b55909cdee 100644 --- a/tests/ui/statics/static-mut-shared-parens.stderr +++ b/tests/ui/statics/static-mut-shared-parens.stderr @@ -10,7 +10,7 @@ LL | let _ = unsafe { (&TEST) as *const usize }; help: use `&raw const` instead to create a raw pointer | LL | let _ = unsafe { (&raw const TEST) as *const usize }; - | ~~~~~~~~~~ + | +++++++++ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-shared-parens.rs:11:22 diff --git a/tests/ui/statics/static-mut-xc.stderr b/tests/ui/statics/static-mut-xc.stderr index 77ce49b883fce..48cac28a6eb51 100644 --- a/tests/ui/statics/static-mut-xc.stderr +++ b/tests/ui/statics/static-mut-xc.stderr @@ -55,7 +55,7 @@ LL | static_bound(&static_mut_xc::a); help: use `&raw const` instead to create a raw pointer | LL | static_bound(&raw const static_mut_xc::a); - | ~~~~~~~~~~ + | +++++++++ warning: creating a mutable reference to mutable static is discouraged --> $DIR/static-mut-xc.rs:35:22 diff --git a/tests/ui/statics/static-recursive.stderr b/tests/ui/statics/static-recursive.stderr index f2dd5b8a6cfe8..039934dfc692d 100644 --- a/tests/ui/statics/static-recursive.stderr +++ b/tests/ui/statics/static-recursive.stderr @@ -10,7 +10,7 @@ LL | static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; help: use `&raw const` instead to create a raw pointer | LL | static mut S: *const u8 = unsafe { &raw const S as *const *const u8 as *const u8 }; - | ~~~~~~~~~~ + | +++++++++ warning: creating a shared reference to mutable static is discouraged --> $DIR/static-recursive.rs:19:20 diff --git a/tests/ui/structs/struct-fields-hints-no-dupe.stderr b/tests/ui/structs/struct-fields-hints-no-dupe.stderr index 2b88d802833c3..aeba7f00b9dc8 100644 --- a/tests/ui/structs/struct-fields-hints-no-dupe.stderr +++ b/tests/ui/structs/struct-fields-hints-no-dupe.stderr @@ -7,7 +7,7 @@ LL | bar : 42, help: a field with a similar name exists | LL | barr : 42, - | ~~~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/structs/struct-pat-derived-error.stderr b/tests/ui/structs/struct-pat-derived-error.stderr index 628a007e7693f..7fceb95cc5d2c 100644 --- a/tests/ui/structs/struct-pat-derived-error.stderr +++ b/tests/ui/structs/struct-pat-derived-error.stderr @@ -25,15 +25,15 @@ LL | let A { x, y } = self.d; help: include the missing fields in the pattern | LL | let A { x, y, b, c } = self.d; - | ~~~~~~~~ + | ++++++ help: if you don't care about these missing fields, you can explicitly ignore them | LL | let A { x, y, b: _, c: _ } = self.d; - | ~~~~~~~~~~~~~~ + | ++++++++++++ help: or always ignore missing fields here | LL | let A { x, y, .. } = self.d; - | ~~~~~~ + | ++++ error: aborting due to 3 previous errors diff --git a/tests/ui/structs/struct-tuple-field-names.stderr b/tests/ui/structs/struct-tuple-field-names.stderr index ef3869dda5355..953f01e1fb6cc 100644 --- a/tests/ui/structs/struct-tuple-field-names.stderr +++ b/tests/ui/structs/struct-tuple-field-names.stderr @@ -31,15 +31,15 @@ LL | if let E::S { 0: a } = x { help: include the missing field in the pattern | LL | if let E::S { 0: a, 1: _ } = x { - | ~~~~~~~~ + | ++++++ help: if you don't care about this missing field, you can explicitly ignore it | LL | if let E::S { 0: a, 1: _ } = x { - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | if let E::S { 0: a, .. } = x { - | ~~~~~~ + | ++++ error: aborting due to 3 previous errors diff --git a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr index af530e2b75931..3a828e955773f 100644 --- a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr +++ b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr @@ -16,15 +16,15 @@ LL | Foo::Bar { a, aa: 1, c } => (), help: include the missing field in the pattern | LL | Foo::Bar { a, aa: 1, c, b } => (), - | ~~~~~ + | +++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Foo::Bar { a, aa: 1, c, b: _ } => (), - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | Foo::Bar { a, aa: 1, c, .. } => (), - | ~~~~~~ + | ++++ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:13:20 @@ -44,15 +44,15 @@ LL | Foo::Baz { bb: 1.0 } => (), help: include the missing field in the pattern | LL | Foo::Baz { bb: 1.0, a } => (), - | ~~~~~ + | +++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Foo::Baz { bb: 1.0, a: _ } => (), - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | Foo::Baz { bb: 1.0, .. } => (), - | ~~~~~~ + | ++++ error[E0026]: variant `Foo::Bar` does not have a field named `aa` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:20:23 @@ -69,15 +69,15 @@ LL | Foo::Bar { a, aa: "", c } => (), help: include the missing field in the pattern | LL | Foo::Bar { a, aa: "", c, b } => (), - | ~~~~~ + | +++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Foo::Bar { a, aa: "", c, b: _ } => (), - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | Foo::Bar { a, aa: "", c, .. } => (), - | ~~~~~~ + | ++++ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:23:20 @@ -94,15 +94,15 @@ LL | Foo::Baz { bb: "" } => (), help: include the missing field in the pattern | LL | Foo::Baz { bb: "", a } => (), - | ~~~~~ + | +++ help: if you don't care about this missing field, you can explicitly ignore it | LL | Foo::Baz { bb: "", a: _ } => (), - | ~~~~~~~~ + | ++++++ help: or always ignore missing fields here | LL | Foo::Baz { bb: "", .. } => (), - | ~~~~~~ + | ++++ error: aborting due to 8 previous errors diff --git a/tests/ui/suggestions/bound-suggestions.stderr b/tests/ui/suggestions/bound-suggestions.stderr index e30deb11398e6..f23e086afe4e7 100644 --- a/tests/ui/suggestions/bound-suggestions.stderr +++ b/tests/ui/suggestions/bound-suggestions.stderr @@ -44,7 +44,7 @@ LL | println!("{:?} {:?}", x, y); help: consider further restricting type parameter `Y` with trait `Debug` | LL | fn test_no_bounds_where(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { - | ~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++ error[E0277]: `X` doesn't implement `Debug` --> $DIR/bound-suggestions.rs:33:22 diff --git a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr index 4f92d3aceefe0..0dc17f2c25c38 100644 --- a/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr +++ b/tests/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr @@ -13,7 +13,7 @@ LL | const A: i32 = 2; help: introduce a variable instead | LL | let A_var = 3; - | ~~~~~ + | ++++ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/crate-or-module-typo.stderr b/tests/ui/suggestions/crate-or-module-typo.stderr index cbe765731b46c..2ec4fc7ed6ccf 100644 --- a/tests/ui/suggestions/crate-or-module-typo.stderr +++ b/tests/ui/suggestions/crate-or-module-typo.stderr @@ -7,7 +7,7 @@ LL | use st::cell::Cell; help: there is a crate or module with a similar name | LL | use std::cell::Cell; - | ~~~ + | + error[E0432]: unresolved import `bas` --> $DIR/crate-or-module-typo.rs:11:5 @@ -30,7 +30,7 @@ LL | bar: st::cell::Cell help: there is a crate or module with a similar name | LL | bar: std::cell::Cell - | ~~~ + | + help: consider importing this module | LL + use std::cell; diff --git a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr index a58c2a584f75e..c275cdccaa8c1 100644 --- a/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr +++ b/tests/ui/suggestions/dyn-incompatible-trait-should-use-where-sized.stderr @@ -21,7 +21,7 @@ LL | fn foo(&self) where Self: Other, { } help: alternatively, consider constraining `foo` so it does not apply to trait objects | LL | fn foo() where Self: Other, Self: Sized { } - | ~~~~~~~~~~~~~ + | +++++++++++ help: consider changing method `bar`'s `self` parameter to be `&self` | LL - fn bar(self: ()) {} diff --git a/tests/ui/suggestions/field-access.stderr b/tests/ui/suggestions/field-access.stderr index 7d816b5bfdd17..362dae172c78f 100644 --- a/tests/ui/suggestions/field-access.stderr +++ b/tests/ui/suggestions/field-access.stderr @@ -12,7 +12,7 @@ LL | if let B::Fst = a {}; help: you might have meant to use field `b` whose type is `B` | LL | if let B::Fst = a.b {}; - | ~~~ + | ++ error[E0308]: mismatched types --> $DIR/field-access.rs:25:9 @@ -29,7 +29,7 @@ LL | B::Fst => (), help: you might have meant to use field `b` whose type is `B` | LL | match a.b { - | ~~~ + | ++ error[E0308]: mismatched types --> $DIR/field-access.rs:26:9 @@ -46,7 +46,7 @@ LL | B::Snd => (), help: you might have meant to use field `b` whose type is `B` | LL | match a.b { - | ~~~ + | ++ error[E0308]: mismatched types --> $DIR/field-access.rs:32:9 diff --git a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr index 79fa468dc4947..4b770d572c565 100644 --- a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr +++ b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr @@ -15,7 +15,7 @@ LL | fn foo(_: X) {} help: consider changing this borrow's mutability | LL | foo(&mut s); - | ~~~~ + | +++ error[E0277]: the trait bound `S: Trait` is not satisfied --> $DIR/imm-ref-trait-object-literal.rs:13:7 diff --git a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr index 89cda2a56e064..204209179adf3 100644 --- a/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr +++ b/tests/ui/suggestions/impl-trait-missing-lifetime-gated.stderr @@ -12,7 +12,7 @@ LL | fn g(mut x: impl Iterator) -> Option<&'static ()> { x.next( help: consider introducing a named lifetime parameter | LL | fn g<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ + | ++++ ++ ++ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Iterator) -> Option<&()> { x.next() } @@ -33,7 +33,7 @@ LL | async fn i(mut x: impl Iterator) -> Option<&'static ()> { x help: consider introducing a named lifetime parameter | LL | async fn i<'a>(mut x: impl Iterator) -> Option<&'a ()> { x.next() } - | ++++ ~~~ ~~~ + | ++++ ++ ++ help: alternatively, you might want to return an owned value | LL - async fn i(mut x: impl Iterator) -> Option<&()> { x.next() } @@ -100,7 +100,7 @@ LL | fn g(mut x: impl Foo) -> Option<&'static ()> { x.next() } help: consider introducing a named lifetime parameter | LL | fn g<'a>(mut x: impl Foo) -> Option<&'a ()> { x.next() } - | ++++ ~~~ + | ++++ ++ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo) -> Option<&()> { x.next() } @@ -121,7 +121,7 @@ LL | fn g(mut x: impl Foo<()>) -> Option<&'static ()> { x.next() } help: consider introducing a named lifetime parameter | LL | fn g<'a>(mut x: impl Foo<()>) -> Option<&'a ()> { x.next() } - | ++++ ~~~ + | ++++ ++ help: alternatively, you might want to return an owned value | LL - fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() } diff --git a/tests/ui/suggestions/struct-field-type-including-single-colon.stderr b/tests/ui/suggestions/struct-field-type-including-single-colon.stderr index 4dd514480da40..5ffc5b40849b6 100644 --- a/tests/ui/suggestions/struct-field-type-including-single-colon.stderr +++ b/tests/ui/suggestions/struct-field-type-including-single-colon.stderr @@ -7,7 +7,7 @@ LL | a: foo:A, help: write a path separator here | LL | a: foo::A, - | ~~ + | + error: expected `,`, or `}`, found `:` --> $DIR/struct-field-type-including-single-colon.rs:9:11 @@ -26,7 +26,7 @@ LL | b: foo::bar:B, help: write a path separator here | LL | b: foo::bar::B, - | ~~ + | + error: expected `,`, or `}`, found `:` --> $DIR/struct-field-type-including-single-colon.rs:15:16 diff --git a/tests/ui/suggestions/suggest-change-mut.stderr b/tests/ui/suggestions/suggest-change-mut.stderr index 216d1e810fd72..c47ae433ab896 100644 --- a/tests/ui/suggestions/suggest-change-mut.stderr +++ b/tests/ui/suggestions/suggest-change-mut.stderr @@ -20,7 +20,7 @@ LL | fn issue_81421(mut stream: T) where &T: std::io::Read { help: consider changing this borrow's mutability | LL | let mut stream_reader = BufReader::new(&mut stream); - | ~~~~ + | +++ error[E0599]: the method `read_until` exists for struct `BufReader<&T>`, but its trait bounds were not satisfied --> $DIR/suggest-change-mut.rs:16:23 diff --git a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr index 5af2c3fbd9b98..2061b3f122a2f 100644 --- a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr +++ b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr @@ -12,7 +12,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:9:9 @@ -28,7 +28,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match *x { - | ~~ + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:16:9 @@ -78,7 +78,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match *y { - | ~~ + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:28:9 @@ -94,7 +94,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match *y { - | ~~ + | + error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:36:9 @@ -144,7 +144,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_const { - | ~~~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:48:9 @@ -160,7 +160,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_const { - | ~~~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:57:9 @@ -176,7 +176,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_mut { - | ~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:59:9 @@ -192,7 +192,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**z_mut { - | ~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:68:9 @@ -208,7 +208,7 @@ LL | Some(_) => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**y_mut { - | ~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:70:9 @@ -224,7 +224,7 @@ LL | None => {} help: consider dereferencing to access the inner value using the Deref trait | LL | match &**y_mut { - | ~~~~~~~~ + | +++ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:79:9 diff --git a/tests/ui/suggestions/suggest-methods.stderr b/tests/ui/suggestions/suggest-methods.stderr index f9f6e5f86fc96..b6925a4c62637 100644 --- a/tests/ui/suggestions/suggest-methods.stderr +++ b/tests/ui/suggestions/suggest-methods.stderr @@ -46,7 +46,7 @@ LL | let _ = 63u32.count_o(); help: there is a method `count_ones` with a similar name | LL | let _ = 63u32.count_ones(); - | ~~~~~~~~~~ + | +++ error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-variants.stderr b/tests/ui/suggestions/suggest-variants.stderr index 7d62604e23f1e..50286a9687594 100644 --- a/tests/ui/suggestions/suggest-variants.stderr +++ b/tests/ui/suggestions/suggest-variants.stderr @@ -25,7 +25,7 @@ LL | println!("My shape is {:?}", Shape::Circl { size: 5}); help: there is a variant with a similar name | LL | println!("My shape is {:?}", Shape::Circle { size: 5}); - | ~~~~~~ + | + error[E0599]: no variant named `Rombus` found for enum `Shape` --> $DIR/suggest-variants.rs:14:41 @@ -63,7 +63,7 @@ LL | Shape::Circl; help: there is a variant with a similar name | LL | Shape::Circle { radius: /* value */ }; - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | +++++++++++++++++++++++++ error[E0599]: no variant or associated item named `Rombus` found for enum `Shape` in the current scope --> $DIR/suggest-variants.rs:17:12 diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr index ba0682cda3212..0b37bf9a57bb7 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr @@ -8,7 +8,7 @@ LL | let _ = vec![Ok(2)].into_iter().collect:,_>>()?; help: maybe write a path separator here | LL | let _ = vec![Ok(2)].into_iter().collect::,_>>()?; - | ~~ + | + error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr index 56b6a69a283f4..a424bc7e72452 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-in-type.stderr @@ -7,7 +7,7 @@ LL | let _: Vec = A::B; help: you might have meant to write a path instead of an associated type bound | LL | let _: Vec = A::B; - | ~~ + | + error[E0107]: struct takes at least 1 generic argument but 0 generic arguments were supplied --> $DIR/type-ascription-instead-of-path-in-type.rs:6:12 diff --git a/tests/ui/suggestions/type-mismatch-byte-literal.stderr b/tests/ui/suggestions/type-mismatch-byte-literal.stderr index 3d27149f0dcf1..7211d77fdcba1 100644 --- a/tests/ui/suggestions/type-mismatch-byte-literal.stderr +++ b/tests/ui/suggestions/type-mismatch-byte-literal.stderr @@ -9,7 +9,7 @@ LL | let _x: u8 = 'X'; help: if you meant to write a byte literal, prefix with `b` | LL | let _x: u8 = b'X'; - | ~~~~ + | + error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:11:9 @@ -27,7 +27,7 @@ LL | fn foo(_t: u8) {} help: if you meant to write a byte literal, prefix with `b` | LL | foo(b'#'); - | ~~~~ + | + error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:15:18 @@ -40,7 +40,7 @@ LL | let _a: u8 = '\x20'; help: if you meant to write a byte literal, prefix with `b` | LL | let _a: u8 = b'\x20'; - | ~~~~~~~ + | + error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:20:9 diff --git a/tests/ui/test-attrs/inaccessible-test-modules.stderr b/tests/ui/test-attrs/inaccessible-test-modules.stderr index 7635f579d66b9..dfb6985730af5 100644 --- a/tests/ui/test-attrs/inaccessible-test-modules.stderr +++ b/tests/ui/test-attrs/inaccessible-test-modules.stderr @@ -13,7 +13,7 @@ LL | use test as y; help: consider importing this module instead | LL | use test::test as y; - | ~~~~~~~~~~~~~~~ + | ++++++ error: aborting due to 2 previous errors diff --git a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr index 7985b611a4f60..2288bd1129c43 100644 --- a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr +++ b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr @@ -15,7 +15,7 @@ LL + struct Foo where T: Bar, T: Bar { help: a trait with a similar name exists | LL | struct Foo where T: Bar, ::Baz: ToString { - | ~~~~~~~~ + | ++ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:9:54 @@ -34,7 +34,7 @@ LL + struct Qux<'a, T> where T: Bar, &'a T: Bar { help: a trait with a similar name exists | LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: ToString { - | ~~~~~~~~ + | ++ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:13:45 @@ -53,7 +53,7 @@ LL + fn foo(_: T) where T: Bar { help: a trait with a similar name exists | LL | fn foo(_: T) where ::Baz: ToString { - | ~~~~~~~~ + | ++ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:16:57 @@ -72,7 +72,7 @@ LL + fn qux<'a, T: Bar>(_: &'a T) where &'a T: Bar { help: a trait with a similar name exists | LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString { - | ~~~~~~~~ + | ++ error[E0405]: cannot find trait `Unresolved` in this scope --> $DIR/assoc_type_bound_with_struct.rs:19:31 diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr index 40e16dde6e4a4..9d54675c260b2 100644 --- a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr @@ -26,7 +26,7 @@ LL | for F: 'a, help: consider adding an explicit lifetime bound | LL | for F: 'a, !1_"F": 'a - | ~~~~~~~~~~~~ + | ++++++++++ error[E0309]: the placeholder type `!1_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 @@ -40,7 +40,7 @@ LL | {} help: consider adding an explicit lifetime bound | LL | for F: 'a, !1_"F": 'a - | ~~~~~~~~~~~~ + | ++++++++++ error[E0309]: the placeholder type `!2_"F"` may not live long enough --> $DIR/type-match-with-late-bound.rs:11:1 @@ -54,7 +54,7 @@ LL | {} help: consider adding an explicit lifetime bound | LL | for F: 'a, !2_"F": 'a - | ~~~~~~~~~~~~ + | ++++++++++ error: aborting due to 3 previous errors; 1 warning emitted diff --git a/tests/ui/transmutability/assoc-bound.stderr b/tests/ui/transmutability/assoc-bound.stderr index b3c7680bf2949..4dff24e2002aa 100644 --- a/tests/ui/transmutability/assoc-bound.stderr +++ b/tests/ui/transmutability/assoc-bound.stderr @@ -13,7 +13,7 @@ LL | type AssocB: std::mem::TransmuteFrom<()>; help: consider further restricting the associated type | LL | T: A, ::AssocA: TransmuteFrom<(), Assume { alignment: false, lifetimes: false, safety: false, validity: false }> - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0277]: `()` cannot be safely transmuted into `<&i32 as A>::AssocA` --> $DIR/assoc-bound.rs:24:19 diff --git a/tests/ui/type/issue-100584.stderr b/tests/ui/type/issue-100584.stderr index e1db14d1f001b..1523bdda7614b 100644 --- a/tests/ui/type/issue-100584.stderr +++ b/tests/ui/type/issue-100584.stderr @@ -20,7 +20,7 @@ LL | let _ = format!("{xyza}"); help: if this is intentional, prefix it with an underscore | LL | fn foo(_xyza: &str) { - | ~~~~~ + | + error: unused variable: `xyza` --> $DIR/issue-100584.rs:7:9 @@ -38,7 +38,7 @@ LL | let _ = format!("aaa{xyza}bbb"); help: if this is intentional, prefix it with an underscore | LL | fn foo3(_xyza: &str) { - | ~~~~~ + | + error: aborting due to 2 previous errors diff --git a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr index 19b0c1059c86f..4af92a89c445a 100644 --- a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr +++ b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr @@ -7,7 +7,7 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); help: if you meant to write a byte literal, prefix with `b` | LL | const BAD_NESTING4: pattern_type!(u8 is b'a'..='a') = todo!(); - | ~~~~ + | + error[E0308]: mismatched types --> $DIR/pattern_type_mismatch.rs:8:47 @@ -18,7 +18,7 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); help: if you meant to write a byte literal, prefix with `b` | LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..=b'a') = todo!(); - | ~~~~ + | + error[E0308]: mismatched types --> $DIR/pattern_type_mismatch.rs:12:43 diff --git a/tests/ui/typeck/issue-29181.stderr b/tests/ui/typeck/issue-29181.stderr index 53addf2fe4d09..ca82405966ecd 100644 --- a/tests/ui/typeck/issue-29181.stderr +++ b/tests/ui/typeck/issue-29181.stderr @@ -13,7 +13,7 @@ LL | let _ = |x: f64| x * 2.0.exp(); help: you must specify a concrete type for this numeric value, like `f32` | LL | let _ = |x: f64| x * 2.0_f32.exp(); - | ~~~~~~~ + | ++++ error: aborting due to 2 previous errors diff --git a/tests/ui/typeck/method-chain-gats.stderr b/tests/ui/typeck/method-chain-gats.stderr index 6338379221471..d3a54dbd0f9e2 100644 --- a/tests/ui/typeck/method-chain-gats.stderr +++ b/tests/ui/typeck/method-chain-gats.stderr @@ -20,7 +20,7 @@ LL | Self::Base: Functor; help: consider further restricting the associated type | LL | T::Base: Functor = T::Base>, ::Base: Functor - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + | ++++++++++++++++++++++++++++++++ error: aborting due to 1 previous error diff --git a/tests/ui/typeck/mismatched-map-under-self.stderr b/tests/ui/typeck/mismatched-map-under-self.stderr index 59de00a58bbea..541de25749e38 100644 --- a/tests/ui/typeck/mismatched-map-under-self.stderr +++ b/tests/ui/typeck/mismatched-map-under-self.stderr @@ -14,7 +14,7 @@ LL | fn values(&self) -> Self::Values; help: change the self-receiver type to match the trait | LL | fn values(&self) -> Self::Values { - | ~~~~~ + | + error[E0631]: type mismatch in function arguments --> $DIR/mismatched-map-under-self.rs:12:18 diff --git a/tests/ui/unresolved/unresolved-candidates.stderr b/tests/ui/unresolved/unresolved-candidates.stderr index 7ef2f6b1a2922..7be1bcd38de59 100644 --- a/tests/ui/unresolved/unresolved-candidates.stderr +++ b/tests/ui/unresolved/unresolved-candidates.stderr @@ -7,7 +7,7 @@ LL | use Trait; help: consider importing this trait instead | LL | use a::Trait; - | ~~~~~~~~ + | +++ error[E0405]: cannot find trait `Trait` in this scope --> $DIR/unresolved-candidates.rs:10:10