From 91af6b51223625ea5cd34d77861648ca19566deb Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Tue, 2 Jul 2024 15:00:09 -0700 Subject: [PATCH 01/18] Add edge-case examples to `{count,leading,trailing}_{ones,zeros}` methods Some architectures (i386) do not define a "count leading zeros" instruction, they define a "find first set bit" instruction (`bsf`) whose result is undefined when given zero (ie none of the bits are set). Of this family of bitwise operations, I always forget which of these things is potentially undefined for zero, and I'm also not 100% sure that Rust provides a hard guarantee for the results of these methods when given zero. So I figured there are others who have these same uncertainties, and it would be good to resolve them and answer the question via extending these doc examples/tests. See https://en.wikipedia.org/wiki/Find_first_set#Hardware_support for more info on i386 and `bsf` on zero. --- library/core/src/num/uint_macros.rs | 41 ++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index ad72c29758bd7..40bc58204e808 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -65,8 +65,13 @@ macro_rules! uint_impl { /// /// ``` #[doc = concat!("let n = 0b01001100", stringify!($SelfT), ";")] - /// /// assert_eq!(n.count_ones(), 3); + /// + #[doc = concat!("let max = ", stringify!($SelfT),"::MAX;")] + #[doc = concat!("assert_eq!(max.count_ones(), ", stringify!($BITS), ");")] + /// + #[doc = concat!("let zero = 0", stringify!($SelfT), ";")] + /// assert_eq!(zero.count_ones(), 0); /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_math", since = "1.32.0")] @@ -86,7 +91,11 @@ macro_rules! uint_impl { /// Basic usage: /// /// ``` - #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.count_zeros(), 0);")] + #[doc = concat!("let zero = 0", stringify!($SelfT), ";")] + #[doc = concat!("assert_eq!(zero.count_zeros(), ", stringify!($BITS), ");")] + /// + #[doc = concat!("let max = ", stringify!($SelfT),"::MAX;")] + /// assert_eq!(max.count_zeros(), 0); /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_math", since = "1.32.0")] @@ -108,8 +117,13 @@ macro_rules! uint_impl { /// /// ``` #[doc = concat!("let n = ", stringify!($SelfT), "::MAX >> 2;")] - /// /// assert_eq!(n.leading_zeros(), 2); + /// + #[doc = concat!("let zero = 0", stringify!($SelfT), ";")] + #[doc = concat!("assert_eq!(zero.leading_zeros(), ", stringify!($BITS), ");")] + /// + #[doc = concat!("let max = ", stringify!($SelfT),"::MAX;")] + /// assert_eq!(max.leading_zeros(), 0); /// ``` #[doc = concat!("[`ilog2`]: ", stringify!($SelfT), "::ilog2")] #[stable(feature = "rust1", since = "1.0.0")] @@ -130,8 +144,13 @@ macro_rules! uint_impl { /// /// ``` #[doc = concat!("let n = 0b0101000", stringify!($SelfT), ";")] - /// /// assert_eq!(n.trailing_zeros(), 3); + /// + #[doc = concat!("let zero = 0", stringify!($SelfT), ";")] + #[doc = concat!("assert_eq!(zero.trailing_zeros(), ", stringify!($BITS), ");")] + /// + #[doc = concat!("let max = ", stringify!($SelfT),"::MAX;")] + #[doc = concat!("assert_eq!(max.trailing_zeros(), 0);")] /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_math", since = "1.32.0")] @@ -150,8 +169,13 @@ macro_rules! uint_impl { /// /// ``` #[doc = concat!("let n = !(", stringify!($SelfT), "::MAX >> 2);")] - /// /// assert_eq!(n.leading_ones(), 2); + /// + #[doc = concat!("let zero = 0", stringify!($SelfT), ";")] + /// assert_eq!(zero.leading_ones(), 0); + /// + #[doc = concat!("let max = ", stringify!($SelfT),"::MAX;")] + #[doc = concat!("assert_eq!(max.leading_ones(), ", stringify!($BITS), ");")] /// ``` #[stable(feature = "leading_trailing_ones", since = "1.46.0")] #[rustc_const_stable(feature = "leading_trailing_ones", since = "1.46.0")] @@ -171,8 +195,13 @@ macro_rules! uint_impl { /// /// ``` #[doc = concat!("let n = 0b1010111", stringify!($SelfT), ";")] - /// /// assert_eq!(n.trailing_ones(), 3); + /// + #[doc = concat!("let zero = 0", stringify!($SelfT), ";")] + /// assert_eq!(zero.trailing_ones(), 0); + /// + #[doc = concat!("let max = ", stringify!($SelfT),"::MAX;")] + #[doc = concat!("assert_eq!(max.trailing_ones(), ", stringify!($BITS), ");")] /// ``` #[stable(feature = "leading_trailing_ones", since = "1.46.0")] #[rustc_const_stable(feature = "leading_trailing_ones", since = "1.46.0")] From 6519c143a7ae1494b38920cfb08a55793fbfe07d Mon Sep 17 00:00:00 2001 From: B I Mohammed Abbas Date: Mon, 8 Jul 2024 10:56:13 +0530 Subject: [PATCH 02/18] Reset sigpipe not supported for vxworks --- library/std/src/sys/pal/unix/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/library/std/src/sys/pal/unix/mod.rs b/library/std/src/sys/pal/unix/mod.rs index 16fc2011d7085..d016e5e32d404 100644 --- a/library/std/src/sys/pal/unix/mod.rs +++ b/library/std/src/sys/pal/unix/mod.rs @@ -164,6 +164,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { target_os = "emscripten", target_os = "fuchsia", target_os = "horizon", + target_os = "vxworks", // Unikraft's `signal` implementation is currently broken: // https://github.com/unikraft/lib-musl/issues/57 target_vendor = "unikraft", From 287b66b0b5cc06b9c0acb01d8a7b0db9ddf764ee Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 8 Jun 2024 11:26:10 +0200 Subject: [PATCH 03/18] size_of_val_raw: for length 0 this is safe to call --- library/core/src/alloc/layout.rs | 2 ++ library/core/src/mem/mod.rs | 8 ++++++++ tests/ui/layout/size-of-val-raw-too-big.rs | 18 ++++++++++++++++++ tests/ui/layout/size-of-val-raw-too-big.stderr | 4 ++++ 4 files changed, 32 insertions(+) create mode 100644 tests/ui/layout/size-of-val-raw-too-big.rs create mode 100644 tests/ui/layout/size-of-val-raw-too-big.stderr diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs index 0b92767c93205..e96a41422a2af 100644 --- a/library/core/src/alloc/layout.rs +++ b/library/core/src/alloc/layout.rs @@ -183,6 +183,8 @@ impl Layout { /// - a [slice], then the length of the slice tail must be an initialized /// integer, and the size of the *entire value* /// (dynamic tail length + statically sized prefix) must fit in `isize`. + /// For the special case where the dynamic tail length is 0, this function + /// is safe to call. /// - a [trait object], then the vtable part of the pointer must point /// to a valid vtable for the type `T` acquired by an unsizing coercion, /// and the size of the *entire value* diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index dd4b6e823434e..9bb4ba922cd44 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -359,6 +359,12 @@ pub const fn size_of_val(val: &T) -> usize { /// - a [slice], then the length of the slice tail must be an initialized /// integer, and the size of the *entire value* /// (dynamic tail length + statically sized prefix) must fit in `isize`. +/// For the special case where the dynamic tail length is 0, this function +/// is safe to call. +// NOTE: the reason this is safe is that if an overflow were to occur already with size 0, +// then we would stop compilation as even the "statically known" part of the type would +// already be too big (or the call may be in dead code and optimized away, but then it +// doesn't matter). /// - a [trait object], then the vtable part of the pointer must point /// to a valid vtable acquired by an unsizing coercion, and the size /// of the *entire value* (dynamic tail length + statically sized prefix) @@ -506,6 +512,8 @@ pub const fn align_of_val(val: &T) -> usize { /// - a [slice], then the length of the slice tail must be an initialized /// integer, and the size of the *entire value* /// (dynamic tail length + statically sized prefix) must fit in `isize`. +/// For the special case where the dynamic tail length is 0, this function +/// is safe to call. /// - a [trait object], then the vtable part of the pointer must point /// to a valid vtable acquired by an unsizing coercion, and the size /// of the *entire value* (dynamic tail length + statically sized prefix) diff --git a/tests/ui/layout/size-of-val-raw-too-big.rs b/tests/ui/layout/size-of-val-raw-too-big.rs new file mode 100644 index 0000000000000..8d82c78d95397 --- /dev/null +++ b/tests/ui/layout/size-of-val-raw-too-big.rs @@ -0,0 +1,18 @@ +//@ build-fail +//@ compile-flags: --crate-type lib +//@ only-32bit Layout computation rejects this layout for different reasons on 64-bit. +//@ error-pattern: too big for the current architecture +#![feature(core_intrinsics)] +#![allow(internal_features)] + +// isize::MAX is fine, but with the padding for the unsized tail it is too big. +#[repr(C)] +pub struct Example([u8; isize::MAX as usize], [u16]); + +// We guarantee that with length 0, `size_of_val_raw` (which calls the `size_of_val` intrinsic) +// is safe to call. The compiler aborts compilation if a length of 0 would overflow. +// So let's construct a case where length 0 just barely overflows, and ensure that +// does abort compilation. +pub fn check(x: *const Example) -> usize { + unsafe { std::intrinsics::size_of_val(x) } +} diff --git a/tests/ui/layout/size-of-val-raw-too-big.stderr b/tests/ui/layout/size-of-val-raw-too-big.stderr new file mode 100644 index 0000000000000..aa9abd644faaf --- /dev/null +++ b/tests/ui/layout/size-of-val-raw-too-big.stderr @@ -0,0 +1,4 @@ +error: values of the type `Example` are too big for the current architecture + +error: aborting due to 1 previous error + From f6fe7e49a2bc2ad14513aa609b67e188470309f6 Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Sun, 14 Jul 2024 22:17:28 +0300 Subject: [PATCH 04/18] lib: replace some `mem::forget`'s with `ManuallyDrop` --- library/alloc/src/rc.rs | 47 +++++++++---------- library/alloc/src/sync.rs | 36 +++++++------- library/core/src/task/wake.rs | 15 ++---- library/proc_macro/src/bridge/buffer.rs | 11 ++--- library/proc_macro/src/bridge/client.rs | 4 +- library/std/src/os/fd/owned.rs | 6 +-- library/std/src/os/solid/io.rs | 6 +-- library/std/src/os/windows/io/handle.rs | 6 +-- library/std/src/os/windows/io/socket.rs | 7 +-- library/std/src/sys/pal/hermit/thread.rs | 6 +-- library/std/src/sys/pal/sgx/abi/tls/mod.rs | 4 +- .../src/sys/pal/sgx/abi/usercalls/alloc.rs | 7 ++- library/std/src/sys/pal/sgx/fd.rs | 10 ++-- library/std/src/sys/pal/teeos/thread.rs | 16 ++----- library/std/src/sys/pal/unix/thread.rs | 14 ++---- library/std/src/sys/pal/wasi/thread.rs | 10 ++-- library/std/src/thread/mod.rs | 9 ++-- .../libc_pthread_mutex_deadlock.stderr | 2 +- ..._pthread_rwlock_write_read_deadlock.stderr | 2 +- ...pthread_rwlock_write_write_deadlock.stderr | 2 +- 20 files changed, 88 insertions(+), 132 deletions(-) diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index 9982c8ea6dcbe..bfe3ea2080017 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -259,7 +259,7 @@ use core::intrinsics::abort; #[cfg(not(no_global_oom_handling))] use core::iter; use core::marker::{PhantomData, Unsize}; -use core::mem::{self, align_of_val_raw, forget, ManuallyDrop}; +use core::mem::{self, align_of_val_raw, ManuallyDrop}; use core::ops::{CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn, Receiver}; use core::panic::{RefUnwindSafe, UnwindSafe}; #[cfg(not(no_global_oom_handling))] @@ -908,19 +908,18 @@ impl Rc { #[stable(feature = "rc_unique", since = "1.4.0")] pub fn try_unwrap(this: Self) -> Result { if Rc::strong_count(&this) == 1 { - unsafe { - let val = ptr::read(&*this); // copy the contained object - let alloc = ptr::read(&this.alloc); // copy the allocator - - // Indicate to Weaks that they can't be promoted by decrementing - // the strong count, and then remove the implicit "strong weak" - // pointer while also handling drop logic by just crafting a - // fake Weak. - this.inner().dec_strong(); - let _weak = Weak { ptr: this.ptr, alloc }; - forget(this); - Ok(val) - } + let this = ManuallyDrop::new(this); + + let val: T = unsafe { ptr::read(&**this) }; // copy the contained object + let alloc: A = unsafe { ptr::read(&this.alloc) }; // copy the allocator + + // Indicate to Weaks that they can't be promoted by decrementing + // the strong count, and then remove the implicit "strong weak" + // pointer while also handling drop logic by just crafting a + // fake Weak. + this.inner().dec_strong(); + let _weak = Weak { ptr: this.ptr, alloc }; + Ok(val) } else { Err(this) } @@ -1354,9 +1353,8 @@ impl Rc { #[stable(feature = "rc_raw", since = "1.17.0")] #[rustc_never_returns_null_ptr] pub fn into_raw(this: Self) -> *const T { - let ptr = Self::as_ptr(&this); - mem::forget(this); - ptr + let this = ManuallyDrop::new(this); + Self::as_ptr(&*this) } /// Consumes the `Rc`, returning the wrapped pointer and allocator. @@ -2127,7 +2125,7 @@ impl Rc<[T]> { } // All clear. Forget the guard so it doesn't free the new RcBox. - forget(guard); + mem::forget(guard); Self::from_ptr(ptr) } @@ -3080,9 +3078,7 @@ impl Weak { #[must_use = "losing the pointer will leak memory"] #[stable(feature = "weak_into_raw", since = "1.45.0")] pub fn into_raw(self) -> *const T { - let result = self.as_ptr(); - mem::forget(self); - result + mem::ManuallyDrop::new(self).as_ptr() } /// Consumes the `Weak`, returning the wrapped pointer and allocator. @@ -3762,10 +3758,11 @@ impl UniqueRcUninit { /// # Safety /// /// The data must have been initialized (by writing to [`Self::data_ptr()`]). - unsafe fn into_rc(mut self) -> Rc { - let ptr = self.ptr; - let alloc = self.alloc.take().unwrap(); - mem::forget(self); + unsafe fn into_rc(self) -> Rc { + let mut this = ManuallyDrop::new(self); + let ptr = this.ptr; + let alloc = this.alloc.take().unwrap(); + // SAFETY: The pointer is valid as per `UniqueRcUninit::new`, and the caller is responsible // for having initialized the data. unsafe { Rc::from_ptr_in(ptr.as_ptr(), alloc) } diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index a905a1e6b7e62..c36b8f6a1ac8a 100644 --- a/library/alloc/src/sync.rs +++ b/library/alloc/src/sync.rs @@ -20,7 +20,7 @@ use core::intrinsics::abort; #[cfg(not(no_global_oom_handling))] use core::iter; use core::marker::{PhantomData, Unsize}; -use core::mem::{self, align_of_val_raw}; +use core::mem::{self, align_of_val_raw, ManuallyDrop}; use core::ops::{CoerceUnsized, Deref, DerefPure, DispatchFromDyn, Receiver}; use core::panic::{RefUnwindSafe, UnwindSafe}; use core::pin::Pin; @@ -960,16 +960,14 @@ impl Arc { acquire!(this.inner().strong); - unsafe { - let elem = ptr::read(&this.ptr.as_ref().data); - let alloc = ptr::read(&this.alloc); // copy the allocator + let this = ManuallyDrop::new(this); + let elem: T = unsafe { ptr::read(&this.ptr.as_ref().data) }; + let alloc: A = unsafe { ptr::read(&this.alloc) }; // copy the allocator - // Make a weak pointer to clean up the implicit strong-weak reference - let _weak = Weak { ptr: this.ptr, alloc }; - mem::forget(this); + // Make a weak pointer to clean up the implicit strong-weak reference + let _weak = Weak { ptr: this.ptr, alloc }; - Ok(elem) - } + Ok(elem) } /// Returns the inner value, if the `Arc` has exactly one strong reference. @@ -1493,9 +1491,8 @@ impl Arc { #[stable(feature = "rc_raw", since = "1.17.0")] #[rustc_never_returns_null_ptr] pub fn into_raw(this: Self) -> *const T { - let ptr = Self::as_ptr(&this); - mem::forget(this); - ptr + let this = ManuallyDrop::new(this); + Self::as_ptr(&*this) } /// Consumes the `Arc`, returning the wrapped pointer and allocator. @@ -2801,9 +2798,7 @@ impl Weak { #[must_use = "losing the pointer will leak memory"] #[stable(feature = "weak_into_raw", since = "1.45.0")] pub fn into_raw(self) -> *const T { - let result = self.as_ptr(); - mem::forget(self); - result + ManuallyDrop::new(self).as_ptr() } /// Consumes the `Weak`, returning the wrapped pointer and allocator. @@ -3875,13 +3870,14 @@ impl UniqueArcUninit { /// # Safety /// /// The data must have been initialized (by writing to [`Self::data_ptr()`]). - unsafe fn into_arc(mut self) -> Arc { - let ptr = self.ptr; - let alloc = self.alloc.take().unwrap(); - mem::forget(self); + unsafe fn into_arc(self) -> Arc { + let mut this = ManuallyDrop::new(self); + let ptr = this.ptr.as_ptr(); + let alloc = this.alloc.take().unwrap(); + // SAFETY: The pointer is valid as per `UniqueArcUninit::new`, and the caller is responsible // for having initialized the data. - unsafe { Arc::from_ptr_in(ptr.as_ptr(), alloc) } + unsafe { Arc::from_ptr_in(ptr, alloc) } } } diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs index 86a965f68e085..e785d75a63d7a 100644 --- a/library/core/src/task/wake.rs +++ b/library/core/src/task/wake.rs @@ -1,10 +1,9 @@ #![stable(feature = "futures_api", since = "1.36.0")] -use crate::mem::transmute; - use crate::any::Any; use crate::fmt; use crate::marker::PhantomData; +use crate::mem::{transmute, ManuallyDrop}; use crate::panic::AssertUnwindSafe; use crate::ptr; @@ -465,16 +464,14 @@ impl Waker { pub fn wake(self) { // The actual wakeup call is delegated through a virtual function call // to the implementation which is defined by the executor. - let wake = self.waker.vtable.wake; - let data = self.waker.data; // Don't call `drop` -- the waker will be consumed by `wake`. - crate::mem::forget(self); + let this = ManuallyDrop::new(self); // SAFETY: This is safe because `Waker::from_raw` is the only way // to initialize `wake` and `data` requiring the user to acknowledge // that the contract of `RawWaker` is upheld. - unsafe { (wake)(data) }; + unsafe { (this.waker.vtable.wake)(this.waker.data) }; } /// Wake up the task associated with this `Waker` without consuming the `Waker`. @@ -726,16 +723,14 @@ impl LocalWaker { pub fn wake(self) { // The actual wakeup call is delegated through a virtual function call // to the implementation which is defined by the executor. - let wake = self.waker.vtable.wake; - let data = self.waker.data; // Don't call `drop` -- the waker will be consumed by `wake`. - crate::mem::forget(self); + let this = ManuallyDrop::new(self); // SAFETY: This is safe because `Waker::from_raw` is the only way // to initialize `wake` and `data` requiring the user to acknowledge // that the contract of `RawWaker` is upheld. - unsafe { (wake)(data) }; + unsafe { (this.waker.vtable.wake)(this.waker.data) }; } /// Wake up the task associated with this `LocalWaker` without consuming the `LocalWaker`. diff --git a/library/proc_macro/src/bridge/buffer.rs b/library/proc_macro/src/bridge/buffer.rs index 149767bf70521..78fcd1999b2f3 100644 --- a/library/proc_macro/src/bridge/buffer.rs +++ b/library/proc_macro/src/bridge/buffer.rs @@ -1,7 +1,7 @@ //! Buffer management for same-process client<->server communication. use std::io::{self, Write}; -use std::mem; +use std::mem::{self, ManuallyDrop}; use std::ops::{Deref, DerefMut}; use std::slice; @@ -129,17 +129,16 @@ impl Drop for Buffer { } impl From> for Buffer { - fn from(mut v: Vec) -> Self { + fn from(v: Vec) -> Self { + let mut v = ManuallyDrop::new(v); let (data, len, capacity) = (v.as_mut_ptr(), v.len(), v.capacity()); - mem::forget(v); // This utility function is nested in here because it can *only* // be safely called on `Buffer`s created by *this* `proc_macro`. fn to_vec(b: Buffer) -> Vec { unsafe { - let Buffer { data, len, capacity, .. } = b; - mem::forget(b); - Vec::from_raw_parts(data, len, capacity) + let b = ManuallyDrop::new(b); + Vec::from_raw_parts(b.data, b.len, b.capacity) } } diff --git a/library/proc_macro/src/bridge/client.rs b/library/proc_macro/src/bridge/client.rs index faca745e56f74..9658fc4840f67 100644 --- a/library/proc_macro/src/bridge/client.rs +++ b/library/proc_macro/src/bridge/client.rs @@ -51,9 +51,7 @@ macro_rules! define_client_handles { impl Encode for $oty { fn encode(self, w: &mut Writer, s: &mut S) { - let handle = self.handle; - mem::forget(self); - handle.encode(w, s); + mem::ManuallyDrop::new(self).handle.encode(w, s); } } diff --git a/library/std/src/os/fd/owned.rs b/library/std/src/os/fd/owned.rs index a1f83029d2727..800f3b0274faf 100644 --- a/library/std/src/os/fd/owned.rs +++ b/library/std/src/os/fd/owned.rs @@ -8,7 +8,7 @@ use crate::fmt; use crate::fs; use crate::io; use crate::marker::PhantomData; -use crate::mem::forget; +use crate::mem::ManuallyDrop; #[cfg(not(any(target_arch = "wasm32", target_env = "sgx", target_os = "hermit")))] use crate::sys::cvt; use crate::sys_common::{AsInner, FromInner, IntoInner}; @@ -141,9 +141,7 @@ impl AsRawFd for OwnedFd { impl IntoRawFd for OwnedFd { #[inline] fn into_raw_fd(self) -> RawFd { - let fd = self.fd; - forget(self); - fd + ManuallyDrop::new(self).fd } } diff --git a/library/std/src/os/solid/io.rs b/library/std/src/os/solid/io.rs index 19b4fe22093c3..34fd745d4f9b4 100644 --- a/library/std/src/os/solid/io.rs +++ b/library/std/src/os/solid/io.rs @@ -49,7 +49,7 @@ use crate::fmt; use crate::marker::PhantomData; -use crate::mem::forget; +use crate::mem::ManuallyDrop; use crate::net; use crate::sys; use crate::sys_common::{self, AsInner, FromInner, IntoInner}; @@ -149,9 +149,7 @@ impl AsRawFd for OwnedFd { impl IntoRawFd for OwnedFd { #[inline] fn into_raw_fd(self) -> RawFd { - let fd = self.fd; - forget(self); - fd + ManuallyDrop::new(self).fd } } diff --git a/library/std/src/os/windows/io/handle.rs b/library/std/src/os/windows/io/handle.rs index a9d1983dce610..9865386e753df 100644 --- a/library/std/src/os/windows/io/handle.rs +++ b/library/std/src/os/windows/io/handle.rs @@ -7,7 +7,7 @@ use crate::fmt; use crate::fs; use crate::io; use crate::marker::PhantomData; -use crate::mem::{forget, ManuallyDrop}; +use crate::mem::ManuallyDrop; use crate::ptr; use crate::sys; use crate::sys::cvt; @@ -319,9 +319,7 @@ impl AsRawHandle for OwnedHandle { impl IntoRawHandle for OwnedHandle { #[inline] fn into_raw_handle(self) -> RawHandle { - let handle = self.handle; - forget(self); - handle + ManuallyDrop::new(self).handle } } diff --git a/library/std/src/os/windows/io/socket.rs b/library/std/src/os/windows/io/socket.rs index 6ffdf907c8ed3..a0a0cd2d2a3f2 100644 --- a/library/std/src/os/windows/io/socket.rs +++ b/library/std/src/os/windows/io/socket.rs @@ -6,8 +6,7 @@ use super::raw::{AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket}; use crate::fmt; use crate::io; use crate::marker::PhantomData; -use crate::mem; -use crate::mem::forget; +use crate::mem::{self, ManuallyDrop}; use crate::sys; #[cfg(not(target_vendor = "uwp"))] use crate::sys::cvt; @@ -191,9 +190,7 @@ impl AsRawSocket for OwnedSocket { impl IntoRawSocket for OwnedSocket { #[inline] fn into_raw_socket(self) -> RawSocket { - let socket = self.socket; - forget(self); - socket + ManuallyDrop::new(self).socket } } diff --git a/library/std/src/sys/pal/hermit/thread.rs b/library/std/src/sys/pal/hermit/thread.rs index a244b953d2a49..3723f03081c17 100644 --- a/library/std/src/sys/pal/hermit/thread.rs +++ b/library/std/src/sys/pal/hermit/thread.rs @@ -3,7 +3,7 @@ use super::hermit_abi; use crate::ffi::CStr; use crate::io; -use crate::mem; +use crate::mem::ManuallyDrop; use crate::num::NonZero; use crate::ptr; use crate::time::Duration; @@ -90,9 +90,7 @@ impl Thread { #[inline] pub fn into_id(self) -> Tid { - let id = self.tid; - mem::forget(self); - id + ManuallyDrop::new(self).tid } } diff --git a/library/std/src/sys/pal/sgx/abi/tls/mod.rs b/library/std/src/sys/pal/sgx/abi/tls/mod.rs index 8a9ea4ac00df0..bab59a3422d15 100644 --- a/library/std/src/sys/pal/sgx/abi/tls/mod.rs +++ b/library/std/src/sys/pal/sgx/abi/tls/mod.rs @@ -95,8 +95,8 @@ impl Tls { #[allow(unused)] pub unsafe fn activate_persistent(self: Box) { // FIXME: Needs safety information. See entry.S for `set_tls_ptr` definition. - unsafe { set_tls_ptr(core::ptr::addr_of!(*self) as _) }; - mem::forget(self); + let ptr = Box::into_raw(self).cast_const().cast::(); + unsafe { set_tls_ptr(ptr) }; } unsafe fn current<'a>() -> &'a Tls { diff --git a/library/std/src/sys/pal/sgx/abi/usercalls/alloc.rs b/library/std/src/sys/pal/sgx/abi/usercalls/alloc.rs index f99cea360f1f4..b625636752cc1 100644 --- a/library/std/src/sys/pal/sgx/abi/usercalls/alloc.rs +++ b/library/std/src/sys/pal/sgx/abi/usercalls/alloc.rs @@ -5,7 +5,7 @@ use crate::cell::UnsafeCell; use crate::cmp; use crate::convert::TryInto; use crate::intrinsics; -use crate::mem; +use crate::mem::{self, ManuallyDrop}; use crate::ops::{CoerceUnsized, Deref, DerefMut, Index, IndexMut}; use crate::ptr::{self, NonNull}; use crate::slice; @@ -176,6 +176,7 @@ unsafe impl UserSafe for [T] { /// are used solely to indicate intent: a mutable reference is for writing to /// user memory, an immutable reference for reading from user memory. #[unstable(feature = "sgx_platform", issue = "56975")] +#[repr(transparent)] pub struct UserRef(UnsafeCell); /// An owned type in userspace memory. `User` is equivalent to `Box` in /// enclave memory. Access to the memory is only allowed by copying to avoid @@ -266,9 +267,7 @@ where /// Converts this value into a raw pointer. The value will no longer be /// automatically freed. pub fn into_raw(self) -> *mut T { - let ret = self.0; - mem::forget(self); - ret.as_ptr() as _ + ManuallyDrop::new(self).0.as_ptr() as _ } } diff --git a/library/std/src/sys/pal/sgx/fd.rs b/library/std/src/sys/pal/sgx/fd.rs index b3686d0e28328..c41b527cff798 100644 --- a/library/std/src/sys/pal/sgx/fd.rs +++ b/library/std/src/sys/pal/sgx/fd.rs @@ -2,7 +2,7 @@ use fortanix_sgx_abi::Fd; use super::abi::usercalls; use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut}; -use crate::mem; +use crate::mem::ManuallyDrop; use crate::sys::{AsInner, FromInner, IntoInner}; #[derive(Debug)] @@ -21,9 +21,7 @@ impl FileDesc { /// Extracts the actual file descriptor without closing it. pub fn into_raw(self) -> Fd { - let fd = self.fd; - mem::forget(self); - fd + ManuallyDrop::new(self).fd } pub fn read(&self, buf: &mut [u8]) -> io::Result { @@ -70,9 +68,7 @@ impl AsInner for FileDesc { impl IntoInner for FileDesc { fn into_inner(self) -> Fd { - let fd = self.fd; - mem::forget(self); - fd + ManuallyDrop::new(self).fd } } diff --git a/library/std/src/sys/pal/teeos/thread.rs b/library/std/src/sys/pal/teeos/thread.rs index f4723b2ea46bf..ef40eba4df2be 100644 --- a/library/std/src/sys/pal/teeos/thread.rs +++ b/library/std/src/sys/pal/teeos/thread.rs @@ -1,9 +1,7 @@ -use core::convert::TryInto; - use crate::cmp; use crate::ffi::CStr; use crate::io; -use crate::mem; +use crate::mem::{self, ManuallyDrop}; use crate::num::NonZero; use crate::ptr; use crate::sys::os; @@ -113,11 +111,9 @@ impl Thread { /// must join, because no pthread_detach supported pub fn join(self) { - unsafe { - let ret = libc::pthread_join(self.id, ptr::null_mut()); - mem::forget(self); - assert!(ret == 0, "failed to join thread: {}", io::Error::from_raw_os_error(ret)); - } + let id = self.into_id(); + let ret = unsafe { libc::pthread_join(id, ptr::null_mut()) }; + assert!(ret == 0, "failed to join thread: {}", io::Error::from_raw_os_error(ret)); } pub fn id(&self) -> libc::pthread_t { @@ -125,9 +121,7 @@ impl Thread { } pub fn into_id(self) -> libc::pthread_t { - let id = self.id; - mem::forget(self); - id + ManuallyDrop::new(self).id } } diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs index 619f4e4121e73..483697b8597f8 100644 --- a/library/std/src/sys/pal/unix/thread.rs +++ b/library/std/src/sys/pal/unix/thread.rs @@ -1,7 +1,7 @@ use crate::cmp; use crate::ffi::CStr; use crate::io; -use crate::mem; +use crate::mem::{self, ManuallyDrop}; use crate::num::NonZero; use crate::ptr; use crate::sys::{os, stack_overflow}; @@ -268,11 +268,9 @@ impl Thread { } pub fn join(self) { - unsafe { - let ret = libc::pthread_join(self.id, ptr::null_mut()); - mem::forget(self); - assert!(ret == 0, "failed to join thread: {}", io::Error::from_raw_os_error(ret)); - } + let id = self.into_id(); + let ret = unsafe { libc::pthread_join(id, ptr::null_mut()) }; + assert!(ret == 0, "failed to join thread: {}", io::Error::from_raw_os_error(ret)); } pub fn id(&self) -> libc::pthread_t { @@ -280,9 +278,7 @@ impl Thread { } pub fn into_id(self) -> libc::pthread_t { - let id = self.id; - mem::forget(self); - id + ManuallyDrop::new(self).id } } diff --git a/library/std/src/sys/pal/wasi/thread.rs b/library/std/src/sys/pal/wasi/thread.rs index 975eef2451f4c..2a3a39aafa704 100644 --- a/library/std/src/sys/pal/wasi/thread.rs +++ b/library/std/src/sys/pal/wasi/thread.rs @@ -172,12 +172,10 @@ impl Thread { pub fn join(self) { cfg_if::cfg_if! { if #[cfg(target_feature = "atomics")] { - unsafe { - let ret = libc::pthread_join(self.id, ptr::null_mut()); - mem::forget(self); - if ret != 0 { - rtabort!("failed to join thread: {}", io::Error::from_raw_os_error(ret)); - } + let id = mem::ManuallyDrop::new(self).id; + let ret = unsafe { libc::pthread_join(id, ptr::null_mut()) }; + if ret != 0 { + rtabort!("failed to join thread: {}", io::Error::from_raw_os_error(ret)); } } else { self.0 diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index c8ee365392f85..73bf562370829 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -165,7 +165,7 @@ use crate::ffi::{CStr, CString}; use crate::fmt; use crate::io; use crate::marker::PhantomData; -use crate::mem::{self, forget}; +use crate::mem::{self, forget, ManuallyDrop}; use crate::num::NonZero; use crate::panic; use crate::panicking; @@ -514,11 +514,10 @@ impl Builder { MaybeDangling(mem::MaybeUninit::new(x)) } fn into_inner(self) -> T { - // SAFETY: we are always initialized. - let ret = unsafe { self.0.assume_init_read() }; // Make sure we don't drop. - mem::forget(self); - ret + let this = ManuallyDrop::new(self); + // SAFETY: we are always initialized. + unsafe { this.0.assume_init_read() } } } impl Drop for MaybeDangling { diff --git a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_deadlock.stderr b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_deadlock.stderr index 987d0fc4c2d04..079c1729b600f 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_deadlock.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_deadlock.stderr @@ -10,7 +10,7 @@ LL | assert_eq!(libc::pthread_mutex_lock(lock_copy.0.get() as *mut _ error: deadlock: the evaluated program deadlocked --> RUSTLIB/std/src/sys/pal/PLATFORM/thread.rs:LL:CC | -LL | let ret = libc::pthread_join(self.id, ptr::null_mut()); +LL | let ret = unsafe { libc::pthread_join(id, ptr::null_mut()) }; | ^ the evaluated program deadlocked | = note: BACKTRACE: diff --git a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock.stderr b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock.stderr index bc9b15f293ef8..d03c6402d64ff 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_read_deadlock.stderr @@ -10,7 +10,7 @@ LL | assert_eq!(libc::pthread_rwlock_wrlock(lock_copy.0.get() as *mu error: deadlock: the evaluated program deadlocked --> RUSTLIB/std/src/sys/pal/PLATFORM/thread.rs:LL:CC | -LL | let ret = libc::pthread_join(self.id, ptr::null_mut()); +LL | let ret = unsafe { libc::pthread_join(id, ptr::null_mut()) }; | ^ the evaluated program deadlocked | = note: BACKTRACE: diff --git a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock.stderr b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock.stderr index 66c142bbc5c80..73c5e77a1bce4 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/libc_pthread_rwlock_write_write_deadlock.stderr @@ -10,7 +10,7 @@ LL | assert_eq!(libc::pthread_rwlock_wrlock(lock_copy.0.get() as *mu error: deadlock: the evaluated program deadlocked --> RUSTLIB/std/src/sys/pal/PLATFORM/thread.rs:LL:CC | -LL | let ret = libc::pthread_join(self.id, ptr::null_mut()); +LL | let ret = unsafe { libc::pthread_join(id, ptr::null_mut()) }; | ^ the evaluated program deadlocked | = note: BACKTRACE: From c807ac034089e31364baa24e19d5d61cbb657989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 5 Jul 2024 01:08:44 +0000 Subject: [PATCH 05/18] Use verbose suggestion for "wrong # of generics" --- .../errors/wrong_number_of_generic_args.rs | 8 +- .../invalid_const_in_lifetime_position.stderr | 27 +- tests/rustdoc-ui/mismatched_arg_count.stderr | 9 +- .../argument-suggestions/issue-100154.stderr | 9 +- ...ssue-82126-mismatched-subst-and-hir.stderr | 18 +- .../transmutable-ice-110969.stderr | 10 +- .../generic_arg_infer/infer-arg-test.stderr | 9 +- .../const_kind_expr/issue_114151.stderr | 9 +- .../generic_const_exprs/issue-102768.stderr | 27 +- .../incorrect-number-of-const-args.stderr | 9 +- .../invalid-const-arg-for-type-param.stderr | 9 +- .../invalid-constant-in-args.stderr | 10 +- tests/ui/constructor-lifetime-args.stderr | 18 +- tests/ui/consts/effect_param.stderr | 40 ++- tests/ui/error-codes/E0107.stderr | 72 +++-- .../gat-trait-path-parenthesised-args.stderr | 27 +- .../parameter_number_and_kind.stderr | 18 +- ...it-path-type-error-once-implemented.stderr | 27 +- .../generics/bad-mid-path-type-params.stderr | 45 ++- .../generics/foreign-generic-mismatch.stderr | 9 +- .../generic-arg-mismatch-recover.stderr | 27 +- ...eric-impl-more-params-with-defaults.stderr | 9 +- ...eric-type-more-params-with-defaults.stderr | 9 +- tests/ui/generics/wrong-number-of-args.stderr | 256 ++++++++++++------ .../explicit-generic-args-for-impl.stderr | 9 +- .../opaque-and-lifetime-mismatch.stderr | 27 +- tests/ui/issues/issue-18423.stderr | 10 +- tests/ui/issues/issue-53251.stderr | 18 +- tests/ui/issues/issue-60622.stderr | 9 +- .../mismatched_arg_count.stderr | 9 +- .../ui/lifetimes/noisy-follow-up-erro.stderr | 9 +- .../method-call-lifetime-args-fail.stderr | 18 +- tests/ui/resolve/issue-3214.stderr | 9 +- ...o-explicit-const-params-cross-crate.stderr | 18 +- .../effects/no-explicit-const-params.stderr | 18 +- tests/ui/seq-args.stderr | 18 +- .../struct-path-associated-type.stderr | 18 +- ...structure-constructor-type-mismatch.stderr | 18 +- tests/ui/suggestions/issue-101421.stderr | 9 +- tests/ui/suggestions/issue-104287.stderr | 9 +- tests/ui/suggestions/issue-89064.stderr | 9 +- ...assoc-type-suggestion-in-trait-impl.stderr | 9 +- tests/ui/traits/object/vs-lifetime.stderr | 9 +- tests/ui/traits/test-2.stderr | 18 +- .../ui/transmutability/issue-101739-2.stderr | 17 +- .../enum-variant-generic-args.stderr | 54 ++-- ...ypeck-builtin-bound-type-parameters.stderr | 78 ++++-- .../typeck_type_placeholder_lifetime_1.stderr | 9 +- .../typeck_type_placeholder_lifetime_2.stderr | 9 +- .../ui/ufcs/ufcs-qpath-missing-params.stderr | 9 +- ...wrong-number-number-type-parameters.stderr | 45 ++- .../unboxed-closure-sugar-wrong-trait.stderr | 9 +- 52 files changed, 811 insertions(+), 401 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs index 10be69a9fbb85..c2d5627f2b042 100644 --- a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs +++ b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs @@ -888,7 +888,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { let comma = if args.len() > 0 { ", " } else { "" }; let trait_path = self.tcx.def_path_str(trait_def_id); let method_name = self.tcx.item_name(self.def_id); - err.span_suggestion( + err.span_suggestion_verbose( expr.span, msg, format!("{trait_path}::{generics}::{method_name}({rcvr}{comma}{rest})"), @@ -952,7 +952,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { s = pluralize!(num_redundant_lt_args), ); - err.span_suggestion( + err.span_suggestion_verbose( span_redundant_lt_args, msg_lifetimes, "", @@ -994,7 +994,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { s = pluralize!(num_redundant_gen_args), ); - err.span_suggestion( + err.span_suggestion_verbose( span_redundant_type_or_const_args, msg_types_or_consts, "", @@ -1044,7 +1044,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { }, ); - err.span_suggestion(span, msg, "", Applicability::MaybeIncorrect); + err.span_suggestion_verbose(span, msg, "", Applicability::MaybeIncorrect); } else if redundant_lifetime_args && redundant_type_or_const_args { remove_lifetime_args(err); remove_type_or_const_args(err); diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr index 50d55284754e5..ff73d3d5ddd64 100644 --- a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr +++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr @@ -18,15 +18,18 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/invalid_const_in_lifetime_position.rs:4:26 | LL | fn f<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/invalid_const_in_lifetime_position.rs:2:10 | LL | type Y<'a>; | ^ +help: remove these generics + | +LL - fn f<'a>(arg : Box = &'a ()>>) {} +LL + fn f<'a>(arg : Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/invalid_const_in_lifetime_position.rs:4:26 @@ -49,9 +52,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/invalid_const_in_lifetime_position.rs:4:26 | LL | fn f<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/invalid_const_in_lifetime_position.rs:2:10 @@ -59,6 +60,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn f<'a>(arg : Box = &'a ()>>) {} +LL + fn f<'a>(arg : Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/invalid_const_in_lifetime_position.rs:4:26 @@ -81,9 +87,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/invalid_const_in_lifetime_position.rs:4:26 | LL | fn f<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/invalid_const_in_lifetime_position.rs:2:10 @@ -91,6 +95,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn f<'a>(arg : Box = &'a ()>>) {} +LL + fn f<'a>(arg : Box>) {} + | error[E0038]: the trait `X` cannot be made into an object --> $DIR/invalid_const_in_lifetime_position.rs:4:20 diff --git a/tests/rustdoc-ui/mismatched_arg_count.stderr b/tests/rustdoc-ui/mismatched_arg_count.stderr index 857bbda2ef471..c58ff7a14df4e 100644 --- a/tests/rustdoc-ui/mismatched_arg_count.stderr +++ b/tests/rustdoc-ui/mismatched_arg_count.stderr @@ -2,15 +2,18 @@ error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were --> $DIR/mismatched_arg_count.rs:7:29 | LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} - | ^^^^^ -- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^ expected 1 lifetime argument | note: type alias defined here, with 1 lifetime parameter: `'a` --> $DIR/mismatched_arg_count.rs:5:6 | LL | type Alias<'a, T> = >::Assoc; | ^^^^^ -- +help: remove this lifetime argument + | +LL - fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} +LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, , T>) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/argument-suggestions/issue-100154.stderr b/tests/ui/argument-suggestions/issue-100154.stderr index 966f56e2a1562..1496d994ef355 100644 --- a/tests/ui/argument-suggestions/issue-100154.stderr +++ b/tests/ui/argument-suggestions/issue-100154.stderr @@ -2,9 +2,7 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/issue-100154.rs:4:5 | LL | foo::<()>(()); - | ^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/issue-100154.rs:1:4 @@ -12,6 +10,11 @@ note: function defined here, with 0 generic parameters LL | fn foo(i: impl std::fmt::Display) {} | ^^^ = note: `impl Trait` cannot be explicitly specified as a generic argument +help: remove these generics + | +LL - foo::<()>(()); +LL + foo(()); + | error[E0277]: `()` doesn't implement `std::fmt::Display` --> $DIR/issue-100154.rs:4:11 diff --git a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr index c0b6dcd1512f7..c50e3fb640597 100644 --- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr +++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr @@ -2,15 +2,18 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 | LL | async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { - | ^^^^^^^^^^^^---- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^^^^^^^^^^^ expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/issue-82126-mismatched-subst-and-hir.rs:24:8 | LL | struct LockedMarket(T); | ^^^^^^^^^^^^ +help: remove these generics + | +LL - async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { +LL + async fn buy_lock(coroutine: &Mutex) -> LockedMarket { + | error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 @@ -32,9 +35,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 | LL | async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { - | ^^^^^^^^^^^^---- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^^^^^^^^^^^ expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/issue-82126-mismatched-subst-and-hir.rs:24:8 @@ -42,6 +43,11 @@ note: struct defined here, with 0 lifetime parameters LL | struct LockedMarket(T); | ^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { +LL + async fn buy_lock(coroutine: &Mutex) -> LockedMarket { + | error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 diff --git a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr index a8fc742e89f54..91a1053bb6d15 100644 --- a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr +++ b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr @@ -2,9 +2,13 @@ error[E0107]: trait takes at most 2 generic arguments but 3 generic arguments we --> $DIR/transmutable-ice-110969.rs:11:14 | LL | Dst: BikeshedIntrinsicFrom, - | ^^^^^^^^^^^^^^^^^^^^^ ------ help: remove this generic argument - | | - | expected at most 2 generic arguments + | ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments + | +help: remove this generic argument + | +LL - Dst: BikeshedIntrinsicFrom, +LL + Dst: BikeshedIntrinsicFrom, + | error[E0308]: mismatched types --> $DIR/transmutable-ice-110969.rs:25:74 diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr index 6d8dd017734c0..f891bbea21ef3 100644 --- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr +++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr @@ -23,15 +23,18 @@ error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supp --> $DIR/infer-arg-test.rs:18:10 | LL | let a: All<_, _, _>; - | ^^^ - help: remove this generic argument - | | - | expected 2 generic arguments + | ^^^ expected 2 generic arguments | note: struct defined here, with 2 generic parameters: `T`, `N` --> $DIR/infer-arg-test.rs:3:8 | LL | struct All<'a, T, const N: usize> { | ^^^ - -------------- +help: remove this generic argument + | +LL - let a: All<_, _, _>; +LL + let a: All<_, _, >; + | error: aborting due to 4 previous errors 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 0c29d94ed5b4a..78d32b57f87f3 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 @@ -2,15 +2,18 @@ error[E0107]: function takes 1 generic argument but 2 generic arguments were sup --> $DIR/issue_114151.rs:17:5 | LL | foo::<_, L>([(); L + 1 + L]); - | ^^^ - help: remove this generic argument - | | - | expected 1 generic argument + | ^^^ expected 1 generic argument | note: function defined here, with 1 generic parameter: `N` --> $DIR/issue_114151.rs:4:4 | LL | fn foo( | ^^^ -------------- +help: remove this generic argument + | +LL - foo::<_, L>([(); L + 1 + L]); +LL + foo::<_, >([(); L + 1 + L]); + | error[E0308]: mismatched types --> $DIR/issue_114151.rs:17:18 diff --git a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr index a470c36134cf4..6bd6eb4e00e6c 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr @@ -18,15 +18,18 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/issue-102768.rs:9:30 | LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/issue-102768.rs:5:10 | LL | type Y<'a>; | ^ +help: remove these generics + | +LL - fn f2<'a>(arg: Box = &'a ()>>) {} +LL + fn f2<'a>(arg: Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/issue-102768.rs:9:30 @@ -49,9 +52,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/issue-102768.rs:9:30 | LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/issue-102768.rs:5:10 @@ -59,6 +60,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn f2<'a>(arg: Box = &'a ()>>) {} +LL + fn f2<'a>(arg: Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/issue-102768.rs:9:30 @@ -81,9 +87,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/issue-102768.rs:9:30 | LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/issue-102768.rs:5:10 @@ -91,6 +95,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn f2<'a>(arg: Box = &'a ()>>) {} +LL + fn f2<'a>(arg: Box>) {} + | error[E0038]: the trait `X` cannot be made into an object --> $DIR/issue-102768.rs:9:24 diff --git a/tests/ui/const-generics/incorrect-number-of-const-args.stderr b/tests/ui/const-generics/incorrect-number-of-const-args.stderr index 01ac4e69a057e..97eb47275c2b2 100644 --- a/tests/ui/const-generics/incorrect-number-of-const-args.stderr +++ b/tests/ui/const-generics/incorrect-number-of-const-args.stderr @@ -20,15 +20,18 @@ error[E0107]: function takes 2 generic arguments but 3 generic arguments were su --> $DIR/incorrect-number-of-const-args.rs:9:5 | LL | foo::<0, 0, 0>(); - | ^^^ - help: remove this generic argument - | | - | expected 2 generic arguments + | ^^^ expected 2 generic arguments | note: function defined here, with 2 generic parameters: `X`, `Y` --> $DIR/incorrect-number-of-const-args.rs:1:4 | LL | fn foo() -> usize { | ^^^ -------------- -------------- +help: remove this generic argument + | +LL - foo::<0, 0, 0>(); +LL + foo::<0, 0, >(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr index 4a649d8a7e881..d4f899f837733 100644 --- a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr +++ b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr @@ -27,15 +27,18 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/invalid-const-arg-for-type-param.rs:12:5 | LL | S::<0>; - | ^----- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/invalid-const-arg-for-type-param.rs:3:8 | LL | struct S; | ^ +help: remove these generics + | +LL - S::<0>; +LL + S; + | error: aborting due to 3 previous errors diff --git a/tests/ui/const-generics/invalid-constant-in-args.stderr b/tests/ui/const-generics/invalid-constant-in-args.stderr index 158b9722ee61b..ed715257ac1c3 100644 --- a/tests/ui/const-generics/invalid-constant-in-args.stderr +++ b/tests/ui/const-generics/invalid-constant-in-args.stderr @@ -2,9 +2,13 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/invalid-constant-in-args.rs:4:12 | LL | let _: Cell<&str, "a"> = Cell::new(""); - | ^^^^ --- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^ expected 1 generic argument + | +help: remove this generic argument + | +LL - let _: Cell<&str, "a"> = Cell::new(""); +LL + let _: Cell<&str, > = Cell::new(""); + | error: aborting due to 1 previous error diff --git a/tests/ui/constructor-lifetime-args.stderr b/tests/ui/constructor-lifetime-args.stderr index a18123fe19cba..9e0bc3c6c1a6e 100644 --- a/tests/ui/constructor-lifetime-args.stderr +++ b/tests/ui/constructor-lifetime-args.stderr @@ -20,15 +20,18 @@ error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/constructor-lifetime-args.rs:19:5 | LL | S::<'static, 'static, 'static>(&0, &0); - | ^ ------- help: remove this lifetime argument - | | - | expected 2 lifetime arguments + | ^ expected 2 lifetime arguments | note: struct defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/constructor-lifetime-args.rs:9:8 | LL | struct S<'a, 'b>(&'a u8, &'b u8); | ^ -- -- +help: remove this lifetime argument + | +LL - S::<'static, 'static, 'static>(&0, &0); +LL + S::<'static, 'static, >(&0, &0); + | error[E0107]: enum takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/constructor-lifetime-args.rs:22:8 @@ -52,15 +55,18 @@ error[E0107]: enum takes 2 lifetime arguments but 3 lifetime arguments were supp --> $DIR/constructor-lifetime-args.rs:24:8 | LL | E::V::<'static, 'static, 'static>(&0); - | ^ ------- help: remove this lifetime argument - | | - | expected 2 lifetime arguments + | ^ expected 2 lifetime arguments | note: enum defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/constructor-lifetime-args.rs:10:6 | LL | enum E<'a, 'b> { | ^ -- -- +help: remove this lifetime argument + | +LL - E::V::<'static, 'static, 'static>(&0); +LL + E::V::<'static, 'static, >(&0); + | error: aborting due to 4 previous errors diff --git a/tests/ui/consts/effect_param.stderr b/tests/ui/consts/effect_param.stderr index dba5d49b7921e..3777e20e4c0ad 100644 --- a/tests/ui/consts/effect_param.stderr +++ b/tests/ui/consts/effect_param.stderr @@ -2,33 +2,49 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/effect_param.rs:11:9 | LL | i8::checked_sub::(42, 43); - | ^^^^^^^^^^^--------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^^ expected 0 generic arguments + | +help: remove these generics + | +LL - i8::checked_sub::(42, 43); +LL + i8::checked_sub(42, 43); + | error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/effect_param.rs:13:9 | LL | i8::checked_sub::(42, 43); - | ^^^^^^^^^^^-------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^^ expected 0 generic arguments + | +help: remove these generics + | +LL - i8::checked_sub::(42, 43); +LL + i8::checked_sub(42, 43); + | error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/effect_param.rs:4:9 | LL | i8::checked_sub::(42, 43); - | ^^^^^^^^^^^-------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^^ expected 0 generic arguments + | +help: remove these generics + | +LL - i8::checked_sub::(42, 43); +LL + i8::checked_sub(42, 43); + | error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/effect_param.rs:6:9 | LL | i8::checked_sub::(42, 43); - | ^^^^^^^^^^^--------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^^ expected 0 generic arguments + | +help: remove these generics + | +LL - i8::checked_sub::(42, 43); +LL + i8::checked_sub(42, 43); + | error: aborting due to 4 previous errors diff --git a/tests/ui/error-codes/E0107.stderr b/tests/ui/error-codes/E0107.stderr index 3f540eb08bc7c..c6317270f9b12 100644 --- a/tests/ui/error-codes/E0107.stderr +++ b/tests/ui/error-codes/E0107.stderr @@ -20,113 +20,137 @@ error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was suppli --> $DIR/E0107.rs:17:10 | LL | bar: Bar<'a>, - | ^^^---- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^^ expected 0 lifetime arguments | note: enum defined here, with 0 lifetime parameters --> $DIR/E0107.rs:6:6 | LL | enum Bar { | ^^^ +help: remove these generics + | +LL - bar: Bar<'a>, +LL + bar: Bar, + | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:21:11 | LL | foo2: Foo<'a, 'b, 'c>, - | ^^^ ------ help: remove these lifetime arguments - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:1:8 | LL | struct Foo<'a>(&'a str); | ^^^ -- +help: remove these lifetime arguments + | +LL - foo2: Foo<'a, 'b, 'c>, +LL + foo2: Foo<'a, >, + | error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/E0107.rs:25:11 | LL | qux1: Qux<'a, 'b, i32>, - | ^^^ -- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- +help: remove this lifetime argument + | +LL - qux1: Qux<'a, 'b, i32>, +LL + qux1: Qux<'a, , i32>, + | error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/E0107.rs:29:11 | LL | qux2: Qux<'a, i32, 'b>, - | ^^^ -- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- +help: remove this lifetime argument + | +LL - qux2: Qux<'a, i32, 'b>, +LL + qux2: Qux<'a, i32, >, + | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:33:11 | LL | qux3: Qux<'a, 'b, 'c, i32>, - | ^^^ ------ help: remove these lifetime arguments - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- +help: remove these lifetime arguments + | +LL - qux3: Qux<'a, 'b, 'c, i32>, +LL + qux3: Qux<'a, , i32>, + | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:37:11 | LL | qux4: Qux<'a, i32, 'b, 'c>, - | ^^^ ------ help: remove these lifetime arguments - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- +help: remove these lifetime arguments + | +LL - qux4: Qux<'a, i32, 'b, 'c>, +LL + qux4: Qux<'a, i32, >, + | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:41:11 | LL | qux5: Qux<'a, 'b, i32, 'c>, - | ^^^ -- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- +help: remove this lifetime argument + | +LL - qux5: Qux<'a, 'b, i32, 'c>, +LL + qux5: Qux<'a, , i32, 'c>, + | error[E0107]: struct takes 0 lifetime arguments but 2 lifetime arguments were supplied --> $DIR/E0107.rs:45:11 | LL | quux: Quux<'a, i32, 'b>, - | ^^^^ -- help: remove this lifetime argument - | | - | expected 0 lifetime arguments + | ^^^^ expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/E0107.rs:4:8 | LL | struct Quux(T); | ^^^^ +help: remove this lifetime argument + | +LL - quux: Quux<'a, i32, 'b>, +LL + quux: Quux<, i32, 'b>, + | error[E0107]: trait takes 0 generic arguments but 2 generic arguments were supplied --> $DIR/E0107.rs:55:27 diff --git a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr index fcd3e7d9aace8..18f37207ee557 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr +++ b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr @@ -43,15 +43,18 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box>) {} - | ^---- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 | LL | type Y<'a>; | ^ +help: remove these generics + | +LL - fn foo<'a>(arg: Box>) {} +LL + fn foo<'a>(arg: Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 @@ -74,9 +77,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box>) {} - | ^---- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 @@ -84,6 +85,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn foo<'a>(arg: Box>) {} +LL + fn foo<'a>(arg: Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 @@ -106,9 +112,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box>) {} - | ^---- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 @@ -116,6 +120,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn foo<'a>(arg: Box>) {} +LL + fn foo<'a>(arg: Box>) {} + | error[E0224]: at least one trait is required for an object type --> $DIR/gat-trait-path-parenthesised-args.rs:5:29 diff --git a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr index 4523044b5886b..9eb0b8ca641cb 100644 --- a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr +++ b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr @@ -2,15 +2,18 @@ error[E0107]: associated type takes 1 lifetime argument but 2 lifetime arguments --> $DIR/parameter_number_and_kind.rs:11:24 | LL | type FErr1 = Self::E<'static, 'static>; - | ^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` --> $DIR/parameter_number_and_kind.rs:8:10 | LL | type E<'a, T>; | ^ -- +help: remove this lifetime argument + | +LL - type FErr1 = Self::E<'static, 'static>; +LL + type FErr1 = Self::E<'static, >; + | error[E0107]: associated type takes 1 generic argument but 0 generic arguments were supplied --> $DIR/parameter_number_and_kind.rs:11:24 @@ -32,15 +35,18 @@ error[E0107]: associated type takes 1 generic argument but 2 generic arguments w --> $DIR/parameter_number_and_kind.rs:14:27 | LL | type FErr2 = Self::E<'static, T, u32>; - | ^ --- help: remove this generic argument - | | - | expected 1 generic argument + | ^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` --> $DIR/parameter_number_and_kind.rs:8:10 | LL | type E<'a, T>; | ^ - +help: remove this generic argument + | +LL - type FErr2 = Self::E<'static, T, u32>; +LL + type FErr2 = Self::E<'static, T, >; + | error: aborting due to 3 previous errors diff --git a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr index 2090f75aed328..f73022922a5b3 100644 --- a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr +++ b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr @@ -18,15 +18,18 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/trait-path-type-error-once-implemented.rs:2:10 | LL | type Y<'a>; | ^ +help: remove these generics + | +LL - fn f2<'a>(arg : Box = &'a ()>>) {} +LL + fn f2<'a>(arg : Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/trait-path-type-error-once-implemented.rs:6:29 @@ -49,9 +52,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/trait-path-type-error-once-implemented.rs:2:10 @@ -59,6 +60,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn f2<'a>(arg : Box = &'a ()>>) {} +LL + fn f2<'a>(arg : Box>) {} + | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/trait-path-type-error-once-implemented.rs:6:29 @@ -81,9 +87,7 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/trait-path-type-error-once-implemented.rs:2:10 @@ -91,6 +95,11 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - fn f2<'a>(arg : Box = &'a ()>>) {} +LL + fn f2<'a>(arg : Box>) {} + | error[E0038]: the trait `X` cannot be made into an object --> $DIR/trait-path-type-error-once-implemented.rs:6:23 diff --git a/tests/ui/generics/bad-mid-path-type-params.stderr b/tests/ui/generics/bad-mid-path-type-params.stderr index 71e15dd4c9264..7f4ba781e6ab3 100644 --- a/tests/ui/generics/bad-mid-path-type-params.stderr +++ b/tests/ui/generics/bad-mid-path-type-params.stderr @@ -2,71 +2,86 @@ error[E0107]: associated function takes 1 generic argument but 2 generic argumen --> $DIR/bad-mid-path-type-params.rs:30:16 | LL | let _ = S::new::(1, 1.0); - | ^^^ --- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^ expected 1 generic argument | note: associated function defined here, with 1 generic parameter: `U` --> $DIR/bad-mid-path-type-params.rs:6:8 | LL | fn new(x: T, _: U) -> S { | ^^^ - +help: remove this generic argument + | +LL - let _ = S::new::(1, 1.0); +LL + let _ = S::new::(1, 1.0); + | error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/bad-mid-path-type-params.rs:33:13 | LL | let _ = S::<'a,isize>::new::(1, 1.0); - | ^ -- help: remove this lifetime argument - | | - | expected 0 lifetime arguments + | ^ expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/bad-mid-path-type-params.rs:1:8 | LL | struct S { | ^ +help: remove this lifetime argument + | +LL - let _ = S::<'a,isize>::new::(1, 1.0); +LL + let _ = S::<,isize>::new::(1, 1.0); + | error[E0107]: associated function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/bad-mid-path-type-params.rs:36:24 | LL | let _: S2 = Trait::new::(1, 1.0); - | ^^^ --- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^ expected 1 generic argument | note: associated function defined here, with 1 generic parameter: `U` --> $DIR/bad-mid-path-type-params.rs:14:8 | LL | fn new(x: T, y: U) -> Self; | ^^^ - +help: remove this generic argument + | +LL - let _: S2 = Trait::new::(1, 1.0); +LL + let _: S2 = Trait::new::(1, 1.0); + | error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/bad-mid-path-type-params.rs:39:17 | LL | let _: S2 = Trait::<'a,isize>::new::(1, 1.0); - | ^^^^^ -- help: remove this lifetime argument - | | - | expected 0 lifetime arguments + | ^^^^^ expected 0 lifetime arguments | note: trait defined here, with 0 lifetime parameters --> $DIR/bad-mid-path-type-params.rs:13:7 | LL | trait Trait { | ^^^^^ +help: remove this lifetime argument + | +LL - let _: S2 = Trait::<'a,isize>::new::(1, 1.0); +LL + let _: S2 = Trait::<,isize>::new::(1, 1.0); + | error[E0107]: associated function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/bad-mid-path-type-params.rs:39:36 | LL | let _: S2 = Trait::<'a,isize>::new::(1, 1.0); - | ^^^ --- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^ expected 1 generic argument | note: associated function defined here, with 1 generic parameter: `U` --> $DIR/bad-mid-path-type-params.rs:14:8 | LL | fn new(x: T, y: U) -> Self; | ^^^ - +help: remove this generic argument + | +LL - let _: S2 = Trait::<'a,isize>::new::(1, 1.0); +LL + let _: S2 = Trait::<'a,isize>::new::(1, 1.0); + | error: aborting due to 5 previous errors diff --git a/tests/ui/generics/foreign-generic-mismatch.stderr b/tests/ui/generics/foreign-generic-mismatch.stderr index 5322b3f919d2d..7e8e854d64248 100644 --- a/tests/ui/generics/foreign-generic-mismatch.stderr +++ b/tests/ui/generics/foreign-generic-mismatch.stderr @@ -20,15 +20,18 @@ error[E0107]: function takes 1 lifetime argument but 2 lifetime arguments were s --> $DIR/foreign-generic-mismatch.rs:8:31 | LL | foreign_generic_mismatch::lt_arg::<'static, 'static>(); - | ^^^^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^^ expected 1 lifetime argument | note: function defined here, with 1 lifetime parameter: `'a` --> $DIR/auxiliary/foreign-generic-mismatch.rs:3:8 | LL | pub fn lt_arg<'a: 'a>() {} | ^^^^^^ -- +help: remove this lifetime argument + | +LL - foreign_generic_mismatch::lt_arg::<'static, 'static>(); +LL + foreign_generic_mismatch::lt_arg::<'static, >(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/generics/generic-arg-mismatch-recover.stderr b/tests/ui/generics/generic-arg-mismatch-recover.stderr index f549a7180fc66..cb25fa7af40aa 100644 --- a/tests/ui/generics/generic-arg-mismatch-recover.stderr +++ b/tests/ui/generics/generic-arg-mismatch-recover.stderr @@ -2,43 +2,52 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/generic-arg-mismatch-recover.rs:6:5 | LL | Foo::<'static, 'static, ()>(&0); - | ^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/generic-arg-mismatch-recover.rs:1:8 | LL | struct Foo<'a, T: 'a>(&'a T); | ^^^ -- +help: remove this lifetime argument + | +LL - Foo::<'static, 'static, ()>(&0); +LL + Foo::<'static, , ()>(&0); + | error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/generic-arg-mismatch-recover.rs:9:5 | LL | Bar::<'static, 'static, ()>(&()); - | ^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/generic-arg-mismatch-recover.rs:3:8 | LL | struct Bar<'a>(&'a ()); | ^^^ -- +help: remove this lifetime argument + | +LL - Bar::<'static, 'static, ()>(&()); +LL + Bar::<'static, , ()>(&()); + | error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/generic-arg-mismatch-recover.rs:9:5 | LL | Bar::<'static, 'static, ()>(&()); - | ^^^ -- help: remove this generic argument - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/generic-arg-mismatch-recover.rs:3:8 | LL | struct Bar<'a>(&'a ()); | ^^^ +help: remove this generic argument + | +LL - Bar::<'static, 'static, ()>(&()); +LL + Bar::<'static, 'static, >(&()); + | error: aborting due to 3 previous errors diff --git a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr index c5812abfd3dfa..edbe7a5e139cb 100644 --- a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr +++ b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr @@ -2,15 +2,18 @@ error[E0107]: struct takes at most 2 generic arguments but 3 generic arguments w --> $DIR/generic-impl-more-params-with-defaults.rs:13:5 | LL | Vec::::new(); - | ^^^ ---- help: remove this generic argument - | | - | expected at most 2 generic arguments + | ^^^ expected at most 2 generic arguments | note: struct defined here, with at most 2 generic parameters: `T`, `A` --> $DIR/generic-impl-more-params-with-defaults.rs:5:8 | LL | struct Vec( | ^^^ - -------- +help: remove this generic argument + | +LL - Vec::::new(); +LL + Vec::::new(); + | error: aborting due to 1 previous error diff --git a/tests/ui/generics/generic-type-more-params-with-defaults.stderr b/tests/ui/generics/generic-type-more-params-with-defaults.stderr index c44f6b7ddc02d..27752af1ad6cb 100644 --- a/tests/ui/generics/generic-type-more-params-with-defaults.stderr +++ b/tests/ui/generics/generic-type-more-params-with-defaults.stderr @@ -2,15 +2,18 @@ error[E0107]: struct takes at most 2 generic arguments but 3 generic arguments w --> $DIR/generic-type-more-params-with-defaults.rs:9:12 | LL | let _: Vec; - | ^^^ ---- help: remove this generic argument - | | - | expected at most 2 generic arguments + | ^^^ expected at most 2 generic arguments | note: struct defined here, with at most 2 generic parameters: `T`, `A` --> $DIR/generic-type-more-params-with-defaults.rs:5:8 | LL | struct Vec( | ^^^ - -------- +help: remove this generic argument + | +LL - let _: Vec; +LL + let _: Vec; + | error: aborting due to 1 previous error diff --git a/tests/ui/generics/wrong-number-of-args.stderr b/tests/ui/generics/wrong-number-of-args.stderr index e04408a0fdf36..9df759bf29b11 100644 --- a/tests/ui/generics/wrong-number-of-args.stderr +++ b/tests/ui/generics/wrong-number-of-args.stderr @@ -171,71 +171,86 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/wrong-number-of-args.rs:6:14 | LL | type B = Ty<'static>; - | ^^--------- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^ expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ +help: remove these generics + | +LL - type B = Ty<'static>; +LL + type B = Ty; + | error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:10:14 | LL | type C = Ty<'static, usize>; - | ^^ ------- help: remove this lifetime argument - | | - | expected 0 lifetime arguments + | ^^ expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ +help: remove this lifetime argument + | +LL - type C = Ty<'static, usize>; +LL + type C = Ty<, usize>; + | error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:10:14 | LL | type C = Ty<'static, usize>; - | ^^ ----- help: remove this generic argument - | | - | expected 0 generic arguments + | ^^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ +help: remove this generic argument + | +LL - type C = Ty<'static, usize>; +LL + type C = Ty<'static, >; + | error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:16:14 | LL | type D = Ty<'static, usize, { 0 }>; - | ^^ ------- help: remove this lifetime argument - | | - | expected 0 lifetime arguments + | ^^ expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ +help: remove this lifetime argument + | +LL - type D = Ty<'static, usize, { 0 }>; +LL + type D = Ty<, usize, { 0 }>; + | error[E0107]: struct takes 0 generic arguments but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:16:14 | LL | type D = Ty<'static, usize, { 0 }>; - | ^^ ------------ help: remove these generic arguments - | | - | expected 0 generic arguments + | ^^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ +help: remove these generic arguments + | +LL - type D = Ty<'static, usize, { 0 }>; +LL + type D = Ty<'static, >; + | error[E0107]: missing generics for struct `type_and_type::Ty` --> $DIR/wrong-number-of-args.rs:26:14 @@ -275,15 +290,18 @@ error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supp --> $DIR/wrong-number-of-args.rs:36:14 | LL | type D = Ty; - | ^^ ---- help: remove this generic argument - | | - | expected 2 generic arguments + | ^^ expected 2 generic arguments | note: struct defined here, with 2 generic parameters: `A`, `B` --> $DIR/wrong-number-of-args.rs:24:12 | LL | struct Ty(A, B); | ^^ - - +help: remove this generic argument + | +LL - type D = Ty; +LL + type D = Ty; + | error[E0107]: struct takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:40:14 @@ -353,29 +371,35 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/wrong-number-of-args.rs:70:14 | LL | type F = Ty<'static, usize, 'static, usize>; - | ^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:46:12 | LL | struct Ty<'a, T>(&'a T); | ^^ -- +help: remove this lifetime argument + | +LL - type F = Ty<'static, usize, 'static, usize>; +LL + type F = Ty<'static, usize, , usize>; + | error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:70:14 | LL | type F = Ty<'static, usize, 'static, usize>; - | ^^ ----- help: remove this generic argument - | | - | expected 1 generic argument + | ^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` --> $DIR/wrong-number-of-args.rs:46:12 | LL | struct Ty<'a, T>(&'a T); | ^^ - +help: remove this generic argument + | +LL - type F = Ty<'static, usize, 'static, usize>; +LL + type F = Ty<'static, usize, 'static, >; + | error[E0107]: missing generics for struct `type_and_type_and_type::Ty` --> $DIR/wrong-number-of-args.rs:80:14 @@ -415,15 +439,18 @@ error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments w --> $DIR/wrong-number-of-args.rs:92:14 | LL | type E = Ty; - | ^^ --- help: remove this generic argument - | | - | expected at most 3 generic arguments + | ^^ expected at most 3 generic arguments | note: struct defined here, with at most 3 generic parameters: `A`, `B`, `C` --> $DIR/wrong-number-of-args.rs:78:12 | LL | struct Ty(A, B, C); | ^^ - - ---------------- +help: remove this generic argument + | +LL - type E = Ty; +LL + type E = Ty; + | error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:96:14 @@ -445,29 +472,35 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/wrong-number-of-args.rs:116:22 | LL | type A = Box>; - | ^^^^^^^^^^------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:104:11 | LL | trait NonGeneric { | ^^^^^^^^^^ +help: remove these generics + | +LL - type A = Box>; +LL + type A = Box; + | error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:125:22 | LL | type C = Box>; - | ^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^^^^^^^^^^^ expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:108:11 | LL | trait GenericLifetime<'a> { | ^^^^^^^^^^^^^^^ -- +help: remove this lifetime argument + | +LL - type C = Box>; +LL + type C = Box>; + | error[E0107]: missing generics for trait `GenericType` --> $DIR/wrong-number-of-args.rs:129:22 @@ -489,15 +522,18 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:133:22 | LL | type E = Box>; - | ^^^^^^^^^^^ ----- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^^^^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:112:11 | LL | trait GenericType { | ^^^^^^^^^^^ - +help: remove this generic argument + | +LL - type E = Box>; +LL + type E = Box>; + | error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:142:22 @@ -519,43 +555,52 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/wrong-number-of-args.rs:153:26 | LL | type A = Box>; - | ^^^^^^^^^^^^------------------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:149:15 | LL | trait NonGenericAT { | ^^^^^^^^^^^^ +help: remove these generics + | +LL - type A = Box>; +LL + type A = Box; + | error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:168:26 | LL | type B = Box>; - | ^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^^^^^^^^^^^^^ expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:159:15 | LL | trait GenericLifetimeAT<'a> { | ^^^^^^^^^^^^^^^^^ -- +help: remove this lifetime argument + | +LL - type B = Box>; +LL + type B = Box>; + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:172:26 | LL | type C = Box>; - | ^^^^^^^^^^^^^^^^^ -- help: remove this generic argument - | | - | expected 0 generic arguments + | ^^^^^^^^^^^^^^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:159:15 | LL | trait GenericLifetimeAT<'a> { | ^^^^^^^^^^^^^^^^^ +help: remove this generic argument + | +LL - type C = Box>; +LL + type C = Box>; + | error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:185:26 @@ -577,29 +622,35 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:189:26 | LL | type B = Box>; - | ^^^^^^^^^^^^^ -- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^^^^^^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:181:15 | LL | trait GenericTypeAT { | ^^^^^^^^^^^^^ - +help: remove this generic argument + | +LL - type B = Box>; +LL + type B = Box>; + | error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:193:26 | LL | type C = Box>; - | ^^^^^^^^^^^^^--------------------- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^^^^^^^^^^^^ expected 0 lifetime arguments | note: trait defined here, with 0 lifetime parameters --> $DIR/wrong-number-of-args.rs:181:15 | LL | trait GenericTypeAT { | ^^^^^^^^^^^^^ +help: remove these generics + | +LL - type C = Box>; +LL + type C = Box; + | error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:193:26 @@ -653,15 +704,18 @@ error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supp --> $DIR/wrong-number-of-args.rs:216:26 | LL | type C = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^^^^^^^^^^^^^^^^^ expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- +help: remove this lifetime argument + | +LL - type C = Box>; +LL + type C = Box>; + | error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:216:26 @@ -683,71 +737,86 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:227:26 | LL | type E = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - +help: remove this generic argument + | +LL - type E = Box>; +LL + type E = Box>; + | error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:234:26 | LL | type F = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^^^^^^^^^^^^^^^^^ expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- +help: remove this lifetime argument + | +LL - type F = Box>; +LL + type F = Box>; + | error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:238:26 | LL | type G = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - +help: remove this generic argument + | +LL - type G = Box>; +LL + type G = Box>; + | error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:242:26 | LL | type H = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^^^^^^^^^^^^^^^^^ expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- +help: remove this lifetime argument + | +LL - type H = Box>; +LL + type H = Box>; + | error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:242:26 | LL | type H = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ -- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - +help: remove this generic argument + | +LL - type H = Box>; +LL + type H = Box>; + | error[E0107]: trait takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:254:26 @@ -787,15 +856,18 @@ error[E0107]: trait takes 2 generic arguments but 3 generic arguments were suppl --> $DIR/wrong-number-of-args.rs:262:26 | LL | type C = Box>; - | ^^^^^^^^^^^^^^^^^ -- help: remove this generic argument - | | - | expected 2 generic arguments + | ^^^^^^^^^^^^^^^^^ expected 2 generic arguments | note: trait defined here, with 2 generic parameters: `A`, `B` --> $DIR/wrong-number-of-args.rs:250:15 | LL | trait GenericTypeTypeAT { | ^^^^^^^^^^^^^^^^^ - - +help: remove this generic argument + | +LL - type C = Box>; +LL + type C = Box>; + | error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:277:26 @@ -911,9 +983,13 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/wrong-number-of-args.rs:318:18 | LL | type C = HashMap<'static>; - | ^^^^^^^--------- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^^^^^^ expected 0 lifetime arguments + | +help: remove these generics + | +LL - type C = HashMap<'static>; +LL + type C = HashMap; + | error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:318:18 @@ -930,9 +1006,13 @@ error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments w --> $DIR/wrong-number-of-args.rs:324:18 | LL | type D = HashMap; - | ^^^^^^^ --- help: remove this generic argument - | | - | expected at most 3 generic arguments + | ^^^^^^^ expected at most 3 generic arguments + | +help: remove this generic argument + | +LL - type D = HashMap; +LL + type D = HashMap; + | error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:328:18 @@ -973,9 +1053,13 @@ error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was suppli --> $DIR/wrong-number-of-args.rs:342:18 | LL | type C = Result<'static>; - | ^^^^^^--------- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^^^^^ expected 0 lifetime arguments + | +help: remove these generics + | +LL - type C = Result<'static>; +LL + type C = Result; + | error[E0107]: enum takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:342:18 @@ -992,9 +1076,13 @@ error[E0107]: enum takes 2 generic arguments but 3 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:348:18 | LL | type D = Result; - | ^^^^^^ ---- help: remove this generic argument - | | - | expected 2 generic arguments + | ^^^^^^ expected 2 generic arguments + | +help: remove this generic argument + | +LL - type D = Result; +LL + type D = Result; + | error[E0107]: enum takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:352:18 diff --git a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr index e8cd16bc30168..d184110c45345 100644 --- a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr +++ b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr @@ -2,9 +2,7 @@ error[E0107]: function takes 1 generic argument but 2 generic arguments were sup --> $DIR/explicit-generic-args-for-impl.rs:4:5 | LL | foo::("".to_string()); - | ^^^ ------ help: remove this generic argument - | | - | expected 1 generic argument + | ^^^ expected 1 generic argument | note: function defined here, with 1 generic parameter: `T` --> $DIR/explicit-generic-args-for-impl.rs:1:4 @@ -12,6 +10,11 @@ note: function defined here, with 1 generic parameter: `T` LL | fn foo(_f: impl AsRef) {} | ^^^ - = note: `impl Trait` cannot be explicitly specified as a generic argument +help: remove this generic argument + | +LL - foo::("".to_string()); +LL + foo::("".to_string()); + | error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr index 1f8a0d5edd781..aba82084f2258 100644 --- a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr +++ b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr @@ -38,29 +38,35 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/opaque-and-lifetime-mismatch.rs:4:17 | LL | fn bar() -> Wrapper; - | ^^^^^^^ ---------- help: remove this generic argument - | | - | expected 0 generic arguments + | ^^^^^^^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/opaque-and-lifetime-mismatch.rs:1:8 | LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ +help: remove this generic argument + | +LL - fn bar() -> Wrapper; +LL + fn bar() -> Wrapper<>; + | error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/opaque-and-lifetime-mismatch.rs:18:17 | LL | fn foo() -> Wrapper; - | ^^^^^^^ ---------- help: remove this generic argument - | | - | expected 0 generic arguments + | ^^^^^^^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/opaque-and-lifetime-mismatch.rs:1:8 | LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ +help: remove this generic argument + | +LL - fn foo() -> Wrapper; +LL + fn foo() -> Wrapper<>; + | error[E0053]: method `bar` has an incompatible return type for trait --> $DIR/opaque-and-lifetime-mismatch.rs:10:17 @@ -93,15 +99,18 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/opaque-and-lifetime-mismatch.rs:24:17 | LL | fn foo() -> Wrapper { - | ^^^^^^^ ---------- help: remove this generic argument - | | - | expected 0 generic arguments + | ^^^^^^^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/opaque-and-lifetime-mismatch.rs:1:8 | LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ +help: remove this generic argument + | +LL - fn foo() -> Wrapper { +LL + fn foo() -> Wrapper<> { + | error: aborting due to 8 previous errors diff --git a/tests/ui/issues/issue-18423.stderr b/tests/ui/issues/issue-18423.stderr index 2c6015eaa9d4b..a73688205ac80 100644 --- a/tests/ui/issues/issue-18423.stderr +++ b/tests/ui/issues/issue-18423.stderr @@ -2,9 +2,13 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/issue-18423.rs:4:8 | LL | x: Box<'a, isize> - | ^^^ -- help: remove this lifetime argument - | | - | expected 0 lifetime arguments + | ^^^ expected 0 lifetime arguments + | +help: remove this lifetime argument + | +LL - x: Box<'a, isize> +LL + x: Box<, isize> + | error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-53251.stderr b/tests/ui/issues/issue-53251.stderr index 05ea631158964..db9df7d911c41 100644 --- a/tests/ui/issues/issue-53251.stderr +++ b/tests/ui/issues/issue-53251.stderr @@ -2,9 +2,7 @@ error[E0107]: associated function takes 0 generic arguments but 1 generic argume --> $DIR/issue-53251.rs:11:20 | LL | S::f::(); - | ^------- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments ... LL | impl_add!(a b); | -------------- in this macro invocation @@ -15,14 +13,17 @@ note: associated function defined here, with 0 generic parameters LL | fn f() {} | ^ = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove these generics + | +LL - S::f::(); +LL + S::f(); + | error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-53251.rs:11:20 | LL | S::f::(); - | ^------- help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments ... LL | impl_add!(a b); | -------------- in this macro invocation @@ -34,6 +35,11 @@ LL | fn f() {} | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove these generics + | +LL - S::f::(); +LL + S::f(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-60622.stderr b/tests/ui/issues/issue-60622.stderr index 43da2773940e5..e694a92213c85 100644 --- a/tests/ui/issues/issue-60622.stderr +++ b/tests/ui/issues/issue-60622.stderr @@ -20,15 +20,18 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-60622.rs:10:7 | LL | b.a::<'_, T>(); - | ^ - help: remove this generic argument - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/issue-60622.rs:6:8 | LL | fn a(&self) {} | ^ +help: remove this generic argument + | +LL - b.a::<'_, T>(); +LL + b.a::<'_, >(); + | error: aborting due to 2 previous errors diff --git a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr index 1b8f1c3fd6fae..de0a0631bf884 100644 --- a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr +++ b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr @@ -2,15 +2,18 @@ error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were --> $DIR/mismatched_arg_count.rs:9:29 | LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} - | ^^^^^ -- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^^^^^ expected 1 lifetime argument | note: type alias defined here, with 1 lifetime parameter: `'a` --> $DIR/mismatched_arg_count.rs:7:6 | LL | type Alias<'a, T> = >::Assoc; | ^^^^^ -- +help: remove this lifetime argument + | +LL - fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} +LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, , T>) {} + | error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/noisy-follow-up-erro.stderr b/tests/ui/lifetimes/noisy-follow-up-erro.stderr index f549009a87c12..38465c7ac963a 100644 --- a/tests/ui/lifetimes/noisy-follow-up-erro.stderr +++ b/tests/ui/lifetimes/noisy-follow-up-erro.stderr @@ -2,15 +2,18 @@ error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/noisy-follow-up-erro.rs:12:30 | LL | fn boom(&self, foo: &mut Foo<'_, '_, 'a>) -> Result<(), &'a ()> { - | ^^^ -- help: remove this lifetime argument - | | - | expected 2 lifetime arguments + | ^^^ expected 2 lifetime arguments | note: struct defined here, with 2 lifetime parameters: `'c`, `'d` --> $DIR/noisy-follow-up-erro.rs:1:8 | LL | struct Foo<'c, 'd>(&'c (), &'d ()); | ^^^ -- -- +help: remove this lifetime argument + | +LL - fn boom(&self, foo: &mut Foo<'_, '_, 'a>) -> Result<(), &'a ()> { +LL + fn boom(&self, foo: &mut Foo<'_, '_, >) -> Result<(), &'a ()> { + | error[E0621]: explicit lifetime required in the type of `foo` --> $DIR/noisy-follow-up-erro.rs:14:9 diff --git a/tests/ui/methods/method-call-lifetime-args-fail.stderr b/tests/ui/methods/method-call-lifetime-args-fail.stderr index 645d8b8d14ad2..d431e0721ccb9 100644 --- a/tests/ui/methods/method-call-lifetime-args-fail.stderr +++ b/tests/ui/methods/method-call-lifetime-args-fail.stderr @@ -20,15 +20,18 @@ error[E0107]: method takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/method-call-lifetime-args-fail.rs:18:7 | LL | S.early::<'static, 'static, 'static>(); - | ^^^^^ ------- help: remove this lifetime argument - | | - | expected 2 lifetime arguments + | ^^^^^ expected 2 lifetime arguments | note: method defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/method-call-lifetime-args-fail.rs:6:8 | LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } | ^^^^^ -- -- +help: remove this lifetime argument + | +LL - S.early::<'static, 'static, 'static>(); +LL + S.early::<'static, 'static, >(); + | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:27:15 @@ -220,15 +223,18 @@ error[E0107]: method takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/method-call-lifetime-args-fail.rs:65:8 | LL | S::early::<'static, 'static, 'static>(S); - | ^^^^^ ------- help: remove this lifetime argument - | | - | expected 2 lifetime arguments + | ^^^^^ expected 2 lifetime arguments | note: method defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/method-call-lifetime-args-fail.rs:6:8 | LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } | ^^^^^ -- -- +help: remove this lifetime argument + | +LL - S::early::<'static, 'static, 'static>(S); +LL + S::early::<'static, 'static, >(S); + | error: aborting due to 18 previous errors diff --git a/tests/ui/resolve/issue-3214.stderr b/tests/ui/resolve/issue-3214.stderr index 5b57c1baf90ba..614d3b21ff2cc 100644 --- a/tests/ui/resolve/issue-3214.stderr +++ b/tests/ui/resolve/issue-3214.stderr @@ -12,15 +12,18 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-3214.rs:6:22 | LL | impl Drop for Foo { - | ^^^--- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/issue-3214.rs:2:12 | LL | struct Foo { | ^^^ +help: remove these generics + | +LL - impl Drop for Foo { +LL + impl Drop for Foo { + | error: aborting due to 2 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr index fa2e3da368bd8..3d9df78b196e3 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr @@ -2,15 +2,18 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params-cross-crate.rs:14:5 | LL | foo::(); - | ^^^--------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/auxiliary/cross-crate.rs:5:14 | LL | pub const fn foo() {} | ^^^ +help: remove these generics + | +LL - foo::(); +LL + foo(); + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/no-explicit-const-params-cross-crate.rs:16:12 @@ -32,15 +35,18 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params-cross-crate.rs:7:5 | LL | foo::(); - | ^^^-------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/auxiliary/cross-crate.rs:5:14 | LL | pub const fn foo() {} | ^^^ +help: remove these generics + | +LL - foo::(); +LL + foo(); + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/no-explicit-const-params-cross-crate.rs:9:12 diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr index fbb96dfd85e1b..8412a3d0a8a0c 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr @@ -16,15 +16,18 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params.rs:22:5 | LL | foo::(); - | ^^^--------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/no-explicit-const-params.rs:3:10 | LL | const fn foo() {} | ^^^ +help: remove these generics + | +LL - foo::(); +LL + foo(); + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/no-explicit-const-params.rs:24:12 @@ -55,15 +58,18 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params.rs:15:5 | LL | foo::(); - | ^^^-------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/no-explicit-const-params.rs:3:10 | LL | const fn foo() {} | ^^^ +help: remove these generics + | +LL - foo::(); +LL + foo(); + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/no-explicit-const-params.rs:17:12 diff --git a/tests/ui/seq-args.stderr b/tests/ui/seq-args.stderr index a5b0f8e98dca0..bb46a11d90262 100644 --- a/tests/ui/seq-args.stderr +++ b/tests/ui/seq-args.stderr @@ -2,29 +2,35 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/seq-args.rs:4:13 | LL | impl Seq for Vec { - | ^^^--- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/seq-args.rs:2:11 | LL | trait Seq { } | ^^^ +help: remove these generics + | +LL - impl Seq for Vec { +LL + impl Seq for Vec { + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/seq-args.rs:9:10 | LL | impl Seq for u32 { - | ^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/seq-args.rs:2:11 | LL | trait Seq { } | ^^^ +help: remove these generics + | +LL - impl Seq for u32 { +LL + impl Seq for u32 { + | error: aborting due to 2 previous errors diff --git a/tests/ui/structs/struct-path-associated-type.stderr b/tests/ui/structs/struct-path-associated-type.stderr index 0c9d2aad5d827..edcb0bcc8332a 100644 --- a/tests/ui/structs/struct-path-associated-type.stderr +++ b/tests/ui/structs/struct-path-associated-type.stderr @@ -8,15 +8,18 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/struct-path-associated-type.rs:14:16 | LL | let z = T::A:: {}; - | ^------ help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/struct-path-associated-type.rs:4:10 | LL | type A; | ^ +help: remove these generics + | +LL - let z = T::A:: {}; +LL + let z = T::A {}; + | error[E0071]: expected struct, variant or union type, found associated type --> $DIR/struct-path-associated-type.rs:14:13 @@ -34,15 +37,18 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/struct-path-associated-type.rs:25:16 | LL | let z = T::A:: {}; - | ^------ help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/struct-path-associated-type.rs:4:10 | LL | type A; | ^ +help: remove these generics + | +LL - let z = T::A:: {}; +LL + let z = T::A {}; + | error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:32:13 diff --git a/tests/ui/structs/structure-constructor-type-mismatch.stderr b/tests/ui/structs/structure-constructor-type-mismatch.stderr index cb9574873473f..50ebd86a2166e 100644 --- a/tests/ui/structs/structure-constructor-type-mismatch.stderr +++ b/tests/ui/structs/structure-constructor-type-mismatch.stderr @@ -68,15 +68,18 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/structure-constructor-type-mismatch.rs:48:15 | LL | let pt3 = PointF:: { - | ^^^^^^------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/structure-constructor-type-mismatch.rs:6:6 | LL | type PointF = Point; | ^^^^^^ +help: remove these generics + | +LL - let pt3 = PointF:: { +LL + let pt3 = PointF { + | error[E0308]: mismatched types --> $DIR/structure-constructor-type-mismatch.rs:49:12 @@ -104,15 +107,18 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/structure-constructor-type-mismatch.rs:54:9 | LL | PointF:: { .. } => {} - | ^^^^^^------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/structure-constructor-type-mismatch.rs:6:6 | LL | type PointF = Point; | ^^^^^^ +help: remove these generics + | +LL - PointF:: { .. } => {} +LL + PointF { .. } => {} + | error[E0308]: mismatched types --> $DIR/structure-constructor-type-mismatch.rs:54:9 diff --git a/tests/ui/suggestions/issue-101421.stderr b/tests/ui/suggestions/issue-101421.stderr index ececba5fb1baa..1a64f5313cf53 100644 --- a/tests/ui/suggestions/issue-101421.stderr +++ b/tests/ui/suggestions/issue-101421.stderr @@ -2,15 +2,18 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-101421.rs:10:8 | LL | ().f::<()>(()); - | ^------ help: remove these generics - | | - | expected 0 generic arguments + | ^ expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/issue-101421.rs:2:8 | LL | fn f(&self, _: ()); | ^ +help: remove these generics + | +LL - ().f::<()>(()); +LL + ().f(()); + | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-104287.stderr b/tests/ui/suggestions/issue-104287.stderr index ed59b2e7a2d3b..b65d3ad4d318a 100644 --- a/tests/ui/suggestions/issue-104287.stderr +++ b/tests/ui/suggestions/issue-104287.stderr @@ -2,15 +2,18 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-104287.rs:10:5 | LL | foo::<()>(x); - | ^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/issue-104287.rs:6:8 | LL | fn foo(&self) {} | ^^^ +help: remove these generics + | +LL - foo::<()>(x); +LL + foo(x); + | error[E0425]: cannot find function `foo` in this scope --> $DIR/issue-104287.rs:10:5 diff --git a/tests/ui/suggestions/issue-89064.stderr b/tests/ui/suggestions/issue-89064.stderr index be09dd8951208..f1bb3c2adc74f 100644 --- a/tests/ui/suggestions/issue-89064.stderr +++ b/tests/ui/suggestions/issue-89064.stderr @@ -46,15 +46,18 @@ error[E0107]: associated function takes 0 generic arguments but 1 generic argume --> $DIR/issue-89064.rs:27:21 | LL | let _ = A::::foo::(); - | ^^^----- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: associated function defined here, with 0 generic parameters --> $DIR/issue-89064.rs:4:8 | LL | fn foo() {} | ^^^ +help: remove these generics + | +LL - let _ = A::::foo::(); +LL + let _ = A::::foo(); + | error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-89064.rs:31:16 diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr index 06e2fa5d4d1fd..9193faeb1aa9a 100644 --- a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr +++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr @@ -117,15 +117,18 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:40:58 | LL | impl, U> YetAnotherTrait for Struct {} - | ^^^^^^ - help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:26:8 | LL | struct Struct> { | ^^^^^^ - +help: remove this generic argument + | +LL - impl, U> YetAnotherTrait for Struct {} +LL + impl, U> YetAnotherTrait for Struct {} + | error: aborting due to 9 previous errors diff --git a/tests/ui/traits/object/vs-lifetime.stderr b/tests/ui/traits/object/vs-lifetime.stderr index a69cd140807ff..aab4845a27420 100644 --- a/tests/ui/traits/object/vs-lifetime.stderr +++ b/tests/ui/traits/object/vs-lifetime.stderr @@ -8,15 +8,18 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/vs-lifetime.rs:11:12 | LL | let _: S<'static, 'static>; - | ^ ------- help: remove this lifetime argument - | | - | expected 1 lifetime argument + | ^ expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/vs-lifetime.rs:4:8 | LL | struct S<'a, T>(&'a u8, T); | ^ -- +help: remove this lifetime argument + | +LL - let _: S<'static, 'static>; +LL + let _: S<'static, >; + | error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/vs-lifetime.rs:11:12 diff --git a/tests/ui/traits/test-2.stderr b/tests/ui/traits/test-2.stderr index 3972e539776c4..9916cf97fca95 100644 --- a/tests/ui/traits/test-2.stderr +++ b/tests/ui/traits/test-2.stderr @@ -2,29 +2,35 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/test-2.rs:9:8 | LL | 10.dup::(); - | ^^^------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^ expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/test-2.rs:4:16 | LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } | ^^^ +help: remove these generics + | +LL - 10.dup::(); +LL + 10.dup(); + | error[E0107]: method takes 1 generic argument but 2 generic arguments were supplied --> $DIR/test-2.rs:11:8 | LL | 10.blah::(); - | ^^^^ --- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^^ expected 1 generic argument | note: method defined here, with 1 generic parameter: `X` --> $DIR/test-2.rs:4:39 | LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } | ^^^^ - +help: remove this generic argument + | +LL - 10.blah::(); +LL + 10.blah::(); + | error[E0038]: the trait `bar` cannot be made into an object --> $DIR/test-2.rs:13:22 diff --git a/tests/ui/transmutability/issue-101739-2.stderr b/tests/ui/transmutability/issue-101739-2.stderr index 519a374dc2294..93323049760aa 100644 --- a/tests/ui/transmutability/issue-101739-2.stderr +++ b/tests/ui/transmutability/issue-101739-2.stderr @@ -1,13 +1,16 @@ error[E0107]: trait takes at most 2 generic arguments but 5 generic arguments were supplied --> $DIR/issue-101739-2.rs:17:14 | -LL | Dst: BikeshedIntrinsicFrom< - | ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments -... -LL | / ASSUME_LIFETIMES, -LL | | ASSUME_VALIDITY, -LL | | ASSUME_VISIBILITY, - | |_____________________________- help: remove these generic arguments +LL | Dst: BikeshedIntrinsicFrom< + | ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments + | +help: remove these generic arguments + | +LL - ASSUME_LIFETIMES, +LL - ASSUME_VALIDITY, +LL - ASSUME_VISIBILITY, +LL + , + | error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr index 96a5c13276331..a2dd6805f3d5c 100644 --- a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr +++ b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr @@ -308,29 +308,35 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:64:5 | LL | AliasFixed::<()>::TSVariant(()); - | ^^^^^^^^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ +help: remove these generics + | +LL - AliasFixed::<()>::TSVariant(()); +LL + AliasFixed::TSVariant(()); + | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:66:5 | LL | AliasFixed::<()>::TSVariant::<()>(()); - | ^^^^^^^^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ +help: remove these generics + | +LL - AliasFixed::<()>::TSVariant::<()>(()); +LL + AliasFixed::TSVariant::<()>(()); + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:66:35 @@ -399,29 +405,35 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:82:5 | LL | AliasFixed::<()>::SVariant { v: () }; - | ^^^^^^^^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ +help: remove these generics + | +LL - AliasFixed::<()>::SVariant { v: () }; +LL + AliasFixed::SVariant { v: () }; + | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:84:5 | LL | AliasFixed::<()>::SVariant::<()> { v: () }; - | ^^^^^^^^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ +help: remove these generics + | +LL - AliasFixed::<()>::SVariant::<()> { v: () }; +LL + AliasFixed::SVariant::<()> { v: () }; + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:84:34 @@ -474,29 +486,35 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:100:5 | LL | AliasFixed::<()>::UVariant; - | ^^^^^^^^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ +help: remove these generics + | +LL - AliasFixed::<()>::UVariant; +LL + AliasFixed::UVariant; + | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:102:5 | LL | AliasFixed::<()>::UVariant::<()>; - | ^^^^^^^^^^------ help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^^^ expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ +help: remove these generics + | +LL - AliasFixed::<()>::UVariant::<()>; +LL + AliasFixed::UVariant::<()>; + | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:102:34 diff --git a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr index 9a9b2a68dbed9..3be83682ec9aa 100644 --- a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr +++ b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr @@ -2,69 +2,99 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/typeck-builtin-bound-type-parameters.rs:1:11 | LL | fn foo1, U>(x: T) {} - | ^^^^--- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments + | +help: remove these generics + | +LL - fn foo1, U>(x: T) {} +LL + fn foo1(x: T) {} + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 | LL | trait Trait: Copy {} - | ^^^^---------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments + | +help: remove these generics + | +LL - trait Trait: Copy {} +LL + trait Trait: Copy {} + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 | LL | trait Trait: Copy {} - | ^^^^---------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - trait Trait: Copy {} +LL + trait Trait: Copy {} + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 | LL | trait Trait: Copy {} - | ^^^^---------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` +help: remove these generics + | +LL - trait Trait: Copy {} +LL + trait Trait: Copy {} + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:9:21 | LL | struct MyStruct1>(T); - | ^^^^--- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments + | +help: remove these generics + | +LL - struct MyStruct1>(T); +LL + struct MyStruct1(T); + | error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:12:25 | LL | struct MyStruct2<'a, T: Copy<'a>>(&'a T); - | ^^^^---- help: remove these generics - | | - | expected 0 lifetime arguments + | ^^^^ expected 0 lifetime arguments + | +help: remove these generics + | +LL - struct MyStruct2<'a, T: Copy<'a>>(&'a T); +LL + struct MyStruct2<'a, T: Copy>(&'a T); + | error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:15:15 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} - | ^^^^ -- help: remove this lifetime argument - | | - | expected 0 lifetime arguments + | ^^^^ expected 0 lifetime arguments + | +help: remove this lifetime argument + | +LL - fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} +LL + fn foo2<'a, T:Copy<, U>, U>(x: T) {} + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:15:15 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} - | ^^^^ - help: remove this generic argument - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments + | +help: remove this generic argument + | +LL - fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} +LL + fn foo2<'a, T:Copy<'a, >, U>(x: T) {} + | error: aborting due to 8 previous errors diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr index e4b1c02c20149..65f07bb08320d 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr @@ -2,15 +2,18 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/typeck_type_placeholder_lifetime_1.rs:9:12 | LL | let c: Foo<_, _> = Foo { r: &5 }; - | ^^^ - help: remove this generic argument - | | - | expected 1 generic argument + | ^^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` --> $DIR/typeck_type_placeholder_lifetime_1.rs:4:8 | LL | struct Foo<'a, T:'a> { | ^^^ - +help: remove this generic argument + | +LL - let c: Foo<_, _> = Foo { r: &5 }; +LL + let c: Foo<_, > = Foo { r: &5 }; + | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr index fcb5ecc4042b0..b07cc225ba875 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr @@ -2,15 +2,18 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/typeck_type_placeholder_lifetime_2.rs:9:12 | LL | let c: Foo<_, usize> = Foo { r: &5 }; - | ^^^ ----- help: remove this generic argument - | | - | expected 1 generic argument + | ^^^ expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` --> $DIR/typeck_type_placeholder_lifetime_2.rs:4:8 | LL | struct Foo<'a, T:'a> { | ^^^ - +help: remove this generic argument + | +LL - let c: Foo<_, usize> = Foo { r: &5 }; +LL + let c: Foo<_, > = Foo { r: &5 }; + | error: aborting due to 1 previous error diff --git a/tests/ui/ufcs/ufcs-qpath-missing-params.stderr b/tests/ui/ufcs/ufcs-qpath-missing-params.stderr index 2338871218b1c..0ae92d204b6fb 100644 --- a/tests/ui/ufcs/ufcs-qpath-missing-params.stderr +++ b/tests/ui/ufcs/ufcs-qpath-missing-params.stderr @@ -34,15 +34,18 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/ufcs-qpath-missing-params.rs:17:26 | LL | ::into_cow::("foo".to_string()); - | ^^^^^^^^------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^^^^^ expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/ufcs-qpath-missing-params.rs:4:8 | LL | fn into_cow(self) -> Cow<'a, B>; | ^^^^^^^^ +help: remove these generics + | +LL - ::into_cow::("foo".to_string()); +LL + ::into_cow("foo".to_string()); + | error: aborting due to 3 previous errors diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr index 5a2de132d70e7..ac56d1d05fae5 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr @@ -2,15 +2,18 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:17 | LL | fn foo1(_: &dyn Zero()) { - | ^^^^-- help: remove these parenthetical generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ +help: remove these parenthetical generics + | +LL - fn foo1(_: &dyn Zero()) { +LL + fn foo1(_: &dyn Zero) { + | error[E0220]: associated type `Output` not found for `Zero` --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:17 @@ -22,43 +25,52 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:10:17 | LL | fn foo2(_: &dyn Zero) { - | ^^^^------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ +help: remove these generics + | +LL - fn foo2(_: &dyn Zero) { +LL + fn foo2(_: &dyn Zero) { + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:14:17 | LL | fn foo3(_: &dyn Zero < usize >) { - | ^^^^-------------- help: remove these generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ +help: remove these generics + | +LL - fn foo3(_: &dyn Zero < usize >) { +LL + fn foo3(_: &dyn Zero) { + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:18:17 | LL | fn foo4(_: &dyn Zero(usize)) { - | ^^^^------- help: remove these parenthetical generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ +help: remove these parenthetical generics + | +LL - fn foo4(_: &dyn Zero(usize)) { +LL + fn foo4(_: &dyn Zero) { + | error[E0220]: associated type `Output` not found for `Zero` --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:18:17 @@ -70,15 +82,18 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:23:17 | LL | fn foo5(_: &dyn Zero ( usize )) { - | ^^^^-------------- help: remove these parenthetical generics - | | - | expected 0 generic arguments + | ^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ +help: remove these parenthetical generics + | +LL - fn foo5(_: &dyn Zero ( usize )) { +LL + fn foo5(_: &dyn Zero) { + | error[E0220]: associated type `Output` not found for `Zero` --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:23:17 diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr index 130b193d69c93..3736f25a51ff9 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr @@ -2,15 +2,18 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:8 | LL | fn f isize>(x: F) {} - | ^^^^^------- help: remove these parenthetical generics - | | - | expected 0 generic arguments + | ^^^^^ expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-trait.rs:3:7 | LL | trait Trait {} | ^^^^^ +help: remove these parenthetical generics + | +LL - fn f isize>(x: F) {} +LL + fn f isize>(x: F) {} + | error[E0220]: associated type `Output` not found for `Trait` --> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:24 From 5c2b36a21cabafb1f08e278f4c6ed61753a654cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 5 Jul 2024 01:28:24 +0000 Subject: [PATCH 06/18] Change suggestion message wording --- .../errors/wrong_number_of_generic_args.rs | 8 +-- .../invalid_const_in_lifetime_position.stderr | 6 +- tests/rustdoc-ui/mismatched_arg_count.stderr | 2 +- .../argument-suggestions/issue-100154.stderr | 2 +- ...ssue-82126-mismatched-subst-and-hir.stderr | 4 +- .../transmutable-ice-110969.stderr | 2 +- .../generic_arg_infer/infer-arg-test.stderr | 2 +- .../const_kind_expr/issue_114151.stderr | 2 +- .../generic_const_exprs/issue-102768.stderr | 6 +- .../incorrect-number-of-const-args.stderr | 2 +- .../invalid-const-arg-for-type-param.stderr | 4 +- .../invalid-constant-in-args.stderr | 2 +- tests/ui/constructor-lifetime-args.stderr | 4 +- tests/ui/consts/effect_param.stderr | 8 +-- tests/ui/error-codes/E0107.rs | 16 +++--- tests/ui/error-codes/E0107.stderr | 16 +++--- .../gat-trait-path-parenthesised-args.stderr | 6 +- .../parameter_number_and_kind.stderr | 4 +- ...it-path-type-error-once-implemented.stderr | 6 +- .../generics/bad-mid-path-type-params.stderr | 10 ++-- .../generics/foreign-generic-mismatch.stderr | 2 +- .../generic-arg-mismatch-recover.stderr | 6 +- ...eric-impl-more-params-with-defaults.stderr | 2 +- ...eric-type-more-params-with-defaults.stderr | 2 +- tests/ui/generics/wrong-number-of-args.rs | 22 ++++---- tests/ui/generics/wrong-number-of-args.stderr | 56 +++++++++---------- .../explicit-generic-args-for-impl.stderr | 2 +- .../opaque-and-lifetime-mismatch.stderr | 6 +- tests/ui/issues/issue-18423.stderr | 2 +- tests/ui/issues/issue-53251.stderr | 4 +- tests/ui/issues/issue-60622.stderr | 2 +- .../mismatched_arg_count.stderr | 2 +- .../ui/lifetimes/noisy-follow-up-erro.stderr | 2 +- .../method-call-lifetime-args-fail.stderr | 4 +- tests/ui/resolve/issue-3214.stderr | 2 +- ...o-explicit-const-params-cross-crate.stderr | 4 +- .../effects/no-explicit-const-params.stderr | 4 +- tests/ui/seq-args.stderr | 4 +- .../struct-path-associated-type.stderr | 4 +- ...structure-constructor-type-mismatch.stderr | 4 +- tests/ui/suggestions/issue-101421.stderr | 2 +- tests/ui/suggestions/issue-104287.stderr | 2 +- tests/ui/suggestions/issue-89064.rs | 8 +-- tests/ui/suggestions/issue-89064.stderr | 8 +-- ...-generic-to-trait-in-method-with-params.rs | 2 +- ...eric-to-trait-in-method-with-params.stderr | 2 +- ...assoc-type-suggestion-in-trait-impl.stderr | 2 +- tests/ui/traits/object/vs-lifetime.stderr | 2 +- tests/ui/traits/test-2.stderr | 4 +- .../ui/transmutability/issue-101739-2.stderr | 2 +- .../enum-variant-generic-args.stderr | 12 ++-- ...ypeck-builtin-bound-type-parameters.stderr | 16 +++--- .../typeck_type_placeholder_lifetime_1.stderr | 2 +- .../typeck_type_placeholder_lifetime_2.stderr | 2 +- .../ui/ufcs/ufcs-qpath-missing-params.stderr | 2 +- ...wrong-number-number-type-parameters.stderr | 10 ++-- .../unboxed-closure-sugar-wrong-trait.stderr | 2 +- 57 files changed, 163 insertions(+), 165 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs index c2d5627f2b042..6c2ec1acdf96c 100644 --- a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs +++ b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs @@ -947,8 +947,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { let num_redundant_lt_args = lt_arg_spans.len() - self.num_expected_lifetime_args(); let msg_lifetimes = format!( - "remove {these} lifetime argument{s}", - these = pluralize!("this", num_redundant_lt_args), + "remove the lifetime argument{s}", s = pluralize!(num_redundant_lt_args), ); @@ -989,8 +988,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { let num_redundant_gen_args = gen_arg_spans.len() - self.num_expected_type_or_const_args(); let msg_types_or_consts = format!( - "remove {these} generic argument{s}", - these = pluralize!("this", num_redundant_gen_args), + "remove the unnecessary generic argument{s}", s = pluralize!(num_redundant_gen_args), ); @@ -1036,7 +1034,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { .with_lo(self.path_segment.ident.span.hi()); let msg = format!( - "remove these {}generics", + "remove the unnecessary {}generics", if self.gen_args.parenthesized == hir::GenericArgsParentheses::ParenSugar { "parenthetical " } else { diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr index ff73d3d5ddd64..755a0bba508f1 100644 --- a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr +++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr @@ -25,7 +25,7 @@ note: associated type defined here, with 0 generic parameters | LL | type Y<'a>; | ^ -help: remove these generics +help: remove the unnecessary generics | LL - fn f<'a>(arg : Box = &'a ()>>) {} LL + fn f<'a>(arg : Box>) {} @@ -60,7 +60,7 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove these generics +help: remove the unnecessary generics | LL - fn f<'a>(arg : Box = &'a ()>>) {} LL + fn f<'a>(arg : Box>) {} @@ -95,7 +95,7 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove these generics +help: remove the unnecessary generics | LL - fn f<'a>(arg : Box = &'a ()>>) {} LL + fn f<'a>(arg : Box>) {} diff --git a/tests/rustdoc-ui/mismatched_arg_count.stderr b/tests/rustdoc-ui/mismatched_arg_count.stderr index c58ff7a14df4e..8e7def04f527d 100644 --- a/tests/rustdoc-ui/mismatched_arg_count.stderr +++ b/tests/rustdoc-ui/mismatched_arg_count.stderr @@ -9,7 +9,7 @@ note: type alias defined here, with 1 lifetime parameter: `'a` | LL | type Alias<'a, T> = >::Assoc; | ^^^^^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, , T>) {} diff --git a/tests/ui/argument-suggestions/issue-100154.stderr b/tests/ui/argument-suggestions/issue-100154.stderr index 1496d994ef355..8a650099b8181 100644 --- a/tests/ui/argument-suggestions/issue-100154.stderr +++ b/tests/ui/argument-suggestions/issue-100154.stderr @@ -10,7 +10,7 @@ note: function defined here, with 0 generic parameters LL | fn foo(i: impl std::fmt::Display) {} | ^^^ = note: `impl Trait` cannot be explicitly specified as a generic argument -help: remove these generics +help: remove the unnecessary generics | LL - foo::<()>(()); LL + foo(()); diff --git a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr index c50e3fb640597..aaca4dc91c935 100644 --- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr +++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr @@ -9,7 +9,7 @@ note: struct defined here, with 0 lifetime parameters | LL | struct LockedMarket(T); | ^^^^^^^^^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { LL + async fn buy_lock(coroutine: &Mutex) -> LockedMarket { @@ -43,7 +43,7 @@ note: struct defined here, with 0 lifetime parameters LL | struct LockedMarket(T); | ^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove these generics +help: remove the unnecessary generics | LL - async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { LL + async fn buy_lock(coroutine: &Mutex) -> LockedMarket { diff --git a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr index 91a1053bb6d15..3f32b0eb6746d 100644 --- a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr +++ b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr @@ -4,7 +4,7 @@ error[E0107]: trait takes at most 2 generic arguments but 3 generic arguments we LL | Dst: BikeshedIntrinsicFrom, | ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments | -help: remove this generic argument +help: remove the unnecessary generic argument | LL - Dst: BikeshedIntrinsicFrom, LL + Dst: BikeshedIntrinsicFrom, diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr index f891bbea21ef3..d8e794a7a6523 100644 --- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr +++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr @@ -30,7 +30,7 @@ note: struct defined here, with 2 generic parameters: `T`, `N` | LL | struct All<'a, T, const N: usize> { | ^^^ - -------------- -help: remove this generic argument +help: remove the unnecessary generic argument | LL - let a: All<_, _, _>; LL + let a: All<_, _, >; 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 78d32b57f87f3..a7232ef780e30 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 @@ -9,7 +9,7 @@ note: function defined here, with 1 generic parameter: `N` | LL | fn foo( | ^^^ -------------- -help: remove this generic argument +help: remove the unnecessary generic argument | LL - foo::<_, L>([(); L + 1 + L]); LL + foo::<_, >([(); L + 1 + L]); diff --git a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr index 6bd6eb4e00e6c..4162191175228 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr @@ -25,7 +25,7 @@ note: associated type defined here, with 0 generic parameters | LL | type Y<'a>; | ^ -help: remove these generics +help: remove the unnecessary generics | LL - fn f2<'a>(arg: Box = &'a ()>>) {} LL + fn f2<'a>(arg: Box>) {} @@ -60,7 +60,7 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove these generics +help: remove the unnecessary generics | LL - fn f2<'a>(arg: Box = &'a ()>>) {} LL + fn f2<'a>(arg: Box>) {} @@ -95,7 +95,7 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove these generics +help: remove the unnecessary generics | LL - fn f2<'a>(arg: Box = &'a ()>>) {} LL + fn f2<'a>(arg: Box>) {} diff --git a/tests/ui/const-generics/incorrect-number-of-const-args.stderr b/tests/ui/const-generics/incorrect-number-of-const-args.stderr index 97eb47275c2b2..05c4a0a1a727c 100644 --- a/tests/ui/const-generics/incorrect-number-of-const-args.stderr +++ b/tests/ui/const-generics/incorrect-number-of-const-args.stderr @@ -27,7 +27,7 @@ note: function defined here, with 2 generic parameters: `X`, `Y` | LL | fn foo() -> usize { | ^^^ -------------- -------------- -help: remove this generic argument +help: remove the unnecessary generic argument | LL - foo::<0, 0, 0>(); LL + foo::<0, 0, >(); diff --git a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr index d4f899f837733..dadb67343312f 100644 --- a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr +++ b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr @@ -8,7 +8,7 @@ help: consider moving this generic argument to the `TryInto` trait, which takes | LL | let _: u32 = TryInto::<32>::try_into(5i32).unwrap(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -help: remove these generics +help: remove the unnecessary generics | LL - let _: u32 = 5i32.try_into::<32>().unwrap(); LL + let _: u32 = 5i32.try_into().unwrap(); @@ -34,7 +34,7 @@ note: struct defined here, with 0 generic parameters | LL | struct S; | ^ -help: remove these generics +help: remove the unnecessary generics | LL - S::<0>; LL + S; diff --git a/tests/ui/const-generics/invalid-constant-in-args.stderr b/tests/ui/const-generics/invalid-constant-in-args.stderr index ed715257ac1c3..10334e0d896c7 100644 --- a/tests/ui/const-generics/invalid-constant-in-args.stderr +++ b/tests/ui/const-generics/invalid-constant-in-args.stderr @@ -4,7 +4,7 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl LL | let _: Cell<&str, "a"> = Cell::new(""); | ^^^^ expected 1 generic argument | -help: remove this generic argument +help: remove the unnecessary generic argument | LL - let _: Cell<&str, "a"> = Cell::new(""); LL + let _: Cell<&str, > = Cell::new(""); diff --git a/tests/ui/constructor-lifetime-args.stderr b/tests/ui/constructor-lifetime-args.stderr index 9e0bc3c6c1a6e..37b13cd048fe9 100644 --- a/tests/ui/constructor-lifetime-args.stderr +++ b/tests/ui/constructor-lifetime-args.stderr @@ -27,7 +27,7 @@ note: struct defined here, with 2 lifetime parameters: `'a`, `'b` | LL | struct S<'a, 'b>(&'a u8, &'b u8); | ^ -- -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - S::<'static, 'static, 'static>(&0, &0); LL + S::<'static, 'static, >(&0, &0); @@ -62,7 +62,7 @@ note: enum defined here, with 2 lifetime parameters: `'a`, `'b` | LL | enum E<'a, 'b> { | ^ -- -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - E::V::<'static, 'static, 'static>(&0); LL + E::V::<'static, 'static, >(&0); diff --git a/tests/ui/consts/effect_param.stderr b/tests/ui/consts/effect_param.stderr index 3777e20e4c0ad..fafc20b419240 100644 --- a/tests/ui/consts/effect_param.stderr +++ b/tests/ui/consts/effect_param.stderr @@ -4,7 +4,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli LL | i8::checked_sub::(42, 43); | ^^^^^^^^^^^ expected 0 generic arguments | -help: remove these generics +help: remove the unnecessary generics | LL - i8::checked_sub::(42, 43); LL + i8::checked_sub(42, 43); @@ -16,7 +16,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli LL | i8::checked_sub::(42, 43); | ^^^^^^^^^^^ expected 0 generic arguments | -help: remove these generics +help: remove the unnecessary generics | LL - i8::checked_sub::(42, 43); LL + i8::checked_sub(42, 43); @@ -28,7 +28,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli LL | i8::checked_sub::(42, 43); | ^^^^^^^^^^^ expected 0 generic arguments | -help: remove these generics +help: remove the unnecessary generics | LL - i8::checked_sub::(42, 43); LL + i8::checked_sub(42, 43); @@ -40,7 +40,7 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli LL | i8::checked_sub::(42, 43); | ^^^^^^^^^^^ expected 0 generic arguments | -help: remove these generics +help: remove the unnecessary generics | LL - i8::checked_sub::(42, 43); LL + i8::checked_sub(42, 43); diff --git a/tests/ui/error-codes/E0107.rs b/tests/ui/error-codes/E0107.rs index fd23e7c00f2bf..161360a501285 100644 --- a/tests/ui/error-codes/E0107.rs +++ b/tests/ui/error-codes/E0107.rs @@ -16,35 +16,35 @@ struct Baz<'a, 'b, 'c> { bar: Bar<'a>, //~^ ERROR enum takes 0 lifetime arguments - //~| HELP remove these generics + //~| HELP remove the unnecessary generics foo2: Foo<'a, 'b, 'c>, //~^ ERROR struct takes 1 lifetime argument - //~| HELP remove these lifetime arguments + //~| HELP remove the lifetime arguments qux1: Qux<'a, 'b, i32>, //~^ ERROR struct takes 1 lifetime argument - //~| HELP remove this lifetime argument + //~| HELP remove the lifetime argument qux2: Qux<'a, i32, 'b>, //~^ ERROR struct takes 1 lifetime argument - //~| HELP remove this lifetime argument + //~| HELP remove the lifetime argument qux3: Qux<'a, 'b, 'c, i32>, //~^ ERROR struct takes 1 lifetime argument - //~| HELP remove these lifetime arguments + //~| HELP remove the lifetime arguments qux4: Qux<'a, i32, 'b, 'c>, //~^ ERROR struct takes 1 lifetime argument - //~| HELP remove these lifetime arguments + //~| HELP remove the lifetime arguments qux5: Qux<'a, 'b, i32, 'c>, //~^ ERROR struct takes 1 lifetime argument - //~| HELP remove this lifetime argument + //~| HELP remove the lifetime argument quux: Quux<'a, i32, 'b>, //~^ ERROR struct takes 0 lifetime arguments - //~| HELP remove this lifetime argument + //~| HELP remove the lifetime argument } pub trait T { diff --git a/tests/ui/error-codes/E0107.stderr b/tests/ui/error-codes/E0107.stderr index c6317270f9b12..d8bd96e0ad466 100644 --- a/tests/ui/error-codes/E0107.stderr +++ b/tests/ui/error-codes/E0107.stderr @@ -27,7 +27,7 @@ note: enum defined here, with 0 lifetime parameters | LL | enum Bar { | ^^^ -help: remove these generics +help: remove the unnecessary generics | LL - bar: Bar<'a>, LL + bar: Bar, @@ -44,7 +44,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` | LL | struct Foo<'a>(&'a str); | ^^^ -- -help: remove these lifetime arguments +help: remove the lifetime arguments | LL - foo2: Foo<'a, 'b, 'c>, LL + foo2: Foo<'a, >, @@ -61,7 +61,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` | LL | struct Qux<'a, T>(&'a T); | ^^^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - qux1: Qux<'a, 'b, i32>, LL + qux1: Qux<'a, , i32>, @@ -78,7 +78,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` | LL | struct Qux<'a, T>(&'a T); | ^^^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - qux2: Qux<'a, i32, 'b>, LL + qux2: Qux<'a, i32, >, @@ -95,7 +95,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` | LL | struct Qux<'a, T>(&'a T); | ^^^ -- -help: remove these lifetime arguments +help: remove the lifetime arguments | LL - qux3: Qux<'a, 'b, 'c, i32>, LL + qux3: Qux<'a, , i32>, @@ -112,7 +112,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` | LL | struct Qux<'a, T>(&'a T); | ^^^ -- -help: remove these lifetime arguments +help: remove the lifetime arguments | LL - qux4: Qux<'a, i32, 'b, 'c>, LL + qux4: Qux<'a, i32, >, @@ -129,7 +129,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` | LL | struct Qux<'a, T>(&'a T); | ^^^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - qux5: Qux<'a, 'b, i32, 'c>, LL + qux5: Qux<'a, , i32, 'c>, @@ -146,7 +146,7 @@ note: struct defined here, with 0 lifetime parameters | LL | struct Quux(T); | ^^^^ -help: remove this lifetime argument +help: remove the lifetime argument | LL - quux: Quux<'a, i32, 'b>, LL + quux: Quux<, i32, 'b>, diff --git a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr index 18f37207ee557..252d81fa6f35e 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr +++ b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr @@ -50,7 +50,7 @@ note: associated type defined here, with 0 generic parameters | LL | type Y<'a>; | ^ -help: remove these generics +help: remove the unnecessary generics | LL - fn foo<'a>(arg: Box>) {} LL + fn foo<'a>(arg: Box>) {} @@ -85,7 +85,7 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove these generics +help: remove the unnecessary generics | LL - fn foo<'a>(arg: Box>) {} LL + fn foo<'a>(arg: Box>) {} @@ -120,7 +120,7 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove these generics +help: remove the unnecessary generics | LL - fn foo<'a>(arg: Box>) {} LL + fn foo<'a>(arg: Box>) {} diff --git a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr index 9eb0b8ca641cb..7b7f21b00c5ad 100644 --- a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr +++ b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr @@ -9,7 +9,7 @@ note: associated type defined here, with 1 lifetime parameter: `'a` | LL | type E<'a, T>; | ^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - type FErr1 = Self::E<'static, 'static>; LL + type FErr1 = Self::E<'static, >; @@ -42,7 +42,7 @@ note: associated type defined here, with 1 generic parameter: `T` | LL | type E<'a, T>; | ^ - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - type FErr2 = Self::E<'static, T, u32>; LL + type FErr2 = Self::E<'static, T, >; diff --git a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr index f73022922a5b3..6ea96b6228efa 100644 --- a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr +++ b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr @@ -25,7 +25,7 @@ note: associated type defined here, with 0 generic parameters | LL | type Y<'a>; | ^ -help: remove these generics +help: remove the unnecessary generics | LL - fn f2<'a>(arg : Box = &'a ()>>) {} LL + fn f2<'a>(arg : Box>) {} @@ -60,7 +60,7 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove these generics +help: remove the unnecessary generics | LL - fn f2<'a>(arg : Box = &'a ()>>) {} LL + fn f2<'a>(arg : Box>) {} @@ -95,7 +95,7 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove these generics +help: remove the unnecessary generics | LL - fn f2<'a>(arg : Box = &'a ()>>) {} LL + fn f2<'a>(arg : Box>) {} diff --git a/tests/ui/generics/bad-mid-path-type-params.stderr b/tests/ui/generics/bad-mid-path-type-params.stderr index 7f4ba781e6ab3..ba1d48f1210b2 100644 --- a/tests/ui/generics/bad-mid-path-type-params.stderr +++ b/tests/ui/generics/bad-mid-path-type-params.stderr @@ -9,7 +9,7 @@ note: associated function defined here, with 1 generic parameter: `U` | LL | fn new(x: T, _: U) -> S { | ^^^ - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - let _ = S::new::(1, 1.0); LL + let _ = S::new::(1, 1.0); @@ -26,7 +26,7 @@ note: struct defined here, with 0 lifetime parameters | LL | struct S { | ^ -help: remove this lifetime argument +help: remove the lifetime argument | LL - let _ = S::<'a,isize>::new::(1, 1.0); LL + let _ = S::<,isize>::new::(1, 1.0); @@ -43,7 +43,7 @@ note: associated function defined here, with 1 generic parameter: `U` | LL | fn new(x: T, y: U) -> Self; | ^^^ - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - let _: S2 = Trait::new::(1, 1.0); LL + let _: S2 = Trait::new::(1, 1.0); @@ -60,7 +60,7 @@ note: trait defined here, with 0 lifetime parameters | LL | trait Trait { | ^^^^^ -help: remove this lifetime argument +help: remove the lifetime argument | LL - let _: S2 = Trait::<'a,isize>::new::(1, 1.0); LL + let _: S2 = Trait::<,isize>::new::(1, 1.0); @@ -77,7 +77,7 @@ note: associated function defined here, with 1 generic parameter: `U` | LL | fn new(x: T, y: U) -> Self; | ^^^ - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - let _: S2 = Trait::<'a,isize>::new::(1, 1.0); LL + let _: S2 = Trait::<'a,isize>::new::(1, 1.0); diff --git a/tests/ui/generics/foreign-generic-mismatch.stderr b/tests/ui/generics/foreign-generic-mismatch.stderr index 7e8e854d64248..740963aeec548 100644 --- a/tests/ui/generics/foreign-generic-mismatch.stderr +++ b/tests/ui/generics/foreign-generic-mismatch.stderr @@ -27,7 +27,7 @@ note: function defined here, with 1 lifetime parameter: `'a` | LL | pub fn lt_arg<'a: 'a>() {} | ^^^^^^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - foreign_generic_mismatch::lt_arg::<'static, 'static>(); LL + foreign_generic_mismatch::lt_arg::<'static, >(); diff --git a/tests/ui/generics/generic-arg-mismatch-recover.stderr b/tests/ui/generics/generic-arg-mismatch-recover.stderr index cb25fa7af40aa..e8c2a4665f3da 100644 --- a/tests/ui/generics/generic-arg-mismatch-recover.stderr +++ b/tests/ui/generics/generic-arg-mismatch-recover.stderr @@ -9,7 +9,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` | LL | struct Foo<'a, T: 'a>(&'a T); | ^^^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - Foo::<'static, 'static, ()>(&0); LL + Foo::<'static, , ()>(&0); @@ -26,7 +26,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` | LL | struct Bar<'a>(&'a ()); | ^^^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - Bar::<'static, 'static, ()>(&()); LL + Bar::<'static, , ()>(&()); @@ -43,7 +43,7 @@ note: struct defined here, with 0 generic parameters | LL | struct Bar<'a>(&'a ()); | ^^^ -help: remove this generic argument +help: remove the unnecessary generic argument | LL - Bar::<'static, 'static, ()>(&()); LL + Bar::<'static, 'static, >(&()); diff --git a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr index edbe7a5e139cb..b0973c477ff4c 100644 --- a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr +++ b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr @@ -9,7 +9,7 @@ note: struct defined here, with at most 2 generic parameters: `T`, `A` | LL | struct Vec( | ^^^ - -------- -help: remove this generic argument +help: remove the unnecessary generic argument | LL - Vec::::new(); LL + Vec::::new(); diff --git a/tests/ui/generics/generic-type-more-params-with-defaults.stderr b/tests/ui/generics/generic-type-more-params-with-defaults.stderr index 27752af1ad6cb..e83a433b0605d 100644 --- a/tests/ui/generics/generic-type-more-params-with-defaults.stderr +++ b/tests/ui/generics/generic-type-more-params-with-defaults.stderr @@ -9,7 +9,7 @@ note: struct defined here, with at most 2 generic parameters: `T`, `A` | LL | struct Vec( | ^^^ - -------- -help: remove this generic argument +help: remove the unnecessary generic argument | LL - let _: Vec; LL + let _: Vec; diff --git a/tests/ui/generics/wrong-number-of-args.rs b/tests/ui/generics/wrong-number-of-args.rs index 95463d1c32c30..6524bd538b6bf 100644 --- a/tests/ui/generics/wrong-number-of-args.rs +++ b/tests/ui/generics/wrong-number-of-args.rs @@ -5,19 +5,19 @@ mod no_generics { type B = Ty<'static>; //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument - //~| HELP remove these generics + //~| HELP remove the unnecessary generics type C = Ty<'static, usize>; //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument //~| ERROR struct takes 0 generic arguments but 1 generic argument - //~| HELP remove this lifetime argument - //~| HELP remove this generic argument + //~| HELP remove the lifetime argument + //~| HELP remove the unnecessary generic argument type D = Ty<'static, usize, { 0 }>; //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument //~| ERROR struct takes 0 generic arguments but 2 generic arguments - //~| HELP remove this lifetime argument - //~| HELP remove these generic arguments + //~| HELP remove the lifetime argument + //~| HELP remove the unnecessary generic arguments } mod type_and_type { @@ -35,7 +35,7 @@ mod type_and_type { type D = Ty; //~^ ERROR struct takes 2 generic arguments but 3 generic arguments - //~| HELP remove this + //~| HELP remove the type E = Ty<>; //~^ ERROR struct takes 2 generic arguments but 0 generic arguments were supplied @@ -70,8 +70,8 @@ mod lifetime_and_type { type F = Ty<'static, usize, 'static, usize>; //~^ ERROR struct takes 1 lifetime argument but 2 lifetime arguments //~| ERROR struct takes 1 generic argument but 2 generic arguments - //~| HELP remove this lifetime argument - //~| HELP remove this generic argument + //~| HELP remove the lifetime argument + //~| HELP remove the unnecessary generic argument } mod type_and_type_and_type { @@ -317,13 +317,13 @@ mod stdlib { type C = HashMap<'static>; //~^ ERROR struct takes 0 lifetime arguments but 1 lifetime argument - //~| HELP remove these generics + //~| HELP remove the //~| ERROR struct takes at least 2 //~| HELP add missing type D = HashMap; //~^ ERROR struct takes at most 3 - //~| HELP remove this + //~| HELP remove the type E = HashMap<>; //~^ ERROR struct takes at least 2 generic arguments but 0 generic arguments @@ -341,7 +341,7 @@ mod stdlib { type C = Result<'static>; //~^ ERROR enum takes 0 lifetime arguments but 1 lifetime argument - //~| HELP remove these generics + //~| HELP remove the unnecessary generics //~| ERROR enum takes 2 generic arguments but 0 generic arguments //~| HELP add missing diff --git a/tests/ui/generics/wrong-number-of-args.stderr b/tests/ui/generics/wrong-number-of-args.stderr index 9df759bf29b11..1363032ad142f 100644 --- a/tests/ui/generics/wrong-number-of-args.stderr +++ b/tests/ui/generics/wrong-number-of-args.stderr @@ -178,7 +178,7 @@ note: struct defined here, with 0 lifetime parameters | LL | struct Ty; | ^^ -help: remove these generics +help: remove the unnecessary generics | LL - type B = Ty<'static>; LL + type B = Ty; @@ -195,7 +195,7 @@ note: struct defined here, with 0 lifetime parameters | LL | struct Ty; | ^^ -help: remove this lifetime argument +help: remove the lifetime argument | LL - type C = Ty<'static, usize>; LL + type C = Ty<, usize>; @@ -212,7 +212,7 @@ note: struct defined here, with 0 generic parameters | LL | struct Ty; | ^^ -help: remove this generic argument +help: remove the unnecessary generic argument | LL - type C = Ty<'static, usize>; LL + type C = Ty<'static, >; @@ -229,7 +229,7 @@ note: struct defined here, with 0 lifetime parameters | LL | struct Ty; | ^^ -help: remove this lifetime argument +help: remove the lifetime argument | LL - type D = Ty<'static, usize, { 0 }>; LL + type D = Ty<, usize, { 0 }>; @@ -246,7 +246,7 @@ note: struct defined here, with 0 generic parameters | LL | struct Ty; | ^^ -help: remove these generic arguments +help: remove the unnecessary generic arguments | LL - type D = Ty<'static, usize, { 0 }>; LL + type D = Ty<'static, >; @@ -297,7 +297,7 @@ note: struct defined here, with 2 generic parameters: `A`, `B` | LL | struct Ty(A, B); | ^^ - - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - type D = Ty; LL + type D = Ty; @@ -378,7 +378,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` | LL | struct Ty<'a, T>(&'a T); | ^^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - type F = Ty<'static, usize, 'static, usize>; LL + type F = Ty<'static, usize, , usize>; @@ -395,7 +395,7 @@ note: struct defined here, with 1 generic parameter: `T` | LL | struct Ty<'a, T>(&'a T); | ^^ - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - type F = Ty<'static, usize, 'static, usize>; LL + type F = Ty<'static, usize, 'static, >; @@ -446,7 +446,7 @@ note: struct defined here, with at most 3 generic parameters: `A`, `B`, `C` | LL | struct Ty(A, B, C); | ^^ - - ---------------- -help: remove this generic argument +help: remove the unnecessary generic argument | LL - type E = Ty; LL + type E = Ty; @@ -479,7 +479,7 @@ note: trait defined here, with 0 generic parameters | LL | trait NonGeneric { | ^^^^^^^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - type A = Box>; LL + type A = Box; @@ -496,7 +496,7 @@ note: trait defined here, with 1 lifetime parameter: `'a` | LL | trait GenericLifetime<'a> { | ^^^^^^^^^^^^^^^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - type C = Box>; LL + type C = Box>; @@ -529,7 +529,7 @@ note: trait defined here, with 1 generic parameter: `A` | LL | trait GenericType { | ^^^^^^^^^^^ - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - type E = Box>; LL + type E = Box>; @@ -562,7 +562,7 @@ note: trait defined here, with 0 generic parameters | LL | trait NonGenericAT { | ^^^^^^^^^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - type A = Box>; LL + type A = Box; @@ -579,7 +579,7 @@ note: trait defined here, with 1 lifetime parameter: `'a` | LL | trait GenericLifetimeAT<'a> { | ^^^^^^^^^^^^^^^^^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - type B = Box>; LL + type B = Box>; @@ -596,7 +596,7 @@ note: trait defined here, with 0 generic parameters | LL | trait GenericLifetimeAT<'a> { | ^^^^^^^^^^^^^^^^^ -help: remove this generic argument +help: remove the unnecessary generic argument | LL - type C = Box>; LL + type C = Box>; @@ -629,7 +629,7 @@ note: trait defined here, with 1 generic parameter: `A` | LL | trait GenericTypeAT { | ^^^^^^^^^^^^^ - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - type B = Box>; LL + type B = Box>; @@ -646,7 +646,7 @@ note: trait defined here, with 0 lifetime parameters | LL | trait GenericTypeAT { | ^^^^^^^^^^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - type C = Box>; LL + type C = Box; @@ -711,7 +711,7 @@ note: trait defined here, with 1 lifetime parameter: `'a` | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - type C = Box>; LL + type C = Box>; @@ -744,7 +744,7 @@ note: trait defined here, with 1 generic parameter: `A` | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - type E = Box>; LL + type E = Box>; @@ -761,7 +761,7 @@ note: trait defined here, with 1 lifetime parameter: `'a` | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - type F = Box>; LL + type F = Box>; @@ -778,7 +778,7 @@ note: trait defined here, with 1 generic parameter: `A` | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - type G = Box>; LL + type G = Box>; @@ -795,7 +795,7 @@ note: trait defined here, with 1 lifetime parameter: `'a` | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - type H = Box>; LL + type H = Box>; @@ -812,7 +812,7 @@ note: trait defined here, with 1 generic parameter: `A` | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - type H = Box>; LL + type H = Box>; @@ -863,7 +863,7 @@ note: trait defined here, with 2 generic parameters: `A`, `B` | LL | trait GenericTypeTypeAT { | ^^^^^^^^^^^^^^^^^ - - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - type C = Box>; LL + type C = Box>; @@ -985,7 +985,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp LL | type C = HashMap<'static>; | ^^^^^^^ expected 0 lifetime arguments | -help: remove these generics +help: remove the unnecessary generics | LL - type C = HashMap<'static>; LL + type C = HashMap; @@ -1008,7 +1008,7 @@ error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments w LL | type D = HashMap; | ^^^^^^^ expected at most 3 generic arguments | -help: remove this generic argument +help: remove the unnecessary generic argument | LL - type D = HashMap; LL + type D = HashMap; @@ -1055,7 +1055,7 @@ error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was suppli LL | type C = Result<'static>; | ^^^^^^ expected 0 lifetime arguments | -help: remove these generics +help: remove the unnecessary generics | LL - type C = Result<'static>; LL + type C = Result; @@ -1078,7 +1078,7 @@ error[E0107]: enum takes 2 generic arguments but 3 generic arguments were suppli LL | type D = Result; | ^^^^^^ expected 2 generic arguments | -help: remove this generic argument +help: remove the unnecessary generic argument | LL - type D = Result; LL + type D = Result; diff --git a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr index d184110c45345..1c22e77e8171b 100644 --- a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr +++ b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr @@ -10,7 +10,7 @@ note: function defined here, with 1 generic parameter: `T` LL | fn foo(_f: impl AsRef) {} | ^^^ - = note: `impl Trait` cannot be explicitly specified as a generic argument -help: remove this generic argument +help: remove the unnecessary generic argument | LL - foo::("".to_string()); LL + foo::("".to_string()); diff --git a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr index aba82084f2258..1802a22d6cfe6 100644 --- a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr +++ b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr @@ -45,7 +45,7 @@ note: struct defined here, with 0 generic parameters | LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ -help: remove this generic argument +help: remove the unnecessary generic argument | LL - fn bar() -> Wrapper; LL + fn bar() -> Wrapper<>; @@ -62,7 +62,7 @@ note: struct defined here, with 0 generic parameters | LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ -help: remove this generic argument +help: remove the unnecessary generic argument | LL - fn foo() -> Wrapper; LL + fn foo() -> Wrapper<>; @@ -106,7 +106,7 @@ note: struct defined here, with 0 generic parameters | LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ -help: remove this generic argument +help: remove the unnecessary generic argument | LL - fn foo() -> Wrapper { LL + fn foo() -> Wrapper<> { diff --git a/tests/ui/issues/issue-18423.stderr b/tests/ui/issues/issue-18423.stderr index a73688205ac80..c1a4aacd2a54e 100644 --- a/tests/ui/issues/issue-18423.stderr +++ b/tests/ui/issues/issue-18423.stderr @@ -4,7 +4,7 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp LL | x: Box<'a, isize> | ^^^ expected 0 lifetime arguments | -help: remove this lifetime argument +help: remove the lifetime argument | LL - x: Box<'a, isize> LL + x: Box<, isize> diff --git a/tests/ui/issues/issue-53251.stderr b/tests/ui/issues/issue-53251.stderr index db9df7d911c41..854e9bc0c9b3e 100644 --- a/tests/ui/issues/issue-53251.stderr +++ b/tests/ui/issues/issue-53251.stderr @@ -13,7 +13,7 @@ note: associated function defined here, with 0 generic parameters LL | fn f() {} | ^ = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info) -help: remove these generics +help: remove the unnecessary generics | LL - S::f::(); LL + S::f(); @@ -35,7 +35,7 @@ LL | fn f() {} | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info) -help: remove these generics +help: remove the unnecessary generics | LL - S::f::(); LL + S::f(); diff --git a/tests/ui/issues/issue-60622.stderr b/tests/ui/issues/issue-60622.stderr index e694a92213c85..66e96131f5e0c 100644 --- a/tests/ui/issues/issue-60622.stderr +++ b/tests/ui/issues/issue-60622.stderr @@ -27,7 +27,7 @@ note: method defined here, with 0 generic parameters | LL | fn a(&self) {} | ^ -help: remove this generic argument +help: remove the unnecessary generic argument | LL - b.a::<'_, T>(); LL + b.a::<'_, >(); diff --git a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr index de0a0631bf884..02dbfca15a4a2 100644 --- a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr +++ b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr @@ -9,7 +9,7 @@ note: type alias defined here, with 1 lifetime parameter: `'a` | LL | type Alias<'a, T> = >::Assoc; | ^^^^^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, , T>) {} diff --git a/tests/ui/lifetimes/noisy-follow-up-erro.stderr b/tests/ui/lifetimes/noisy-follow-up-erro.stderr index 38465c7ac963a..90dfc88e19f0d 100644 --- a/tests/ui/lifetimes/noisy-follow-up-erro.stderr +++ b/tests/ui/lifetimes/noisy-follow-up-erro.stderr @@ -9,7 +9,7 @@ note: struct defined here, with 2 lifetime parameters: `'c`, `'d` | LL | struct Foo<'c, 'd>(&'c (), &'d ()); | ^^^ -- -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - fn boom(&self, foo: &mut Foo<'_, '_, 'a>) -> Result<(), &'a ()> { LL + fn boom(&self, foo: &mut Foo<'_, '_, >) -> Result<(), &'a ()> { diff --git a/tests/ui/methods/method-call-lifetime-args-fail.stderr b/tests/ui/methods/method-call-lifetime-args-fail.stderr index d431e0721ccb9..60ef1060aaca5 100644 --- a/tests/ui/methods/method-call-lifetime-args-fail.stderr +++ b/tests/ui/methods/method-call-lifetime-args-fail.stderr @@ -27,7 +27,7 @@ note: method defined here, with 2 lifetime parameters: `'a`, `'b` | LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } | ^^^^^ -- -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - S.early::<'static, 'static, 'static>(); LL + S.early::<'static, 'static, >(); @@ -230,7 +230,7 @@ note: method defined here, with 2 lifetime parameters: `'a`, `'b` | LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } | ^^^^^ -- -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - S::early::<'static, 'static, 'static>(S); LL + S::early::<'static, 'static, >(S); diff --git a/tests/ui/resolve/issue-3214.stderr b/tests/ui/resolve/issue-3214.stderr index 614d3b21ff2cc..f6f8c3b774679 100644 --- a/tests/ui/resolve/issue-3214.stderr +++ b/tests/ui/resolve/issue-3214.stderr @@ -19,7 +19,7 @@ note: struct defined here, with 0 generic parameters | LL | struct Foo { | ^^^ -help: remove these generics +help: remove the unnecessary generics | LL - impl Drop for Foo { LL + impl Drop for Foo { diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr index 3d9df78b196e3..6945e8465da7b 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr @@ -9,7 +9,7 @@ note: function defined here, with 0 generic parameters | LL | pub const fn foo() {} | ^^^ -help: remove these generics +help: remove the unnecessary generics | LL - foo::(); LL + foo(); @@ -42,7 +42,7 @@ note: function defined here, with 0 generic parameters | LL | pub const fn foo() {} | ^^^ -help: remove these generics +help: remove the unnecessary generics | LL - foo::(); LL + foo(); diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr index 8412a3d0a8a0c..0f9380de2862a 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr @@ -23,7 +23,7 @@ note: function defined here, with 0 generic parameters | LL | const fn foo() {} | ^^^ -help: remove these generics +help: remove the unnecessary generics | LL - foo::(); LL + foo(); @@ -65,7 +65,7 @@ note: function defined here, with 0 generic parameters | LL | const fn foo() {} | ^^^ -help: remove these generics +help: remove the unnecessary generics | LL - foo::(); LL + foo(); diff --git a/tests/ui/seq-args.stderr b/tests/ui/seq-args.stderr index bb46a11d90262..47c5119b91732 100644 --- a/tests/ui/seq-args.stderr +++ b/tests/ui/seq-args.stderr @@ -9,7 +9,7 @@ note: trait defined here, with 0 generic parameters | LL | trait Seq { } | ^^^ -help: remove these generics +help: remove the unnecessary generics | LL - impl Seq for Vec { LL + impl Seq for Vec { @@ -26,7 +26,7 @@ note: trait defined here, with 0 generic parameters | LL | trait Seq { } | ^^^ -help: remove these generics +help: remove the unnecessary generics | LL - impl Seq for u32 { LL + impl Seq for u32 { diff --git a/tests/ui/structs/struct-path-associated-type.stderr b/tests/ui/structs/struct-path-associated-type.stderr index edcb0bcc8332a..1a2a346b0e303 100644 --- a/tests/ui/structs/struct-path-associated-type.stderr +++ b/tests/ui/structs/struct-path-associated-type.stderr @@ -15,7 +15,7 @@ note: associated type defined here, with 0 generic parameters | LL | type A; | ^ -help: remove these generics +help: remove the unnecessary generics | LL - let z = T::A:: {}; LL + let z = T::A {}; @@ -44,7 +44,7 @@ note: associated type defined here, with 0 generic parameters | LL | type A; | ^ -help: remove these generics +help: remove the unnecessary generics | LL - let z = T::A:: {}; LL + let z = T::A {}; diff --git a/tests/ui/structs/structure-constructor-type-mismatch.stderr b/tests/ui/structs/structure-constructor-type-mismatch.stderr index 50ebd86a2166e..606381251157c 100644 --- a/tests/ui/structs/structure-constructor-type-mismatch.stderr +++ b/tests/ui/structs/structure-constructor-type-mismatch.stderr @@ -75,7 +75,7 @@ note: type alias defined here, with 0 generic parameters | LL | type PointF = Point; | ^^^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - let pt3 = PointF:: { LL + let pt3 = PointF { @@ -114,7 +114,7 @@ note: type alias defined here, with 0 generic parameters | LL | type PointF = Point; | ^^^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - PointF:: { .. } => {} LL + PointF { .. } => {} diff --git a/tests/ui/suggestions/issue-101421.stderr b/tests/ui/suggestions/issue-101421.stderr index 1a64f5313cf53..7adf07aa531c0 100644 --- a/tests/ui/suggestions/issue-101421.stderr +++ b/tests/ui/suggestions/issue-101421.stderr @@ -9,7 +9,7 @@ note: method defined here, with 0 generic parameters | LL | fn f(&self, _: ()); | ^ -help: remove these generics +help: remove the unnecessary generics | LL - ().f::<()>(()); LL + ().f(()); diff --git a/tests/ui/suggestions/issue-104287.stderr b/tests/ui/suggestions/issue-104287.stderr index b65d3ad4d318a..808f956280581 100644 --- a/tests/ui/suggestions/issue-104287.stderr +++ b/tests/ui/suggestions/issue-104287.stderr @@ -9,7 +9,7 @@ note: method defined here, with 0 generic parameters | LL | fn foo(&self) {} | ^^^ -help: remove these generics +help: remove the unnecessary generics | LL - foo::<()>(x); LL + foo(x); diff --git a/tests/ui/suggestions/issue-89064.rs b/tests/ui/suggestions/issue-89064.rs index fa5fc899dc083..014d15a87f17c 100644 --- a/tests/ui/suggestions/issue-89064.rs +++ b/tests/ui/suggestions/issue-89064.rs @@ -16,20 +16,20 @@ impl B for S {} fn main() { let _ = A::foo::(); //~^ ERROR - //~| HELP remove these generics + //~| HELP remove the unnecessary generics //~| HELP consider moving this generic argument let _ = B::bar::(); //~^ ERROR - //~| HELP remove these generics + //~| HELP remove the unnecessary generics //~| HELP consider moving these generic arguments let _ = A::::foo::(); //~^ ERROR - //~| HELP remove these generics + //~| HELP remove the unnecessary generics let _ = 42.into::>(); //~^ ERROR - //~| HELP remove these generics + //~| HELP remove the unnecessary generics //~| HELP consider moving this generic argument } diff --git a/tests/ui/suggestions/issue-89064.stderr b/tests/ui/suggestions/issue-89064.stderr index f1bb3c2adc74f..a64a1986af847 100644 --- a/tests/ui/suggestions/issue-89064.stderr +++ b/tests/ui/suggestions/issue-89064.stderr @@ -14,7 +14,7 @@ help: consider moving this generic argument to the `A` trait, which takes up to LL - let _ = A::foo::(); LL + let _ = A::::foo(); | -help: remove these generics +help: remove the unnecessary generics | LL - let _ = A::foo::(); LL + let _ = A::foo(); @@ -36,7 +36,7 @@ help: consider moving these generic arguments to the `B` trait, which takes up t LL - let _ = B::bar::(); LL + let _ = B::::bar(); | -help: remove these generics +help: remove the unnecessary generics | LL - let _ = B::bar::(); LL + let _ = B::bar(); @@ -53,7 +53,7 @@ note: associated function defined here, with 0 generic parameters | LL | fn foo() {} | ^^^ -help: remove these generics +help: remove the unnecessary generics | LL - let _ = A::::foo::(); LL + let _ = A::::foo(); @@ -69,7 +69,7 @@ help: consider moving this generic argument to the `Into` trait, which takes up | LL | let _ = Into::>::into(42); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -help: remove these generics +help: remove the unnecessary generics | LL - let _ = 42.into::>(); LL + let _ = 42.into(); diff --git a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs index 4066cd3b11a38..a719ddc4b16aa 100644 --- a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs +++ b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.rs @@ -14,5 +14,5 @@ fn main() { 1.bar::(0); //~^ ERROR method takes 0 generic arguments but 1 generic argument was supplied //~| HELP consider moving this generic argument to the `Foo` trait, which takes up to 1 argument - //~| HELP remove these generics + //~| HELP remove the unnecessary generics } diff --git a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr index aa11bc7cf1d9c..cc735ef4c5ea5 100644 --- a/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr +++ b/tests/ui/suggestions/move-generic-to-trait-in-method-with-params.stderr @@ -13,7 +13,7 @@ help: consider moving this generic argument to the `Foo` trait, which takes up t | LL | Foo::::bar(1, 0); | ~~~~~~~~~~~~~~~~~~~~~ -help: remove these generics +help: remove the unnecessary generics | LL - 1.bar::(0); LL + 1.bar(0); diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr index 9193faeb1aa9a..5a54ca181ce63 100644 --- a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr +++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr @@ -124,7 +124,7 @@ note: struct defined here, with 1 generic parameter: `T` | LL | struct Struct> { | ^^^^^^ - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - impl, U> YetAnotherTrait for Struct {} LL + impl, U> YetAnotherTrait for Struct {} diff --git a/tests/ui/traits/object/vs-lifetime.stderr b/tests/ui/traits/object/vs-lifetime.stderr index aab4845a27420..e02c750055bc8 100644 --- a/tests/ui/traits/object/vs-lifetime.stderr +++ b/tests/ui/traits/object/vs-lifetime.stderr @@ -15,7 +15,7 @@ note: struct defined here, with 1 lifetime parameter: `'a` | LL | struct S<'a, T>(&'a u8, T); | ^ -- -help: remove this lifetime argument +help: remove the lifetime argument | LL - let _: S<'static, 'static>; LL + let _: S<'static, >; diff --git a/tests/ui/traits/test-2.stderr b/tests/ui/traits/test-2.stderr index 9916cf97fca95..d1a003aa3f422 100644 --- a/tests/ui/traits/test-2.stderr +++ b/tests/ui/traits/test-2.stderr @@ -9,7 +9,7 @@ note: method defined here, with 0 generic parameters | LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } | ^^^ -help: remove these generics +help: remove the unnecessary generics | LL - 10.dup::(); LL + 10.dup(); @@ -26,7 +26,7 @@ note: method defined here, with 1 generic parameter: `X` | LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } | ^^^^ - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - 10.blah::(); LL + 10.blah::(); diff --git a/tests/ui/transmutability/issue-101739-2.stderr b/tests/ui/transmutability/issue-101739-2.stderr index 93323049760aa..1f640f21ad171 100644 --- a/tests/ui/transmutability/issue-101739-2.stderr +++ b/tests/ui/transmutability/issue-101739-2.stderr @@ -4,7 +4,7 @@ error[E0107]: trait takes at most 2 generic arguments but 5 generic arguments we LL | Dst: BikeshedIntrinsicFrom< | ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments | -help: remove these generic arguments +help: remove the unnecessary generic arguments | LL - ASSUME_LIFETIMES, LL - ASSUME_VALIDITY, diff --git a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr index a2dd6805f3d5c..aaed6a9b54469 100644 --- a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr +++ b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr @@ -315,7 +315,7 @@ note: type alias defined here, with 0 generic parameters | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - AliasFixed::<()>::TSVariant(()); LL + AliasFixed::TSVariant(()); @@ -332,7 +332,7 @@ note: type alias defined here, with 0 generic parameters | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - AliasFixed::<()>::TSVariant::<()>(()); LL + AliasFixed::TSVariant::<()>(()); @@ -412,7 +412,7 @@ note: type alias defined here, with 0 generic parameters | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - AliasFixed::<()>::SVariant { v: () }; LL + AliasFixed::SVariant { v: () }; @@ -429,7 +429,7 @@ note: type alias defined here, with 0 generic parameters | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - AliasFixed::<()>::SVariant::<()> { v: () }; LL + AliasFixed::SVariant::<()> { v: () }; @@ -493,7 +493,7 @@ note: type alias defined here, with 0 generic parameters | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - AliasFixed::<()>::UVariant; LL + AliasFixed::UVariant; @@ -510,7 +510,7 @@ note: type alias defined here, with 0 generic parameters | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - AliasFixed::<()>::UVariant::<()>; LL + AliasFixed::UVariant::<()>; diff --git a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr index 3be83682ec9aa..dbcc03ee955f4 100644 --- a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr +++ b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr @@ -4,7 +4,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie LL | fn foo1, U>(x: T) {} | ^^^^ expected 0 generic arguments | -help: remove these generics +help: remove the unnecessary generics | LL - fn foo1, U>(x: T) {} LL + fn foo1(x: T) {} @@ -16,7 +16,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie LL | trait Trait: Copy {} | ^^^^ expected 0 generic arguments | -help: remove these generics +help: remove the unnecessary generics | LL - trait Trait: Copy {} LL + trait Trait: Copy {} @@ -29,7 +29,7 @@ LL | trait Trait: Copy {} | ^^^^ expected 0 generic arguments | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove these generics +help: remove the unnecessary generics | LL - trait Trait: Copy {} LL + trait Trait: Copy {} @@ -42,7 +42,7 @@ LL | trait Trait: Copy {} | ^^^^ expected 0 generic arguments | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove these generics +help: remove the unnecessary generics | LL - trait Trait: Copy {} LL + trait Trait: Copy {} @@ -54,7 +54,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie LL | struct MyStruct1>(T); | ^^^^ expected 0 generic arguments | -help: remove these generics +help: remove the unnecessary generics | LL - struct MyStruct1>(T); LL + struct MyStruct1(T); @@ -66,7 +66,7 @@ error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was suppl LL | struct MyStruct2<'a, T: Copy<'a>>(&'a T); | ^^^^ expected 0 lifetime arguments | -help: remove these generics +help: remove the unnecessary generics | LL - struct MyStruct2<'a, T: Copy<'a>>(&'a T); LL + struct MyStruct2<'a, T: Copy>(&'a T); @@ -78,7 +78,7 @@ error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was suppl LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} | ^^^^ expected 0 lifetime arguments | -help: remove this lifetime argument +help: remove the lifetime argument | LL - fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} LL + fn foo2<'a, T:Copy<, U>, U>(x: T) {} @@ -90,7 +90,7 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} | ^^^^ expected 0 generic arguments | -help: remove this generic argument +help: remove the unnecessary generic argument | LL - fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} LL + fn foo2<'a, T:Copy<'a, >, U>(x: T) {} diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr index 65f07bb08320d..83679f4b1f6bd 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr @@ -9,7 +9,7 @@ note: struct defined here, with 1 generic parameter: `T` | LL | struct Foo<'a, T:'a> { | ^^^ - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - let c: Foo<_, _> = Foo { r: &5 }; LL + let c: Foo<_, > = Foo { r: &5 }; diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr index b07cc225ba875..8d519600edcd9 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr @@ -9,7 +9,7 @@ note: struct defined here, with 1 generic parameter: `T` | LL | struct Foo<'a, T:'a> { | ^^^ - -help: remove this generic argument +help: remove the unnecessary generic argument | LL - let c: Foo<_, usize> = Foo { r: &5 }; LL + let c: Foo<_, > = Foo { r: &5 }; diff --git a/tests/ui/ufcs/ufcs-qpath-missing-params.stderr b/tests/ui/ufcs/ufcs-qpath-missing-params.stderr index 0ae92d204b6fb..e7e576d7c6630 100644 --- a/tests/ui/ufcs/ufcs-qpath-missing-params.stderr +++ b/tests/ui/ufcs/ufcs-qpath-missing-params.stderr @@ -41,7 +41,7 @@ note: method defined here, with 0 generic parameters | LL | fn into_cow(self) -> Cow<'a, B>; | ^^^^^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - ::into_cow::("foo".to_string()); LL + ::into_cow("foo".to_string()); diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr index ac56d1d05fae5..5090097328269 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr @@ -9,7 +9,7 @@ note: trait defined here, with 0 generic parameters | LL | trait Zero { fn dummy(&self); } | ^^^^ -help: remove these parenthetical generics +help: remove the unnecessary parenthetical generics | LL - fn foo1(_: &dyn Zero()) { LL + fn foo1(_: &dyn Zero) { @@ -32,7 +32,7 @@ note: trait defined here, with 0 generic parameters | LL | trait Zero { fn dummy(&self); } | ^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - fn foo2(_: &dyn Zero) { LL + fn foo2(_: &dyn Zero) { @@ -49,7 +49,7 @@ note: trait defined here, with 0 generic parameters | LL | trait Zero { fn dummy(&self); } | ^^^^ -help: remove these generics +help: remove the unnecessary generics | LL - fn foo3(_: &dyn Zero < usize >) { LL + fn foo3(_: &dyn Zero) { @@ -66,7 +66,7 @@ note: trait defined here, with 0 generic parameters | LL | trait Zero { fn dummy(&self); } | ^^^^ -help: remove these parenthetical generics +help: remove the unnecessary parenthetical generics | LL - fn foo4(_: &dyn Zero(usize)) { LL + fn foo4(_: &dyn Zero) { @@ -89,7 +89,7 @@ note: trait defined here, with 0 generic parameters | LL | trait Zero { fn dummy(&self); } | ^^^^ -help: remove these parenthetical generics +help: remove the unnecessary parenthetical generics | LL - fn foo5(_: &dyn Zero ( usize )) { LL + fn foo5(_: &dyn Zero) { diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr index 3736f25a51ff9..aecfe502cf98b 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr @@ -9,7 +9,7 @@ note: trait defined here, with 0 generic parameters | LL | trait Trait {} | ^^^^^ -help: remove these parenthetical generics +help: remove the unnecessary parenthetical generics | LL - fn f isize>(x: F) {} LL + fn f isize>(x: F) {} From b30fdec5fb283641fc0452fa6ca60193a16bb30d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Fri, 5 Jul 2024 17:24:23 +0000 Subject: [PATCH 07/18] On generic and lifetime removal suggestion, do not leave behind stray `,` --- .../errors/wrong_number_of_generic_args.rs | 26 +++++++++----- tests/rustdoc-ui/mismatched_arg_count.stderr | 2 +- .../transmutable-ice-110969.stderr | 2 +- .../generic_arg_infer/infer-arg-test.stderr | 2 +- .../const_kind_expr/issue_114151.stderr | 2 +- .../incorrect-number-of-const-args.stderr | 2 +- .../invalid-constant-in-args.stderr | 2 +- tests/ui/constructor-lifetime-args.stderr | 4 +-- tests/ui/error-codes/E0107.stderr | 12 +++---- .../parameter_number_and_kind.stderr | 4 +-- .../generics/bad-mid-path-type-params.stderr | 6 ++-- .../generics/foreign-generic-mismatch.stderr | 2 +- .../generic-arg-mismatch-recover.stderr | 4 +-- ...eric-impl-more-params-with-defaults.stderr | 2 +- ...eric-type-more-params-with-defaults.stderr | 2 +- tests/ui/generics/wrong-number-of-args.stderr | 36 +++++++++---------- .../explicit-generic-args-for-impl.stderr | 2 +- .../mismatched_arg_count.stderr | 2 +- .../ui/lifetimes/noisy-follow-up-erro.stderr | 2 +- .../method-call-lifetime-args-fail.stderr | 4 +-- ...assoc-type-suggestion-in-trait-impl.stderr | 2 +- tests/ui/traits/object/vs-lifetime.stderr | 2 +- tests/ui/traits/test-2.stderr | 2 +- .../ui/transmutability/issue-101739-2.stderr | 3 +- .../typeck_type_placeholder_lifetime_1.stderr | 2 +- .../typeck_type_placeholder_lifetime_2.stderr | 2 +- 26 files changed, 71 insertions(+), 62 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs index 6c2ec1acdf96c..7443070b9deee 100644 --- a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs +++ b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs @@ -939,17 +939,20 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { } } - let span_lo_redundant_lt_args = lt_arg_spans[self.num_expected_lifetime_args()]; + let span_lo_redundant_lt_args = if self.num_expected_lifetime_args() == 0 { + lt_arg_spans[0] + } else { + lt_arg_spans[self.num_expected_lifetime_args() - 1] + }; let span_hi_redundant_lt_args = lt_arg_spans[lt_arg_spans.len() - 1]; - let span_redundant_lt_args = span_lo_redundant_lt_args.to(span_hi_redundant_lt_args); + let span_redundant_lt_args = + span_lo_redundant_lt_args.shrink_to_hi().to(span_hi_redundant_lt_args); debug!("span_redundant_lt_args: {:?}", span_redundant_lt_args); let num_redundant_lt_args = lt_arg_spans.len() - self.num_expected_lifetime_args(); - let msg_lifetimes = format!( - "remove the lifetime argument{s}", - s = pluralize!(num_redundant_lt_args), - ); + let msg_lifetimes = + format!("remove the lifetime argument{s}", s = pluralize!(num_redundant_lt_args)); err.span_suggestion_verbose( span_redundant_lt_args, @@ -978,11 +981,16 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { } let span_lo_redundant_type_or_const_args = - gen_arg_spans[self.num_expected_type_or_const_args()]; + if self.num_expected_type_or_const_args() == 0 { + gen_arg_spans[0] + } else { + gen_arg_spans[self.num_expected_type_or_const_args() - 1] + }; let span_hi_redundant_type_or_const_args = gen_arg_spans[gen_arg_spans.len() - 1]; + let span_redundant_type_or_const_args = span_lo_redundant_type_or_const_args + .shrink_to_hi() + .to(span_hi_redundant_type_or_const_args); - let span_redundant_type_or_const_args = - span_lo_redundant_type_or_const_args.to(span_hi_redundant_type_or_const_args); debug!("span_redundant_type_or_const_args: {:?}", span_redundant_type_or_const_args); let num_redundant_gen_args = diff --git a/tests/rustdoc-ui/mismatched_arg_count.stderr b/tests/rustdoc-ui/mismatched_arg_count.stderr index 8e7def04f527d..9a698d8f5ad63 100644 --- a/tests/rustdoc-ui/mismatched_arg_count.stderr +++ b/tests/rustdoc-ui/mismatched_arg_count.stderr @@ -12,7 +12,7 @@ LL | type Alias<'a, T> = >::Assoc; help: remove the lifetime argument | LL - fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} -LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, , T>) {} +LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, T>) {} | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr index 3f32b0eb6746d..ceac2c95bfae1 100644 --- a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr +++ b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr @@ -7,7 +7,7 @@ LL | Dst: BikeshedIntrinsicFrom, help: remove the unnecessary generic argument | LL - Dst: BikeshedIntrinsicFrom, -LL + Dst: BikeshedIntrinsicFrom, +LL + Dst: BikeshedIntrinsicFrom, | error[E0308]: mismatched types diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr index d8e794a7a6523..61688f3acab66 100644 --- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr +++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr @@ -33,7 +33,7 @@ LL | struct All<'a, T, const N: usize> { help: remove the unnecessary generic argument | LL - let a: All<_, _, _>; -LL + let a: All<_, _, >; +LL + let a: All<_, _>; | error: aborting due to 4 previous errors 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 a7232ef780e30..c66f351ea7f08 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 @@ -12,7 +12,7 @@ LL | fn foo( help: remove the unnecessary generic argument | LL - foo::<_, L>([(); L + 1 + L]); -LL + foo::<_, >([(); L + 1 + L]); +LL + foo::<_>([(); L + 1 + L]); | error[E0308]: mismatched types diff --git a/tests/ui/const-generics/incorrect-number-of-const-args.stderr b/tests/ui/const-generics/incorrect-number-of-const-args.stderr index 05c4a0a1a727c..f670ebc8ab0bb 100644 --- a/tests/ui/const-generics/incorrect-number-of-const-args.stderr +++ b/tests/ui/const-generics/incorrect-number-of-const-args.stderr @@ -30,7 +30,7 @@ LL | fn foo() -> usize { help: remove the unnecessary generic argument | LL - foo::<0, 0, 0>(); -LL + foo::<0, 0, >(); +LL + foo::<0, 0>(); | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/invalid-constant-in-args.stderr b/tests/ui/const-generics/invalid-constant-in-args.stderr index 10334e0d896c7..c3a3f251d4677 100644 --- a/tests/ui/const-generics/invalid-constant-in-args.stderr +++ b/tests/ui/const-generics/invalid-constant-in-args.stderr @@ -7,7 +7,7 @@ LL | let _: Cell<&str, "a"> = Cell::new(""); help: remove the unnecessary generic argument | LL - let _: Cell<&str, "a"> = Cell::new(""); -LL + let _: Cell<&str, > = Cell::new(""); +LL + let _: Cell<&str> = Cell::new(""); | error: aborting due to 1 previous error diff --git a/tests/ui/constructor-lifetime-args.stderr b/tests/ui/constructor-lifetime-args.stderr index 37b13cd048fe9..980a812e3b4e5 100644 --- a/tests/ui/constructor-lifetime-args.stderr +++ b/tests/ui/constructor-lifetime-args.stderr @@ -30,7 +30,7 @@ LL | struct S<'a, 'b>(&'a u8, &'b u8); help: remove the lifetime argument | LL - S::<'static, 'static, 'static>(&0, &0); -LL + S::<'static, 'static, >(&0, &0); +LL + S::<'static, 'static>(&0, &0); | error[E0107]: enum takes 2 lifetime arguments but 1 lifetime argument was supplied @@ -65,7 +65,7 @@ LL | enum E<'a, 'b> { help: remove the lifetime argument | LL - E::V::<'static, 'static, 'static>(&0); -LL + E::V::<'static, 'static, >(&0); +LL + E::V::<'static, 'static>(&0); | error: aborting due to 4 previous errors diff --git a/tests/ui/error-codes/E0107.stderr b/tests/ui/error-codes/E0107.stderr index d8bd96e0ad466..3271abd8a79b2 100644 --- a/tests/ui/error-codes/E0107.stderr +++ b/tests/ui/error-codes/E0107.stderr @@ -47,7 +47,7 @@ LL | struct Foo<'a>(&'a str); help: remove the lifetime arguments | LL - foo2: Foo<'a, 'b, 'c>, -LL + foo2: Foo<'a, >, +LL + foo2: Foo<'a>, | error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied @@ -64,7 +64,7 @@ LL | struct Qux<'a, T>(&'a T); help: remove the lifetime argument | LL - qux1: Qux<'a, 'b, i32>, -LL + qux1: Qux<'a, , i32>, +LL + qux1: Qux<'a, i32>, | error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied @@ -81,7 +81,7 @@ LL | struct Qux<'a, T>(&'a T); help: remove the lifetime argument | LL - qux2: Qux<'a, i32, 'b>, -LL + qux2: Qux<'a, i32, >, +LL + qux2: Qux<'a>, | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied @@ -98,7 +98,7 @@ LL | struct Qux<'a, T>(&'a T); help: remove the lifetime arguments | LL - qux3: Qux<'a, 'b, 'c, i32>, -LL + qux3: Qux<'a, , i32>, +LL + qux3: Qux<'a, i32>, | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied @@ -115,7 +115,7 @@ LL | struct Qux<'a, T>(&'a T); help: remove the lifetime arguments | LL - qux4: Qux<'a, i32, 'b, 'c>, -LL + qux4: Qux<'a, i32, >, +LL + qux4: Qux<'a>, | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied @@ -132,7 +132,7 @@ LL | struct Qux<'a, T>(&'a T); help: remove the lifetime argument | LL - qux5: Qux<'a, 'b, i32, 'c>, -LL + qux5: Qux<'a, , i32, 'c>, +LL + qux5: Qux<'a, i32, 'c>, | error[E0107]: struct takes 0 lifetime arguments but 2 lifetime arguments were supplied diff --git a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr index 7b7f21b00c5ad..1c9351cb351ae 100644 --- a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr +++ b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr @@ -12,7 +12,7 @@ LL | type E<'a, T>; help: remove the lifetime argument | LL - type FErr1 = Self::E<'static, 'static>; -LL + type FErr1 = Self::E<'static, >; +LL + type FErr1 = Self::E<'static>; | error[E0107]: associated type takes 1 generic argument but 0 generic arguments were supplied @@ -45,7 +45,7 @@ LL | type E<'a, T>; help: remove the unnecessary generic argument | LL - type FErr2 = Self::E<'static, T, u32>; -LL + type FErr2 = Self::E<'static, T, >; +LL + type FErr2 = Self::E<'static, T>; | error: aborting due to 3 previous errors diff --git a/tests/ui/generics/bad-mid-path-type-params.stderr b/tests/ui/generics/bad-mid-path-type-params.stderr index ba1d48f1210b2..cff5464dce49b 100644 --- a/tests/ui/generics/bad-mid-path-type-params.stderr +++ b/tests/ui/generics/bad-mid-path-type-params.stderr @@ -12,7 +12,7 @@ LL | fn new(x: T, _: U) -> S { help: remove the unnecessary generic argument | LL - let _ = S::new::(1, 1.0); -LL + let _ = S::new::(1, 1.0); +LL + let _ = S::new::(1, 1.0); | error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied @@ -46,7 +46,7 @@ LL | fn new(x: T, y: U) -> Self; help: remove the unnecessary generic argument | LL - let _: S2 = Trait::new::(1, 1.0); -LL + let _: S2 = Trait::new::(1, 1.0); +LL + let _: S2 = Trait::new::(1, 1.0); | error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied @@ -80,7 +80,7 @@ LL | fn new(x: T, y: U) -> Self; help: remove the unnecessary generic argument | LL - let _: S2 = Trait::<'a,isize>::new::(1, 1.0); -LL + let _: S2 = Trait::<'a,isize>::new::(1, 1.0); +LL + let _: S2 = Trait::<'a,isize>::new::(1, 1.0); | error: aborting due to 5 previous errors diff --git a/tests/ui/generics/foreign-generic-mismatch.stderr b/tests/ui/generics/foreign-generic-mismatch.stderr index 740963aeec548..4cf76cde9203f 100644 --- a/tests/ui/generics/foreign-generic-mismatch.stderr +++ b/tests/ui/generics/foreign-generic-mismatch.stderr @@ -30,7 +30,7 @@ LL | pub fn lt_arg<'a: 'a>() {} help: remove the lifetime argument | LL - foreign_generic_mismatch::lt_arg::<'static, 'static>(); -LL + foreign_generic_mismatch::lt_arg::<'static, >(); +LL + foreign_generic_mismatch::lt_arg::<'static>(); | error: aborting due to 2 previous errors diff --git a/tests/ui/generics/generic-arg-mismatch-recover.stderr b/tests/ui/generics/generic-arg-mismatch-recover.stderr index e8c2a4665f3da..d2953e37c8ccd 100644 --- a/tests/ui/generics/generic-arg-mismatch-recover.stderr +++ b/tests/ui/generics/generic-arg-mismatch-recover.stderr @@ -12,7 +12,7 @@ LL | struct Foo<'a, T: 'a>(&'a T); help: remove the lifetime argument | LL - Foo::<'static, 'static, ()>(&0); -LL + Foo::<'static, , ()>(&0); +LL + Foo::<'static, ()>(&0); | error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied @@ -29,7 +29,7 @@ LL | struct Bar<'a>(&'a ()); help: remove the lifetime argument | LL - Bar::<'static, 'static, ()>(&()); -LL + Bar::<'static, , ()>(&()); +LL + Bar::<'static, ()>(&()); | error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied diff --git a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr index b0973c477ff4c..a180e348a686b 100644 --- a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr +++ b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr @@ -12,7 +12,7 @@ LL | struct Vec( help: remove the unnecessary generic argument | LL - Vec::::new(); -LL + Vec::::new(); +LL + Vec::::new(); | error: aborting due to 1 previous error diff --git a/tests/ui/generics/generic-type-more-params-with-defaults.stderr b/tests/ui/generics/generic-type-more-params-with-defaults.stderr index e83a433b0605d..9b73b7375d795 100644 --- a/tests/ui/generics/generic-type-more-params-with-defaults.stderr +++ b/tests/ui/generics/generic-type-more-params-with-defaults.stderr @@ -12,7 +12,7 @@ LL | struct Vec( help: remove the unnecessary generic argument | LL - let _: Vec; -LL + let _: Vec; +LL + let _: Vec; | error: aborting due to 1 previous error diff --git a/tests/ui/generics/wrong-number-of-args.stderr b/tests/ui/generics/wrong-number-of-args.stderr index 1363032ad142f..17503b86e19cd 100644 --- a/tests/ui/generics/wrong-number-of-args.stderr +++ b/tests/ui/generics/wrong-number-of-args.stderr @@ -249,7 +249,7 @@ LL | struct Ty; help: remove the unnecessary generic arguments | LL - type D = Ty<'static, usize, { 0 }>; -LL + type D = Ty<'static, >; +LL + type D = Ty<'static, usize>; | error[E0107]: missing generics for struct `type_and_type::Ty` @@ -300,7 +300,7 @@ LL | struct Ty(A, B); help: remove the unnecessary generic argument | LL - type D = Ty; -LL + type D = Ty; +LL + type D = Ty; | error[E0107]: struct takes 2 generic arguments but 0 generic arguments were supplied @@ -381,7 +381,7 @@ LL | struct Ty<'a, T>(&'a T); help: remove the lifetime argument | LL - type F = Ty<'static, usize, 'static, usize>; -LL + type F = Ty<'static, usize, , usize>; +LL + type F = Ty<'static, usize>; | error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied @@ -398,7 +398,7 @@ LL | struct Ty<'a, T>(&'a T); help: remove the unnecessary generic argument | LL - type F = Ty<'static, usize, 'static, usize>; -LL + type F = Ty<'static, usize, 'static, >; +LL + type F = Ty<'static, usize>; | error[E0107]: missing generics for struct `type_and_type_and_type::Ty` @@ -449,7 +449,7 @@ LL | struct Ty(A, B, C); help: remove the unnecessary generic argument | LL - type E = Ty; -LL + type E = Ty; +LL + type E = Ty; | error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied @@ -499,7 +499,7 @@ LL | trait GenericLifetime<'a> { help: remove the lifetime argument | LL - type C = Box>; -LL + type C = Box>; +LL + type C = Box>; | error[E0107]: missing generics for trait `GenericType` @@ -532,7 +532,7 @@ LL | trait GenericType { help: remove the unnecessary generic argument | LL - type E = Box>; -LL + type E = Box>; +LL + type E = Box>; | error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied @@ -582,7 +582,7 @@ LL | trait GenericLifetimeAT<'a> { help: remove the lifetime argument | LL - type B = Box>; -LL + type B = Box>; +LL + type B = Box>; | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied @@ -632,7 +632,7 @@ LL | trait GenericTypeAT { help: remove the unnecessary generic argument | LL - type B = Box>; -LL + type B = Box>; +LL + type B = Box>; | error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied @@ -714,7 +714,7 @@ LL | trait GenericLifetimeTypeAT<'a, A> { help: remove the lifetime argument | LL - type C = Box>; -LL + type C = Box>; +LL + type C = Box>; | error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied @@ -747,7 +747,7 @@ LL | trait GenericLifetimeTypeAT<'a, A> { help: remove the unnecessary generic argument | LL - type E = Box>; -LL + type E = Box>; +LL + type E = Box>; | error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied @@ -764,7 +764,7 @@ LL | trait GenericLifetimeTypeAT<'a, A> { help: remove the lifetime argument | LL - type F = Box>; -LL + type F = Box>; +LL + type F = Box>; | error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied @@ -781,7 +781,7 @@ LL | trait GenericLifetimeTypeAT<'a, A> { help: remove the unnecessary generic argument | LL - type G = Box>; -LL + type G = Box>; +LL + type G = Box>; | error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied @@ -798,7 +798,7 @@ LL | trait GenericLifetimeTypeAT<'a, A> { help: remove the lifetime argument | LL - type H = Box>; -LL + type H = Box>; +LL + type H = Box>; | error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied @@ -815,7 +815,7 @@ LL | trait GenericLifetimeTypeAT<'a, A> { help: remove the unnecessary generic argument | LL - type H = Box>; -LL + type H = Box>; +LL + type H = Box>; | error[E0107]: trait takes 2 generic arguments but 0 generic arguments were supplied @@ -866,7 +866,7 @@ LL | trait GenericTypeTypeAT { help: remove the unnecessary generic argument | LL - type C = Box>; -LL + type C = Box>; +LL + type C = Box>; | error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied @@ -1011,7 +1011,7 @@ LL | type D = HashMap; help: remove the unnecessary generic argument | LL - type D = HashMap; -LL + type D = HashMap; +LL + type D = HashMap; | error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied @@ -1081,7 +1081,7 @@ LL | type D = Result; help: remove the unnecessary generic argument | LL - type D = Result; -LL + type D = Result; +LL + type D = Result; | error[E0107]: enum takes 2 generic arguments but 0 generic arguments were supplied diff --git a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr index 1c22e77e8171b..e225d7076b8cf 100644 --- a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr +++ b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr @@ -13,7 +13,7 @@ LL | fn foo(_f: impl AsRef) {} help: remove the unnecessary generic argument | LL - foo::("".to_string()); -LL + foo::("".to_string()); +LL + foo::("".to_string()); | error: aborting due to 1 previous error diff --git a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr index 02dbfca15a4a2..c0a5b62a56a2b 100644 --- a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr +++ b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr @@ -12,7 +12,7 @@ LL | type Alias<'a, T> = >::Assoc; help: remove the lifetime argument | LL - fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} -LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, , T>) {} +LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, T>) {} | error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/noisy-follow-up-erro.stderr b/tests/ui/lifetimes/noisy-follow-up-erro.stderr index 90dfc88e19f0d..3c2d0df683a94 100644 --- a/tests/ui/lifetimes/noisy-follow-up-erro.stderr +++ b/tests/ui/lifetimes/noisy-follow-up-erro.stderr @@ -12,7 +12,7 @@ LL | struct Foo<'c, 'd>(&'c (), &'d ()); help: remove the lifetime argument | LL - fn boom(&self, foo: &mut Foo<'_, '_, 'a>) -> Result<(), &'a ()> { -LL + fn boom(&self, foo: &mut Foo<'_, '_, >) -> Result<(), &'a ()> { +LL + fn boom(&self, foo: &mut Foo<'_, '_>) -> Result<(), &'a ()> { | error[E0621]: explicit lifetime required in the type of `foo` diff --git a/tests/ui/methods/method-call-lifetime-args-fail.stderr b/tests/ui/methods/method-call-lifetime-args-fail.stderr index 60ef1060aaca5..2eda01fa20c38 100644 --- a/tests/ui/methods/method-call-lifetime-args-fail.stderr +++ b/tests/ui/methods/method-call-lifetime-args-fail.stderr @@ -30,7 +30,7 @@ LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } help: remove the lifetime argument | LL - S.early::<'static, 'static, 'static>(); -LL + S.early::<'static, 'static, >(); +LL + S.early::<'static, 'static>(); | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present @@ -233,7 +233,7 @@ LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } help: remove the lifetime argument | LL - S::early::<'static, 'static, 'static>(S); -LL + S::early::<'static, 'static, >(S); +LL + S::early::<'static, 'static>(S); | error: aborting due to 18 previous errors diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr index 5a54ca181ce63..d25192b3d6d86 100644 --- a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr +++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr @@ -127,7 +127,7 @@ LL | struct Struct> { help: remove the unnecessary generic argument | LL - impl, U> YetAnotherTrait for Struct {} -LL + impl, U> YetAnotherTrait for Struct {} +LL + impl, U> YetAnotherTrait for Struct {} | error: aborting due to 9 previous errors diff --git a/tests/ui/traits/object/vs-lifetime.stderr b/tests/ui/traits/object/vs-lifetime.stderr index e02c750055bc8..889e1e82876aa 100644 --- a/tests/ui/traits/object/vs-lifetime.stderr +++ b/tests/ui/traits/object/vs-lifetime.stderr @@ -18,7 +18,7 @@ LL | struct S<'a, T>(&'a u8, T); help: remove the lifetime argument | LL - let _: S<'static, 'static>; -LL + let _: S<'static, >; +LL + let _: S<'static>; | error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied diff --git a/tests/ui/traits/test-2.stderr b/tests/ui/traits/test-2.stderr index d1a003aa3f422..d64497309ef93 100644 --- a/tests/ui/traits/test-2.stderr +++ b/tests/ui/traits/test-2.stderr @@ -29,7 +29,7 @@ LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } help: remove the unnecessary generic argument | LL - 10.blah::(); -LL + 10.blah::(); +LL + 10.blah::(); | error[E0038]: the trait `bar` cannot be made into an object diff --git a/tests/ui/transmutability/issue-101739-2.stderr b/tests/ui/transmutability/issue-101739-2.stderr index 1f640f21ad171..dabb51ee7aef8 100644 --- a/tests/ui/transmutability/issue-101739-2.stderr +++ b/tests/ui/transmutability/issue-101739-2.stderr @@ -6,10 +6,11 @@ LL | Dst: BikeshedIntrinsicFrom< | help: remove the unnecessary generic arguments | +LL - ASSUME_ALIGNMENT, LL - ASSUME_LIFETIMES, LL - ASSUME_VALIDITY, LL - ASSUME_VISIBILITY, -LL + , +LL + ASSUME_ALIGNMENT, | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr index 83679f4b1f6bd..116dd18664591 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr @@ -12,7 +12,7 @@ LL | struct Foo<'a, T:'a> { help: remove the unnecessary generic argument | LL - let c: Foo<_, _> = Foo { r: &5 }; -LL + let c: Foo<_, > = Foo { r: &5 }; +LL + let c: Foo<_> = Foo { r: &5 }; | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr index 8d519600edcd9..d2734f4acc892 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr @@ -12,7 +12,7 @@ LL | struct Foo<'a, T:'a> { help: remove the unnecessary generic argument | LL - let c: Foo<_, usize> = Foo { r: &5 }; -LL + let c: Foo<_, > = Foo { r: &5 }; +LL + let c: Foo<_> = Foo { r: &5 }; | error: aborting due to 1 previous error From 921de9d8eae16947c375febe0ab8709797b37119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 22 Jul 2024 22:51:53 +0000 Subject: [PATCH 08/18] Revert suggestion verbosity change --- .../errors/wrong_number_of_generic_args.rs | 6 +- .../invalid_const_in_lifetime_position.stderr | 27 +- tests/rustdoc-ui/mismatched_arg_count.stderr | 9 +- .../argument-suggestions/issue-100154.stderr | 9 +- ...ssue-82126-mismatched-subst-and-hir.stderr | 18 +- .../transmutable-ice-110969.stderr | 10 +- .../generic_arg_infer/infer-arg-test.stderr | 9 +- .../const_kind_expr/issue_114151.stderr | 9 +- .../generic_const_exprs/issue-102768.stderr | 27 +- .../incorrect-number-of-const-args.stderr | 9 +- .../invalid-const-arg-for-type-param.stderr | 9 +- .../invalid-constant-in-args.stderr | 10 +- tests/ui/constructor-lifetime-args.stderr | 18 +- tests/ui/consts/effect_param.stderr | 40 +-- tests/ui/error-codes/E0107.stderr | 72 ++--- .../gat-trait-path-parenthesised-args.stderr | 27 +- .../parameter_number_and_kind.stderr | 18 +- ...it-path-type-error-once-implemented.stderr | 27 +- .../generics/bad-mid-path-type-params.stderr | 45 +-- .../generics/foreign-generic-mismatch.stderr | 9 +- .../generic-arg-mismatch-recover.stderr | 27 +- ...eric-impl-more-params-with-defaults.stderr | 9 +- ...eric-type-more-params-with-defaults.stderr | 9 +- tests/ui/generics/wrong-number-of-args.stderr | 256 ++++++------------ .../explicit-generic-args-for-impl.stderr | 9 +- .../opaque-and-lifetime-mismatch.stderr | 27 +- tests/ui/issues/issue-18423.stderr | 10 +- tests/ui/issues/issue-53251.stderr | 18 +- tests/ui/issues/issue-60622.stderr | 9 +- .../mismatched_arg_count.stderr | 9 +- .../ui/lifetimes/noisy-follow-up-erro.stderr | 9 +- .../method-call-lifetime-args-fail.stderr | 18 +- tests/ui/resolve/issue-3214.stderr | 9 +- ...o-explicit-const-params-cross-crate.stderr | 18 +- .../effects/no-explicit-const-params.stderr | 18 +- tests/ui/seq-args.stderr | 18 +- .../struct-path-associated-type.stderr | 18 +- ...structure-constructor-type-mismatch.stderr | 18 +- tests/ui/suggestions/issue-101421.stderr | 9 +- tests/ui/suggestions/issue-104287.stderr | 9 +- tests/ui/suggestions/issue-89064.stderr | 9 +- ...assoc-type-suggestion-in-trait-impl.stderr | 9 +- tests/ui/traits/object/vs-lifetime.stderr | 9 +- tests/ui/traits/test-2.stderr | 18 +- .../ui/transmutability/issue-101739-2.stderr | 20 +- .../enum-variant-generic-args.stderr | 54 ++-- ...ypeck-builtin-bound-type-parameters.stderr | 78 ++---- .../typeck_type_placeholder_lifetime_1.stderr | 9 +- .../typeck_type_placeholder_lifetime_2.stderr | 9 +- .../ui/ufcs/ufcs-qpath-missing-params.stderr | 9 +- ...wrong-number-number-type-parameters.stderr | 45 +-- .../unboxed-closure-sugar-wrong-trait.stderr | 9 +- 52 files changed, 402 insertions(+), 811 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs index 7443070b9deee..db91a6ab2f491 100644 --- a/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs +++ b/compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs @@ -954,7 +954,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { let msg_lifetimes = format!("remove the lifetime argument{s}", s = pluralize!(num_redundant_lt_args)); - err.span_suggestion_verbose( + err.span_suggestion( span_redundant_lt_args, msg_lifetimes, "", @@ -1000,7 +1000,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { s = pluralize!(num_redundant_gen_args), ); - err.span_suggestion_verbose( + err.span_suggestion( span_redundant_type_or_const_args, msg_types_or_consts, "", @@ -1050,7 +1050,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { }, ); - err.span_suggestion_verbose(span, msg, "", Applicability::MaybeIncorrect); + err.span_suggestion(span, msg, "", Applicability::MaybeIncorrect); } else if redundant_lifetime_args && redundant_type_or_const_args { remove_lifetime_args(err); remove_type_or_const_args(err); diff --git a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr index 755a0bba508f1..ef551cbea3e6a 100644 --- a/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr +++ b/tests/rustdoc-ui/invalid_const_in_lifetime_position.stderr @@ -18,18 +18,15 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/invalid_const_in_lifetime_position.rs:4:26 | LL | fn f<'a>(arg : Box = &'a ()>>) {} - | ^ expected 0 generic arguments + | ^--- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/invalid_const_in_lifetime_position.rs:2:10 | LL | type Y<'a>; | ^ -help: remove the unnecessary generics - | -LL - fn f<'a>(arg : Box = &'a ()>>) {} -LL + fn f<'a>(arg : Box>) {} - | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/invalid_const_in_lifetime_position.rs:4:26 @@ -52,7 +49,9 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/invalid_const_in_lifetime_position.rs:4:26 | LL | fn f<'a>(arg : Box = &'a ()>>) {} - | ^ expected 0 generic arguments + | ^--- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/invalid_const_in_lifetime_position.rs:2:10 @@ -60,11 +59,6 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove the unnecessary generics - | -LL - fn f<'a>(arg : Box = &'a ()>>) {} -LL + fn f<'a>(arg : Box>) {} - | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/invalid_const_in_lifetime_position.rs:4:26 @@ -87,7 +81,9 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/invalid_const_in_lifetime_position.rs:4:26 | LL | fn f<'a>(arg : Box = &'a ()>>) {} - | ^ expected 0 generic arguments + | ^--- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/invalid_const_in_lifetime_position.rs:2:10 @@ -95,11 +91,6 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove the unnecessary generics - | -LL - fn f<'a>(arg : Box = &'a ()>>) {} -LL + fn f<'a>(arg : Box>) {} - | error[E0038]: the trait `X` cannot be made into an object --> $DIR/invalid_const_in_lifetime_position.rs:4:20 diff --git a/tests/rustdoc-ui/mismatched_arg_count.stderr b/tests/rustdoc-ui/mismatched_arg_count.stderr index 9a698d8f5ad63..5daeef2eb18fe 100644 --- a/tests/rustdoc-ui/mismatched_arg_count.stderr +++ b/tests/rustdoc-ui/mismatched_arg_count.stderr @@ -2,18 +2,15 @@ error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were --> $DIR/mismatched_arg_count.rs:7:29 | LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} - | ^^^^^ expected 1 lifetime argument + | ^^^^^ ---- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: type alias defined here, with 1 lifetime parameter: `'a` --> $DIR/mismatched_arg_count.rs:5:6 | LL | type Alias<'a, T> = >::Assoc; | ^^^^^ -- -help: remove the lifetime argument - | -LL - fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} -LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, T>) {} - | error: aborting due to 1 previous error diff --git a/tests/ui/argument-suggestions/issue-100154.stderr b/tests/ui/argument-suggestions/issue-100154.stderr index 8a650099b8181..7eaebcafb5957 100644 --- a/tests/ui/argument-suggestions/issue-100154.stderr +++ b/tests/ui/argument-suggestions/issue-100154.stderr @@ -2,7 +2,9 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/issue-100154.rs:4:5 | LL | foo::<()>(()); - | ^^^ expected 0 generic arguments + | ^^^------ help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/issue-100154.rs:1:4 @@ -10,11 +12,6 @@ note: function defined here, with 0 generic parameters LL | fn foo(i: impl std::fmt::Display) {} | ^^^ = note: `impl Trait` cannot be explicitly specified as a generic argument -help: remove the unnecessary generics - | -LL - foo::<()>(()); -LL + foo(()); - | error[E0277]: `()` doesn't implement `std::fmt::Display` --> $DIR/issue-100154.rs:4:11 diff --git a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr index aaca4dc91c935..e9efc932ea8a5 100644 --- a/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr +++ b/tests/ui/borrowck/issue-82126-mismatched-subst-and-hir.stderr @@ -2,18 +2,15 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 | LL | async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { - | ^^^^^^^^^^^^ expected 0 lifetime arguments + | ^^^^^^^^^^^^---- help: remove the unnecessary generics + | | + | expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/issue-82126-mismatched-subst-and-hir.rs:24:8 | LL | struct LockedMarket(T); | ^^^^^^^^^^^^ -help: remove the unnecessary generics - | -LL - async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { -LL + async fn buy_lock(coroutine: &Mutex) -> LockedMarket { - | error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 @@ -35,7 +32,9 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 | LL | async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { - | ^^^^^^^^^^^^ expected 0 lifetime arguments + | ^^^^^^^^^^^^---- help: remove the unnecessary generics + | | + | expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/issue-82126-mismatched-subst-and-hir.rs:24:8 @@ -43,11 +42,6 @@ note: struct defined here, with 0 lifetime parameters LL | struct LockedMarket(T); | ^^^^^^^^^^^^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove the unnecessary generics - | -LL - async fn buy_lock(coroutine: &Mutex) -> LockedMarket<'_> { -LL + async fn buy_lock(coroutine: &Mutex) -> LockedMarket { - | error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/issue-82126-mismatched-subst-and-hir.rs:16:59 diff --git a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr index ceac2c95bfae1..5c04c4c9d5b52 100644 --- a/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr +++ b/tests/ui/const-generics/adt_const_params/transmutable-ice-110969.stderr @@ -2,13 +2,9 @@ error[E0107]: trait takes at most 2 generic arguments but 3 generic arguments we --> $DIR/transmutable-ice-110969.rs:11:14 | LL | Dst: BikeshedIntrinsicFrom, - | ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments - | -help: remove the unnecessary generic argument - | -LL - Dst: BikeshedIntrinsicFrom, -LL + Dst: BikeshedIntrinsicFrom, - | + | ^^^^^^^^^^^^^^^^^^^^^ -------- help: remove the unnecessary generic argument + | | + | expected at most 2 generic arguments error[E0308]: mismatched types --> $DIR/transmutable-ice-110969.rs:25:74 diff --git a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr index 61688f3acab66..a9c57dbf26a0e 100644 --- a/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr +++ b/tests/ui/const-generics/generic_arg_infer/infer-arg-test.stderr @@ -23,18 +23,15 @@ error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supp --> $DIR/infer-arg-test.rs:18:10 | LL | let a: All<_, _, _>; - | ^^^ expected 2 generic arguments + | ^^^ --- help: remove the unnecessary generic argument + | | + | expected 2 generic arguments | note: struct defined here, with 2 generic parameters: `T`, `N` --> $DIR/infer-arg-test.rs:3:8 | LL | struct All<'a, T, const N: usize> { | ^^^ - -------------- -help: remove the unnecessary generic argument - | -LL - let a: All<_, _, _>; -LL + let a: All<_, _>; - | error: aborting due to 4 previous errors 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 c66f351ea7f08..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 @@ -2,18 +2,15 @@ error[E0107]: function takes 1 generic argument but 2 generic arguments were sup --> $DIR/issue_114151.rs:17:5 | LL | foo::<_, L>([(); L + 1 + L]); - | ^^^ expected 1 generic argument + | ^^^ --- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: function defined here, with 1 generic parameter: `N` --> $DIR/issue_114151.rs:4:4 | LL | fn foo( | ^^^ -------------- -help: remove the unnecessary generic argument - | -LL - foo::<_, L>([(); L + 1 + L]); -LL + foo::<_>([(); L + 1 + L]); - | error[E0308]: mismatched types --> $DIR/issue_114151.rs:17:18 diff --git a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr index 4162191175228..37e09a075fe34 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr @@ -18,18 +18,15 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/issue-102768.rs:9:30 | LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^ expected 0 generic arguments + | ^--- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/issue-102768.rs:5:10 | LL | type Y<'a>; | ^ -help: remove the unnecessary generics - | -LL - fn f2<'a>(arg: Box = &'a ()>>) {} -LL + fn f2<'a>(arg: Box>) {} - | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/issue-102768.rs:9:30 @@ -52,7 +49,9 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/issue-102768.rs:9:30 | LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^ expected 0 generic arguments + | ^--- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/issue-102768.rs:5:10 @@ -60,11 +59,6 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove the unnecessary generics - | -LL - fn f2<'a>(arg: Box = &'a ()>>) {} -LL + fn f2<'a>(arg: Box>) {} - | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/issue-102768.rs:9:30 @@ -87,7 +81,9 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/issue-102768.rs:9:30 | LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^ expected 0 generic arguments + | ^--- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/issue-102768.rs:5:10 @@ -95,11 +91,6 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove the unnecessary generics - | -LL - fn f2<'a>(arg: Box = &'a ()>>) {} -LL + fn f2<'a>(arg: Box>) {} - | error[E0038]: the trait `X` cannot be made into an object --> $DIR/issue-102768.rs:9:24 diff --git a/tests/ui/const-generics/incorrect-number-of-const-args.stderr b/tests/ui/const-generics/incorrect-number-of-const-args.stderr index f670ebc8ab0bb..09c963c350efa 100644 --- a/tests/ui/const-generics/incorrect-number-of-const-args.stderr +++ b/tests/ui/const-generics/incorrect-number-of-const-args.stderr @@ -20,18 +20,15 @@ error[E0107]: function takes 2 generic arguments but 3 generic arguments were su --> $DIR/incorrect-number-of-const-args.rs:9:5 | LL | foo::<0, 0, 0>(); - | ^^^ expected 2 generic arguments + | ^^^ --- help: remove the unnecessary generic argument + | | + | expected 2 generic arguments | note: function defined here, with 2 generic parameters: `X`, `Y` --> $DIR/incorrect-number-of-const-args.rs:1:4 | LL | fn foo() -> usize { | ^^^ -------------- -------------- -help: remove the unnecessary generic argument - | -LL - foo::<0, 0, 0>(); -LL + foo::<0, 0>(); - | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr index dadb67343312f..4004ad1903258 100644 --- a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr +++ b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr @@ -27,18 +27,15 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/invalid-const-arg-for-type-param.rs:12:5 | LL | S::<0>; - | ^ expected 0 generic arguments + | ^----- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/invalid-const-arg-for-type-param.rs:3:8 | LL | struct S; | ^ -help: remove the unnecessary generics - | -LL - S::<0>; -LL + S; - | error: aborting due to 3 previous errors diff --git a/tests/ui/const-generics/invalid-constant-in-args.stderr b/tests/ui/const-generics/invalid-constant-in-args.stderr index c3a3f251d4677..3e1263e8e8c08 100644 --- a/tests/ui/const-generics/invalid-constant-in-args.stderr +++ b/tests/ui/const-generics/invalid-constant-in-args.stderr @@ -2,13 +2,9 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/invalid-constant-in-args.rs:4:12 | LL | let _: Cell<&str, "a"> = Cell::new(""); - | ^^^^ expected 1 generic argument - | -help: remove the unnecessary generic argument - | -LL - let _: Cell<&str, "a"> = Cell::new(""); -LL + let _: Cell<&str> = Cell::new(""); - | + | ^^^^ ----- help: remove the unnecessary generic argument + | | + | expected 1 generic argument error: aborting due to 1 previous error diff --git a/tests/ui/constructor-lifetime-args.stderr b/tests/ui/constructor-lifetime-args.stderr index 980a812e3b4e5..d3759f4b3658e 100644 --- a/tests/ui/constructor-lifetime-args.stderr +++ b/tests/ui/constructor-lifetime-args.stderr @@ -20,18 +20,15 @@ error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/constructor-lifetime-args.rs:19:5 | LL | S::<'static, 'static, 'static>(&0, &0); - | ^ expected 2 lifetime arguments + | ^ --------- help: remove the lifetime argument + | | + | expected 2 lifetime arguments | note: struct defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/constructor-lifetime-args.rs:9:8 | LL | struct S<'a, 'b>(&'a u8, &'b u8); | ^ -- -- -help: remove the lifetime argument - | -LL - S::<'static, 'static, 'static>(&0, &0); -LL + S::<'static, 'static>(&0, &0); - | error[E0107]: enum takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/constructor-lifetime-args.rs:22:8 @@ -55,18 +52,15 @@ error[E0107]: enum takes 2 lifetime arguments but 3 lifetime arguments were supp --> $DIR/constructor-lifetime-args.rs:24:8 | LL | E::V::<'static, 'static, 'static>(&0); - | ^ expected 2 lifetime arguments + | ^ --------- help: remove the lifetime argument + | | + | expected 2 lifetime arguments | note: enum defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/constructor-lifetime-args.rs:10:6 | LL | enum E<'a, 'b> { | ^ -- -- -help: remove the lifetime argument - | -LL - E::V::<'static, 'static, 'static>(&0); -LL + E::V::<'static, 'static>(&0); - | error: aborting due to 4 previous errors diff --git a/tests/ui/consts/effect_param.stderr b/tests/ui/consts/effect_param.stderr index fafc20b419240..c63be8035f30f 100644 --- a/tests/ui/consts/effect_param.stderr +++ b/tests/ui/consts/effect_param.stderr @@ -2,49 +2,33 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/effect_param.rs:11:9 | LL | i8::checked_sub::(42, 43); - | ^^^^^^^^^^^ expected 0 generic arguments - | -help: remove the unnecessary generics - | -LL - i8::checked_sub::(42, 43); -LL + i8::checked_sub(42, 43); - | + | ^^^^^^^^^^^--------- help: remove the unnecessary generics + | | + | expected 0 generic arguments error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/effect_param.rs:13:9 | LL | i8::checked_sub::(42, 43); - | ^^^^^^^^^^^ expected 0 generic arguments - | -help: remove the unnecessary generics - | -LL - i8::checked_sub::(42, 43); -LL + i8::checked_sub(42, 43); - | + | ^^^^^^^^^^^-------- help: remove the unnecessary generics + | | + | expected 0 generic arguments error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/effect_param.rs:4:9 | LL | i8::checked_sub::(42, 43); - | ^^^^^^^^^^^ expected 0 generic arguments - | -help: remove the unnecessary generics - | -LL - i8::checked_sub::(42, 43); -LL + i8::checked_sub(42, 43); - | + | ^^^^^^^^^^^-------- help: remove the unnecessary generics + | | + | expected 0 generic arguments error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/effect_param.rs:6:9 | LL | i8::checked_sub::(42, 43); - | ^^^^^^^^^^^ expected 0 generic arguments - | -help: remove the unnecessary generics - | -LL - i8::checked_sub::(42, 43); -LL + i8::checked_sub(42, 43); - | + | ^^^^^^^^^^^--------- help: remove the unnecessary generics + | | + | expected 0 generic arguments error: aborting due to 4 previous errors diff --git a/tests/ui/error-codes/E0107.stderr b/tests/ui/error-codes/E0107.stderr index 3271abd8a79b2..4aa83cf7f5ff4 100644 --- a/tests/ui/error-codes/E0107.stderr +++ b/tests/ui/error-codes/E0107.stderr @@ -20,137 +20,113 @@ error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was suppli --> $DIR/E0107.rs:17:10 | LL | bar: Bar<'a>, - | ^^^ expected 0 lifetime arguments + | ^^^---- help: remove the unnecessary generics + | | + | expected 0 lifetime arguments | note: enum defined here, with 0 lifetime parameters --> $DIR/E0107.rs:6:6 | LL | enum Bar { | ^^^ -help: remove the unnecessary generics - | -LL - bar: Bar<'a>, -LL + bar: Bar, - | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:21:11 | LL | foo2: Foo<'a, 'b, 'c>, - | ^^^ expected 1 lifetime argument + | ^^^ -------- help: remove the lifetime arguments + | | + | expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:1:8 | LL | struct Foo<'a>(&'a str); | ^^^ -- -help: remove the lifetime arguments - | -LL - foo2: Foo<'a, 'b, 'c>, -LL + foo2: Foo<'a>, - | error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/E0107.rs:25:11 | LL | qux1: Qux<'a, 'b, i32>, - | ^^^ expected 1 lifetime argument + | ^^^ ---- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- -help: remove the lifetime argument - | -LL - qux1: Qux<'a, 'b, i32>, -LL + qux1: Qux<'a, i32>, - | error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/E0107.rs:29:11 | LL | qux2: Qux<'a, i32, 'b>, - | ^^^ expected 1 lifetime argument + | ^^^ --------- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- -help: remove the lifetime argument - | -LL - qux2: Qux<'a, i32, 'b>, -LL + qux2: Qux<'a>, - | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:33:11 | LL | qux3: Qux<'a, 'b, 'c, i32>, - | ^^^ expected 1 lifetime argument + | ^^^ -------- help: remove the lifetime arguments + | | + | expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- -help: remove the lifetime arguments - | -LL - qux3: Qux<'a, 'b, 'c, i32>, -LL + qux3: Qux<'a, i32>, - | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:37:11 | LL | qux4: Qux<'a, i32, 'b, 'c>, - | ^^^ expected 1 lifetime argument + | ^^^ ------------- help: remove the lifetime arguments + | | + | expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- -help: remove the lifetime arguments - | -LL - qux4: Qux<'a, i32, 'b, 'c>, -LL + qux4: Qux<'a>, - | error[E0107]: struct takes 1 lifetime argument but 3 lifetime arguments were supplied --> $DIR/E0107.rs:41:11 | LL | qux5: Qux<'a, 'b, i32, 'c>, - | ^^^ expected 1 lifetime argument + | ^^^ ---- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/E0107.rs:3:8 | LL | struct Qux<'a, T>(&'a T); | ^^^ -- -help: remove the lifetime argument - | -LL - qux5: Qux<'a, 'b, i32, 'c>, -LL + qux5: Qux<'a, i32, 'c>, - | error[E0107]: struct takes 0 lifetime arguments but 2 lifetime arguments were supplied --> $DIR/E0107.rs:45:11 | LL | quux: Quux<'a, i32, 'b>, - | ^^^^ expected 0 lifetime arguments + | ^^^^ -- help: remove the lifetime argument + | | + | expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/E0107.rs:4:8 | LL | struct Quux(T); | ^^^^ -help: remove the lifetime argument - | -LL - quux: Quux<'a, i32, 'b>, -LL + quux: Quux<, i32, 'b>, - | error[E0107]: trait takes 0 generic arguments but 2 generic arguments were supplied --> $DIR/E0107.rs:55:27 diff --git a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr index 252d81fa6f35e..9d8e91c02ca37 100644 --- a/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr +++ b/tests/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr @@ -43,18 +43,15 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box>) {} - | ^ expected 0 generic arguments + | ^---- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 | LL | type Y<'a>; | ^ -help: remove the unnecessary generics - | -LL - fn foo<'a>(arg: Box>) {} -LL + fn foo<'a>(arg: Box>) {} - | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 @@ -77,7 +74,9 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box>) {} - | ^ expected 0 generic arguments + | ^---- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 @@ -85,11 +84,6 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove the unnecessary generics - | -LL - fn foo<'a>(arg: Box>) {} -LL + fn foo<'a>(arg: Box>) {} - | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 @@ -112,7 +106,9 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/gat-trait-path-parenthesised-args.rs:5:27 | LL | fn foo<'a>(arg: Box>) {} - | ^ expected 0 generic arguments + | ^---- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/gat-trait-path-parenthesised-args.rs:2:8 @@ -120,11 +116,6 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove the unnecessary generics - | -LL - fn foo<'a>(arg: Box>) {} -LL + fn foo<'a>(arg: Box>) {} - | error[E0224]: at least one trait is required for an object type --> $DIR/gat-trait-path-parenthesised-args.rs:5:29 diff --git a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr index 1c9351cb351ae..4a20cf55cae73 100644 --- a/tests/ui/generic-associated-types/parameter_number_and_kind.stderr +++ b/tests/ui/generic-associated-types/parameter_number_and_kind.stderr @@ -2,18 +2,15 @@ error[E0107]: associated type takes 1 lifetime argument but 2 lifetime arguments --> $DIR/parameter_number_and_kind.rs:11:24 | LL | type FErr1 = Self::E<'static, 'static>; - | ^ expected 1 lifetime argument + | ^ --------- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` --> $DIR/parameter_number_and_kind.rs:8:10 | LL | type E<'a, T>; | ^ -- -help: remove the lifetime argument - | -LL - type FErr1 = Self::E<'static, 'static>; -LL + type FErr1 = Self::E<'static>; - | error[E0107]: associated type takes 1 generic argument but 0 generic arguments were supplied --> $DIR/parameter_number_and_kind.rs:11:24 @@ -35,18 +32,15 @@ error[E0107]: associated type takes 1 generic argument but 2 generic arguments w --> $DIR/parameter_number_and_kind.rs:14:27 | LL | type FErr2 = Self::E<'static, T, u32>; - | ^ expected 1 generic argument + | ^ ----- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` --> $DIR/parameter_number_and_kind.rs:8:10 | LL | type E<'a, T>; | ^ - -help: remove the unnecessary generic argument - | -LL - type FErr2 = Self::E<'static, T, u32>; -LL + type FErr2 = Self::E<'static, T>; - | error: aborting due to 3 previous errors diff --git a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr index 6ea96b6228efa..539b6695e9e81 100644 --- a/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr +++ b/tests/ui/generic-associated-types/parse/trait-path-type-error-once-implemented.stderr @@ -18,18 +18,15 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | ^ expected 0 generic arguments + | ^--- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/trait-path-type-error-once-implemented.rs:2:10 | LL | type Y<'a>; | ^ -help: remove the unnecessary generics - | -LL - fn f2<'a>(arg : Box = &'a ()>>) {} -LL + fn f2<'a>(arg : Box>) {} - | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/trait-path-type-error-once-implemented.rs:6:29 @@ -52,7 +49,9 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | ^ expected 0 generic arguments + | ^--- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/trait-path-type-error-once-implemented.rs:2:10 @@ -60,11 +59,6 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove the unnecessary generics - | -LL - fn f2<'a>(arg : Box = &'a ()>>) {} -LL + fn f2<'a>(arg : Box>) {} - | error[E0107]: associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/trait-path-type-error-once-implemented.rs:6:29 @@ -87,7 +81,9 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/trait-path-type-error-once-implemented.rs:6:29 | LL | fn f2<'a>(arg : Box = &'a ()>>) {} - | ^ expected 0 generic arguments + | ^--- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/trait-path-type-error-once-implemented.rs:2:10 @@ -95,11 +91,6 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove the unnecessary generics - | -LL - fn f2<'a>(arg : Box = &'a ()>>) {} -LL + fn f2<'a>(arg : Box>) {} - | error[E0038]: the trait `X` cannot be made into an object --> $DIR/trait-path-type-error-once-implemented.rs:6:23 diff --git a/tests/ui/generics/bad-mid-path-type-params.stderr b/tests/ui/generics/bad-mid-path-type-params.stderr index cff5464dce49b..de3c0289fc6e8 100644 --- a/tests/ui/generics/bad-mid-path-type-params.stderr +++ b/tests/ui/generics/bad-mid-path-type-params.stderr @@ -2,86 +2,71 @@ error[E0107]: associated function takes 1 generic argument but 2 generic argumen --> $DIR/bad-mid-path-type-params.rs:30:16 | LL | let _ = S::new::(1, 1.0); - | ^^^ expected 1 generic argument + | ^^^ ---- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: associated function defined here, with 1 generic parameter: `U` --> $DIR/bad-mid-path-type-params.rs:6:8 | LL | fn new(x: T, _: U) -> S { | ^^^ - -help: remove the unnecessary generic argument - | -LL - let _ = S::new::(1, 1.0); -LL + let _ = S::new::(1, 1.0); - | error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/bad-mid-path-type-params.rs:33:13 | LL | let _ = S::<'a,isize>::new::(1, 1.0); - | ^ expected 0 lifetime arguments + | ^ -- help: remove the lifetime argument + | | + | expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/bad-mid-path-type-params.rs:1:8 | LL | struct S { | ^ -help: remove the lifetime argument - | -LL - let _ = S::<'a,isize>::new::(1, 1.0); -LL + let _ = S::<,isize>::new::(1, 1.0); - | error[E0107]: associated function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/bad-mid-path-type-params.rs:36:24 | LL | let _: S2 = Trait::new::(1, 1.0); - | ^^^ expected 1 generic argument + | ^^^ ---- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: associated function defined here, with 1 generic parameter: `U` --> $DIR/bad-mid-path-type-params.rs:14:8 | LL | fn new(x: T, y: U) -> Self; | ^^^ - -help: remove the unnecessary generic argument - | -LL - let _: S2 = Trait::new::(1, 1.0); -LL + let _: S2 = Trait::new::(1, 1.0); - | error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/bad-mid-path-type-params.rs:39:17 | LL | let _: S2 = Trait::<'a,isize>::new::(1, 1.0); - | ^^^^^ expected 0 lifetime arguments + | ^^^^^ -- help: remove the lifetime argument + | | + | expected 0 lifetime arguments | note: trait defined here, with 0 lifetime parameters --> $DIR/bad-mid-path-type-params.rs:13:7 | LL | trait Trait { | ^^^^^ -help: remove the lifetime argument - | -LL - let _: S2 = Trait::<'a,isize>::new::(1, 1.0); -LL + let _: S2 = Trait::<,isize>::new::(1, 1.0); - | error[E0107]: associated function takes 1 generic argument but 2 generic arguments were supplied --> $DIR/bad-mid-path-type-params.rs:39:36 | LL | let _: S2 = Trait::<'a,isize>::new::(1, 1.0); - | ^^^ expected 1 generic argument + | ^^^ ---- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: associated function defined here, with 1 generic parameter: `U` --> $DIR/bad-mid-path-type-params.rs:14:8 | LL | fn new(x: T, y: U) -> Self; | ^^^ - -help: remove the unnecessary generic argument - | -LL - let _: S2 = Trait::<'a,isize>::new::(1, 1.0); -LL + let _: S2 = Trait::<'a,isize>::new::(1, 1.0); - | error: aborting due to 5 previous errors diff --git a/tests/ui/generics/foreign-generic-mismatch.stderr b/tests/ui/generics/foreign-generic-mismatch.stderr index 4cf76cde9203f..32beac41b21b6 100644 --- a/tests/ui/generics/foreign-generic-mismatch.stderr +++ b/tests/ui/generics/foreign-generic-mismatch.stderr @@ -20,18 +20,15 @@ error[E0107]: function takes 1 lifetime argument but 2 lifetime arguments were s --> $DIR/foreign-generic-mismatch.rs:8:31 | LL | foreign_generic_mismatch::lt_arg::<'static, 'static>(); - | ^^^^^^ expected 1 lifetime argument + | ^^^^^^ --------- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: function defined here, with 1 lifetime parameter: `'a` --> $DIR/auxiliary/foreign-generic-mismatch.rs:3:8 | LL | pub fn lt_arg<'a: 'a>() {} | ^^^^^^ -- -help: remove the lifetime argument - | -LL - foreign_generic_mismatch::lt_arg::<'static, 'static>(); -LL + foreign_generic_mismatch::lt_arg::<'static>(); - | error: aborting due to 2 previous errors diff --git a/tests/ui/generics/generic-arg-mismatch-recover.stderr b/tests/ui/generics/generic-arg-mismatch-recover.stderr index d2953e37c8ccd..172683a8f9b30 100644 --- a/tests/ui/generics/generic-arg-mismatch-recover.stderr +++ b/tests/ui/generics/generic-arg-mismatch-recover.stderr @@ -2,52 +2,43 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/generic-arg-mismatch-recover.rs:6:5 | LL | Foo::<'static, 'static, ()>(&0); - | ^^^ expected 1 lifetime argument + | ^^^ --------- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/generic-arg-mismatch-recover.rs:1:8 | LL | struct Foo<'a, T: 'a>(&'a T); | ^^^ -- -help: remove the lifetime argument - | -LL - Foo::<'static, 'static, ()>(&0); -LL + Foo::<'static, ()>(&0); - | error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/generic-arg-mismatch-recover.rs:9:5 | LL | Bar::<'static, 'static, ()>(&()); - | ^^^ expected 1 lifetime argument + | ^^^ --------- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/generic-arg-mismatch-recover.rs:3:8 | LL | struct Bar<'a>(&'a ()); | ^^^ -- -help: remove the lifetime argument - | -LL - Bar::<'static, 'static, ()>(&()); -LL + Bar::<'static, ()>(&()); - | error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/generic-arg-mismatch-recover.rs:9:5 | LL | Bar::<'static, 'static, ()>(&()); - | ^^^ expected 0 generic arguments + | ^^^ -- help: remove the unnecessary generic argument + | | + | expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/generic-arg-mismatch-recover.rs:3:8 | LL | struct Bar<'a>(&'a ()); | ^^^ -help: remove the unnecessary generic argument - | -LL - Bar::<'static, 'static, ()>(&()); -LL + Bar::<'static, 'static, >(&()); - | error: aborting due to 3 previous errors diff --git a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr index a180e348a686b..16bdc2de2520d 100644 --- a/tests/ui/generics/generic-impl-more-params-with-defaults.stderr +++ b/tests/ui/generics/generic-impl-more-params-with-defaults.stderr @@ -2,18 +2,15 @@ error[E0107]: struct takes at most 2 generic arguments but 3 generic arguments w --> $DIR/generic-impl-more-params-with-defaults.rs:13:5 | LL | Vec::::new(); - | ^^^ expected at most 2 generic arguments + | ^^^ ------ help: remove the unnecessary generic argument + | | + | expected at most 2 generic arguments | note: struct defined here, with at most 2 generic parameters: `T`, `A` --> $DIR/generic-impl-more-params-with-defaults.rs:5:8 | LL | struct Vec( | ^^^ - -------- -help: remove the unnecessary generic argument - | -LL - Vec::::new(); -LL + Vec::::new(); - | error: aborting due to 1 previous error diff --git a/tests/ui/generics/generic-type-more-params-with-defaults.stderr b/tests/ui/generics/generic-type-more-params-with-defaults.stderr index 9b73b7375d795..1eb76e043e047 100644 --- a/tests/ui/generics/generic-type-more-params-with-defaults.stderr +++ b/tests/ui/generics/generic-type-more-params-with-defaults.stderr @@ -2,18 +2,15 @@ error[E0107]: struct takes at most 2 generic arguments but 3 generic arguments w --> $DIR/generic-type-more-params-with-defaults.rs:9:12 | LL | let _: Vec; - | ^^^ expected at most 2 generic arguments + | ^^^ ------ help: remove the unnecessary generic argument + | | + | expected at most 2 generic arguments | note: struct defined here, with at most 2 generic parameters: `T`, `A` --> $DIR/generic-type-more-params-with-defaults.rs:5:8 | LL | struct Vec( | ^^^ - -------- -help: remove the unnecessary generic argument - | -LL - let _: Vec; -LL + let _: Vec; - | error: aborting due to 1 previous error diff --git a/tests/ui/generics/wrong-number-of-args.stderr b/tests/ui/generics/wrong-number-of-args.stderr index 17503b86e19cd..bac0d26b622dc 100644 --- a/tests/ui/generics/wrong-number-of-args.stderr +++ b/tests/ui/generics/wrong-number-of-args.stderr @@ -171,86 +171,71 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/wrong-number-of-args.rs:6:14 | LL | type B = Ty<'static>; - | ^^ expected 0 lifetime arguments + | ^^--------- help: remove the unnecessary generics + | | + | expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ -help: remove the unnecessary generics - | -LL - type B = Ty<'static>; -LL + type B = Ty; - | error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:10:14 | LL | type C = Ty<'static, usize>; - | ^^ expected 0 lifetime arguments + | ^^ ------- help: remove the lifetime argument + | | + | expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ -help: remove the lifetime argument - | -LL - type C = Ty<'static, usize>; -LL + type C = Ty<, usize>; - | error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:10:14 | LL | type C = Ty<'static, usize>; - | ^^ expected 0 generic arguments + | ^^ ----- help: remove the unnecessary generic argument + | | + | expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ -help: remove the unnecessary generic argument - | -LL - type C = Ty<'static, usize>; -LL + type C = Ty<'static, >; - | error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:16:14 | LL | type D = Ty<'static, usize, { 0 }>; - | ^^ expected 0 lifetime arguments + | ^^ ------- help: remove the lifetime argument + | | + | expected 0 lifetime arguments | note: struct defined here, with 0 lifetime parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ -help: remove the lifetime argument - | -LL - type D = Ty<'static, usize, { 0 }>; -LL + type D = Ty<, usize, { 0 }>; - | error[E0107]: struct takes 0 generic arguments but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:16:14 | LL | type D = Ty<'static, usize, { 0 }>; - | ^^ expected 0 generic arguments + | ^^ ------- help: remove the unnecessary generic arguments + | | + | expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:2:12 | LL | struct Ty; | ^^ -help: remove the unnecessary generic arguments - | -LL - type D = Ty<'static, usize, { 0 }>; -LL + type D = Ty<'static, usize>; - | error[E0107]: missing generics for struct `type_and_type::Ty` --> $DIR/wrong-number-of-args.rs:26:14 @@ -290,18 +275,15 @@ error[E0107]: struct takes 2 generic arguments but 3 generic arguments were supp --> $DIR/wrong-number-of-args.rs:36:14 | LL | type D = Ty; - | ^^ expected 2 generic arguments + | ^^ ------ help: remove the unnecessary generic argument + | | + | expected 2 generic arguments | note: struct defined here, with 2 generic parameters: `A`, `B` --> $DIR/wrong-number-of-args.rs:24:12 | LL | struct Ty(A, B); | ^^ - - -help: remove the unnecessary generic argument - | -LL - type D = Ty; -LL + type D = Ty; - | error[E0107]: struct takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:40:14 @@ -371,35 +353,29 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/wrong-number-of-args.rs:70:14 | LL | type F = Ty<'static, usize, 'static, usize>; - | ^^ expected 1 lifetime argument + | ^^ ---------------- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:46:12 | LL | struct Ty<'a, T>(&'a T); | ^^ -- -help: remove the lifetime argument - | -LL - type F = Ty<'static, usize, 'static, usize>; -LL + type F = Ty<'static, usize>; - | error[E0107]: struct takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:70:14 | LL | type F = Ty<'static, usize, 'static, usize>; - | ^^ expected 1 generic argument + | ^^ ---------------- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` --> $DIR/wrong-number-of-args.rs:46:12 | LL | struct Ty<'a, T>(&'a T); | ^^ - -help: remove the unnecessary generic argument - | -LL - type F = Ty<'static, usize, 'static, usize>; -LL + type F = Ty<'static, usize>; - | error[E0107]: missing generics for struct `type_and_type_and_type::Ty` --> $DIR/wrong-number-of-args.rs:80:14 @@ -439,18 +415,15 @@ error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments w --> $DIR/wrong-number-of-args.rs:92:14 | LL | type E = Ty; - | ^^ expected at most 3 generic arguments + | ^^ ----- help: remove the unnecessary generic argument + | | + | expected at most 3 generic arguments | note: struct defined here, with at most 3 generic parameters: `A`, `B`, `C` --> $DIR/wrong-number-of-args.rs:78:12 | LL | struct Ty(A, B, C); | ^^ - - ---------------- -help: remove the unnecessary generic argument - | -LL - type E = Ty; -LL + type E = Ty; - | error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:96:14 @@ -472,35 +445,29 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/wrong-number-of-args.rs:116:22 | LL | type A = Box>; - | ^^^^^^^^^^ expected 0 generic arguments + | ^^^^^^^^^^------- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:104:11 | LL | trait NonGeneric { | ^^^^^^^^^^ -help: remove the unnecessary generics - | -LL - type A = Box>; -LL + type A = Box; - | error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:125:22 | LL | type C = Box>; - | ^^^^^^^^^^^^^^^ expected 1 lifetime argument + | ^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:108:11 | LL | trait GenericLifetime<'a> { | ^^^^^^^^^^^^^^^ -- -help: remove the lifetime argument - | -LL - type C = Box>; -LL + type C = Box>; - | error[E0107]: missing generics for trait `GenericType` --> $DIR/wrong-number-of-args.rs:129:22 @@ -522,18 +489,15 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:133:22 | LL | type E = Box>; - | ^^^^^^^^^^^ expected 1 generic argument + | ^^^^^^^^^^^ ------- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:112:11 | LL | trait GenericType { | ^^^^^^^^^^^ - -help: remove the unnecessary generic argument - | -LL - type E = Box>; -LL + type E = Box>; - | error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:142:22 @@ -555,52 +519,43 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/wrong-number-of-args.rs:153:26 | LL | type A = Box>; - | ^^^^^^^^^^^^ expected 0 generic arguments + | ^^^^^^^^^^^^------------------- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:149:15 | LL | trait NonGenericAT { | ^^^^^^^^^^^^ -help: remove the unnecessary generics - | -LL - type A = Box>; -LL + type A = Box; - | error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:168:26 | LL | type B = Box>; - | ^^^^^^^^^^^^^^^^^ expected 1 lifetime argument + | ^^^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:159:15 | LL | trait GenericLifetimeAT<'a> { | ^^^^^^^^^^^^^^^^^ -- -help: remove the lifetime argument - | -LL - type B = Box>; -LL + type B = Box>; - | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/wrong-number-of-args.rs:172:26 | LL | type C = Box>; - | ^^^^^^^^^^^^^^^^^ expected 0 generic arguments + | ^^^^^^^^^^^^^^^^^ -- help: remove the unnecessary generic argument + | | + | expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/wrong-number-of-args.rs:159:15 | LL | trait GenericLifetimeAT<'a> { | ^^^^^^^^^^^^^^^^^ -help: remove the unnecessary generic argument - | -LL - type C = Box>; -LL + type C = Box>; - | error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:185:26 @@ -622,35 +577,29 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:189:26 | LL | type B = Box>; - | ^^^^^^^^^^^^^ expected 1 generic argument + | ^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:181:15 | LL | trait GenericTypeAT { | ^^^^^^^^^^^^^ - -help: remove the unnecessary generic argument - | -LL - type B = Box>; -LL + type B = Box>; - | error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:193:26 | LL | type C = Box>; - | ^^^^^^^^^^^^^ expected 0 lifetime arguments + | ^^^^^^^^^^^^^--------------------- help: remove the unnecessary generics + | | + | expected 0 lifetime arguments | note: trait defined here, with 0 lifetime parameters --> $DIR/wrong-number-of-args.rs:181:15 | LL | trait GenericTypeAT { | ^^^^^^^^^^^^^ -help: remove the unnecessary generics - | -LL - type C = Box>; -LL + type C = Box; - | error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:193:26 @@ -704,18 +653,15 @@ error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supp --> $DIR/wrong-number-of-args.rs:216:26 | LL | type C = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ expected 1 lifetime argument + | ^^^^^^^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- -help: remove the lifetime argument - | -LL - type C = Box>; -LL + type C = Box>; - | error[E0107]: trait takes 1 generic argument but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:216:26 @@ -737,86 +683,71 @@ error[E0107]: trait takes 1 generic argument but 2 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:227:26 | LL | type E = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument + | ^^^^^^^^^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - -help: remove the unnecessary generic argument - | -LL - type E = Box>; -LL + type E = Box>; - | error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:234:26 | LL | type F = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ expected 1 lifetime argument + | ^^^^^^^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- -help: remove the lifetime argument - | -LL - type F = Box>; -LL + type F = Box>; - | error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:238:26 | LL | type G = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument + | ^^^^^^^^^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - -help: remove the unnecessary generic argument - | -LL - type G = Box>; -LL + type G = Box>; - | error[E0107]: trait takes 1 lifetime argument but 2 lifetime arguments were supplied --> $DIR/wrong-number-of-args.rs:242:26 | LL | type H = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ expected 1 lifetime argument + | ^^^^^^^^^^^^^^^^^^^^^ --------- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: trait defined here, with 1 lifetime parameter: `'a` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ -- -help: remove the lifetime argument - | -LL - type H = Box>; -LL + type H = Box>; - | error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:242:26 | LL | type H = Box>; - | ^^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument + | ^^^^^^^^^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: trait defined here, with 1 generic parameter: `A` --> $DIR/wrong-number-of-args.rs:201:15 | LL | trait GenericLifetimeTypeAT<'a, A> { | ^^^^^^^^^^^^^^^^^^^^^ - -help: remove the unnecessary generic argument - | -LL - type H = Box>; -LL + type H = Box>; - | error[E0107]: trait takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:254:26 @@ -856,18 +787,15 @@ error[E0107]: trait takes 2 generic arguments but 3 generic arguments were suppl --> $DIR/wrong-number-of-args.rs:262:26 | LL | type C = Box>; - | ^^^^^^^^^^^^^^^^^ expected 2 generic arguments + | ^^^^^^^^^^^^^^^^^ ---- help: remove the unnecessary generic argument + | | + | expected 2 generic arguments | note: trait defined here, with 2 generic parameters: `A`, `B` --> $DIR/wrong-number-of-args.rs:250:15 | LL | trait GenericTypeTypeAT { | ^^^^^^^^^^^^^^^^^ - - -help: remove the unnecessary generic argument - | -LL - type C = Box>; -LL + type C = Box>; - | error[E0107]: trait takes 2 lifetime arguments but 1 lifetime argument was supplied --> $DIR/wrong-number-of-args.rs:277:26 @@ -983,13 +911,9 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/wrong-number-of-args.rs:318:18 | LL | type C = HashMap<'static>; - | ^^^^^^^ expected 0 lifetime arguments - | -help: remove the unnecessary generics - | -LL - type C = HashMap<'static>; -LL + type C = HashMap; - | + | ^^^^^^^--------- help: remove the unnecessary generics + | | + | expected 0 lifetime arguments error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:318:18 @@ -1006,13 +930,9 @@ error[E0107]: struct takes at most 3 generic arguments but 4 generic arguments w --> $DIR/wrong-number-of-args.rs:324:18 | LL | type D = HashMap; - | ^^^^^^^ expected at most 3 generic arguments - | -help: remove the unnecessary generic argument - | -LL - type D = HashMap; -LL + type D = HashMap; - | + | ^^^^^^^ ----- help: remove the unnecessary generic argument + | | + | expected at most 3 generic arguments error[E0107]: struct takes at least 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:328:18 @@ -1053,13 +973,9 @@ error[E0107]: enum takes 0 lifetime arguments but 1 lifetime argument was suppli --> $DIR/wrong-number-of-args.rs:342:18 | LL | type C = Result<'static>; - | ^^^^^^ expected 0 lifetime arguments - | -help: remove the unnecessary generics - | -LL - type C = Result<'static>; -LL + type C = Result; - | + | ^^^^^^--------- help: remove the unnecessary generics + | | + | expected 0 lifetime arguments error[E0107]: enum takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:342:18 @@ -1076,13 +992,9 @@ error[E0107]: enum takes 2 generic arguments but 3 generic arguments were suppli --> $DIR/wrong-number-of-args.rs:348:18 | LL | type D = Result; - | ^^^^^^ expected 2 generic arguments - | -help: remove the unnecessary generic argument - | -LL - type D = Result; -LL + type D = Result; - | + | ^^^^^^ ------ help: remove the unnecessary generic argument + | | + | expected 2 generic arguments error[E0107]: enum takes 2 generic arguments but 0 generic arguments were supplied --> $DIR/wrong-number-of-args.rs:352:18 diff --git a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr index e225d7076b8cf..9b0d0c554f014 100644 --- a/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr +++ b/tests/ui/impl-trait/explicit-generic-args-with-impl-trait/explicit-generic-args-for-impl.stderr @@ -2,7 +2,9 @@ error[E0107]: function takes 1 generic argument but 2 generic arguments were sup --> $DIR/explicit-generic-args-for-impl.rs:4:5 | LL | foo::("".to_string()); - | ^^^ expected 1 generic argument + | ^^^ -------- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: function defined here, with 1 generic parameter: `T` --> $DIR/explicit-generic-args-for-impl.rs:1:4 @@ -10,11 +12,6 @@ note: function defined here, with 1 generic parameter: `T` LL | fn foo(_f: impl AsRef) {} | ^^^ - = note: `impl Trait` cannot be explicitly specified as a generic argument -help: remove the unnecessary generic argument - | -LL - foo::("".to_string()); -LL + foo::("".to_string()); - | error: aborting due to 1 previous error diff --git a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr index 1802a22d6cfe6..81570781b27da 100644 --- a/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr +++ b/tests/ui/impl-trait/in-trait/opaque-and-lifetime-mismatch.stderr @@ -38,35 +38,29 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/opaque-and-lifetime-mismatch.rs:4:17 | LL | fn bar() -> Wrapper; - | ^^^^^^^ expected 0 generic arguments + | ^^^^^^^ ---------- help: remove the unnecessary generic argument + | | + | expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/opaque-and-lifetime-mismatch.rs:1:8 | LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ -help: remove the unnecessary generic argument - | -LL - fn bar() -> Wrapper; -LL + fn bar() -> Wrapper<>; - | error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied --> $DIR/opaque-and-lifetime-mismatch.rs:18:17 | LL | fn foo() -> Wrapper; - | ^^^^^^^ expected 0 generic arguments + | ^^^^^^^ ---------- help: remove the unnecessary generic argument + | | + | expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/opaque-and-lifetime-mismatch.rs:1:8 | LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ -help: remove the unnecessary generic argument - | -LL - fn foo() -> Wrapper; -LL + fn foo() -> Wrapper<>; - | error[E0053]: method `bar` has an incompatible return type for trait --> $DIR/opaque-and-lifetime-mismatch.rs:10:17 @@ -99,18 +93,15 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/opaque-and-lifetime-mismatch.rs:24:17 | LL | fn foo() -> Wrapper { - | ^^^^^^^ expected 0 generic arguments + | ^^^^^^^ ---------- help: remove the unnecessary generic argument + | | + | expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/opaque-and-lifetime-mismatch.rs:1:8 | LL | struct Wrapper<'rom>(&'rom ()); | ^^^^^^^ -help: remove the unnecessary generic argument - | -LL - fn foo() -> Wrapper { -LL + fn foo() -> Wrapper<> { - | error: aborting due to 8 previous errors diff --git a/tests/ui/issues/issue-18423.stderr b/tests/ui/issues/issue-18423.stderr index c1a4aacd2a54e..b5f19b5c9b23c 100644 --- a/tests/ui/issues/issue-18423.stderr +++ b/tests/ui/issues/issue-18423.stderr @@ -2,13 +2,9 @@ error[E0107]: struct takes 0 lifetime arguments but 1 lifetime argument was supp --> $DIR/issue-18423.rs:4:8 | LL | x: Box<'a, isize> - | ^^^ expected 0 lifetime arguments - | -help: remove the lifetime argument - | -LL - x: Box<'a, isize> -LL + x: Box<, isize> - | + | ^^^ -- help: remove the lifetime argument + | | + | expected 0 lifetime arguments error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-53251.stderr b/tests/ui/issues/issue-53251.stderr index 854e9bc0c9b3e..981966354b972 100644 --- a/tests/ui/issues/issue-53251.stderr +++ b/tests/ui/issues/issue-53251.stderr @@ -2,7 +2,9 @@ error[E0107]: associated function takes 0 generic arguments but 1 generic argume --> $DIR/issue-53251.rs:11:20 | LL | S::f::(); - | ^ expected 0 generic arguments + | ^------- help: remove the unnecessary generics + | | + | expected 0 generic arguments ... LL | impl_add!(a b); | -------------- in this macro invocation @@ -13,17 +15,14 @@ note: associated function defined here, with 0 generic parameters LL | fn f() {} | ^ = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info) -help: remove the unnecessary generics - | -LL - S::f::(); -LL + S::f(); - | error[E0107]: associated function takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-53251.rs:11:20 | LL | S::f::(); - | ^ expected 0 generic arguments + | ^------- help: remove the unnecessary generics + | | + | expected 0 generic arguments ... LL | impl_add!(a b); | -------------- in this macro invocation @@ -35,11 +34,6 @@ LL | fn f() {} | ^ = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` = note: this error originates in the macro `impl_add` (in Nightly builds, run with -Z macro-backtrace for more info) -help: remove the unnecessary generics - | -LL - S::f::(); -LL + S::f(); - | error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-60622.stderr b/tests/ui/issues/issue-60622.stderr index 66e96131f5e0c..298ef3799f242 100644 --- a/tests/ui/issues/issue-60622.stderr +++ b/tests/ui/issues/issue-60622.stderr @@ -20,18 +20,15 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-60622.rs:10:7 | LL | b.a::<'_, T>(); - | ^ expected 0 generic arguments + | ^ - help: remove the unnecessary generic argument + | | + | expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/issue-60622.rs:6:8 | LL | fn a(&self) {} | ^ -help: remove the unnecessary generic argument - | -LL - b.a::<'_, T>(); -LL + b.a::<'_, >(); - | error: aborting due to 2 previous errors diff --git a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr index c0a5b62a56a2b..1717b6aa1242b 100644 --- a/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr +++ b/tests/ui/late-bound-lifetimes/mismatched_arg_count.stderr @@ -2,18 +2,15 @@ error[E0107]: type alias takes 1 lifetime argument but 2 lifetime arguments were --> $DIR/mismatched_arg_count.rs:9:29 | LL | fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} - | ^^^^^ expected 1 lifetime argument + | ^^^^^ ---- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: type alias defined here, with 1 lifetime parameter: `'a` --> $DIR/mismatched_arg_count.rs:7:6 | LL | type Alias<'a, T> = >::Assoc; | ^^^^^ -- -help: remove the lifetime argument - | -LL - fn bar<'a, T: Trait<'a>>(_: Alias<'a, 'a, T>) {} -LL + fn bar<'a, T: Trait<'a>>(_: Alias<'a, T>) {} - | error: aborting due to 1 previous error diff --git a/tests/ui/lifetimes/noisy-follow-up-erro.stderr b/tests/ui/lifetimes/noisy-follow-up-erro.stderr index 3c2d0df683a94..04863badbd1ef 100644 --- a/tests/ui/lifetimes/noisy-follow-up-erro.stderr +++ b/tests/ui/lifetimes/noisy-follow-up-erro.stderr @@ -2,18 +2,15 @@ error[E0107]: struct takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/noisy-follow-up-erro.rs:12:30 | LL | fn boom(&self, foo: &mut Foo<'_, '_, 'a>) -> Result<(), &'a ()> { - | ^^^ expected 2 lifetime arguments + | ^^^ ---- help: remove the lifetime argument + | | + | expected 2 lifetime arguments | note: struct defined here, with 2 lifetime parameters: `'c`, `'d` --> $DIR/noisy-follow-up-erro.rs:1:8 | LL | struct Foo<'c, 'd>(&'c (), &'d ()); | ^^^ -- -- -help: remove the lifetime argument - | -LL - fn boom(&self, foo: &mut Foo<'_, '_, 'a>) -> Result<(), &'a ()> { -LL + fn boom(&self, foo: &mut Foo<'_, '_>) -> Result<(), &'a ()> { - | error[E0621]: explicit lifetime required in the type of `foo` --> $DIR/noisy-follow-up-erro.rs:14:9 diff --git a/tests/ui/methods/method-call-lifetime-args-fail.stderr b/tests/ui/methods/method-call-lifetime-args-fail.stderr index 2eda01fa20c38..b251dd4d342f4 100644 --- a/tests/ui/methods/method-call-lifetime-args-fail.stderr +++ b/tests/ui/methods/method-call-lifetime-args-fail.stderr @@ -20,18 +20,15 @@ error[E0107]: method takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/method-call-lifetime-args-fail.rs:18:7 | LL | S.early::<'static, 'static, 'static>(); - | ^^^^^ expected 2 lifetime arguments + | ^^^^^ --------- help: remove the lifetime argument + | | + | expected 2 lifetime arguments | note: method defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/method-call-lifetime-args-fail.rs:6:8 | LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } | ^^^^^ -- -- -help: remove the lifetime argument - | -LL - S.early::<'static, 'static, 'static>(); -LL + S.early::<'static, 'static>(); - | error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present --> $DIR/method-call-lifetime-args-fail.rs:27:15 @@ -223,18 +220,15 @@ error[E0107]: method takes 2 lifetime arguments but 3 lifetime arguments were su --> $DIR/method-call-lifetime-args-fail.rs:65:8 | LL | S::early::<'static, 'static, 'static>(S); - | ^^^^^ expected 2 lifetime arguments + | ^^^^^ --------- help: remove the lifetime argument + | | + | expected 2 lifetime arguments | note: method defined here, with 2 lifetime parameters: `'a`, `'b` --> $DIR/method-call-lifetime-args-fail.rs:6:8 | LL | fn early<'a, 'b>(self) -> (&'a u8, &'b u8) { loop {} } | ^^^^^ -- -- -help: remove the lifetime argument - | -LL - S::early::<'static, 'static, 'static>(S); -LL + S::early::<'static, 'static>(S); - | error: aborting due to 18 previous errors diff --git a/tests/ui/resolve/issue-3214.stderr b/tests/ui/resolve/issue-3214.stderr index f6f8c3b774679..1c64fdc1711fd 100644 --- a/tests/ui/resolve/issue-3214.stderr +++ b/tests/ui/resolve/issue-3214.stderr @@ -12,18 +12,15 @@ error[E0107]: struct takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-3214.rs:6:22 | LL | impl Drop for Foo { - | ^^^ expected 0 generic arguments + | ^^^--- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: struct defined here, with 0 generic parameters --> $DIR/issue-3214.rs:2:12 | LL | struct Foo { | ^^^ -help: remove the unnecessary generics - | -LL - impl Drop for Foo { -LL + impl Drop for Foo { - | error: aborting due to 2 previous errors diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr index 6945e8465da7b..8c591edac5404 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params-cross-crate.stderr @@ -2,18 +2,15 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params-cross-crate.rs:14:5 | LL | foo::(); - | ^^^ expected 0 generic arguments + | ^^^--------- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/auxiliary/cross-crate.rs:5:14 | LL | pub const fn foo() {} | ^^^ -help: remove the unnecessary generics - | -LL - foo::(); -LL + foo(); - | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/no-explicit-const-params-cross-crate.rs:16:12 @@ -35,18 +32,15 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params-cross-crate.rs:7:5 | LL | foo::(); - | ^^^ expected 0 generic arguments + | ^^^-------- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/auxiliary/cross-crate.rs:5:14 | LL | pub const fn foo() {} | ^^^ -help: remove the unnecessary generics - | -LL - foo::(); -LL + foo(); - | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/no-explicit-const-params-cross-crate.rs:9:12 diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr index 0f9380de2862a..cc08114ddb565 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/no-explicit-const-params.stderr @@ -16,18 +16,15 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params.rs:22:5 | LL | foo::(); - | ^^^ expected 0 generic arguments + | ^^^--------- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/no-explicit-const-params.rs:3:10 | LL | const fn foo() {} | ^^^ -help: remove the unnecessary generics - | -LL - foo::(); -LL + foo(); - | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/no-explicit-const-params.rs:24:12 @@ -58,18 +55,15 @@ error[E0107]: function takes 0 generic arguments but 1 generic argument was supp --> $DIR/no-explicit-const-params.rs:15:5 | LL | foo::(); - | ^^^ expected 0 generic arguments + | ^^^-------- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: function defined here, with 0 generic parameters --> $DIR/no-explicit-const-params.rs:3:10 | LL | const fn foo() {} | ^^^ -help: remove the unnecessary generics - | -LL - foo::(); -LL + foo(); - | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/no-explicit-const-params.rs:17:12 diff --git a/tests/ui/seq-args.stderr b/tests/ui/seq-args.stderr index 47c5119b91732..6e0d484d013d3 100644 --- a/tests/ui/seq-args.stderr +++ b/tests/ui/seq-args.stderr @@ -2,35 +2,29 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/seq-args.rs:4:13 | LL | impl Seq for Vec { - | ^^^ expected 0 generic arguments + | ^^^--- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/seq-args.rs:2:11 | LL | trait Seq { } | ^^^ -help: remove the unnecessary generics - | -LL - impl Seq for Vec { -LL + impl Seq for Vec { - | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/seq-args.rs:9:10 | LL | impl Seq for u32 { - | ^^^ expected 0 generic arguments + | ^^^------ help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/seq-args.rs:2:11 | LL | trait Seq { } | ^^^ -help: remove the unnecessary generics - | -LL - impl Seq for u32 { -LL + impl Seq for u32 { - | error: aborting due to 2 previous errors diff --git a/tests/ui/structs/struct-path-associated-type.stderr b/tests/ui/structs/struct-path-associated-type.stderr index 1a2a346b0e303..de396e875b0cf 100644 --- a/tests/ui/structs/struct-path-associated-type.stderr +++ b/tests/ui/structs/struct-path-associated-type.stderr @@ -8,18 +8,15 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/struct-path-associated-type.rs:14:16 | LL | let z = T::A:: {}; - | ^ expected 0 generic arguments + | ^------ help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/struct-path-associated-type.rs:4:10 | LL | type A; | ^ -help: remove the unnecessary generics - | -LL - let z = T::A:: {}; -LL + let z = T::A {}; - | error[E0071]: expected struct, variant or union type, found associated type --> $DIR/struct-path-associated-type.rs:14:13 @@ -37,18 +34,15 @@ error[E0107]: associated type takes 0 generic arguments but 1 generic argument w --> $DIR/struct-path-associated-type.rs:25:16 | LL | let z = T::A:: {}; - | ^ expected 0 generic arguments + | ^------ help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated type defined here, with 0 generic parameters --> $DIR/struct-path-associated-type.rs:4:10 | LL | type A; | ^ -help: remove the unnecessary generics - | -LL - let z = T::A:: {}; -LL + let z = T::A {}; - | error[E0223]: ambiguous associated type --> $DIR/struct-path-associated-type.rs:32:13 diff --git a/tests/ui/structs/structure-constructor-type-mismatch.stderr b/tests/ui/structs/structure-constructor-type-mismatch.stderr index 606381251157c..819b65ffb716e 100644 --- a/tests/ui/structs/structure-constructor-type-mismatch.stderr +++ b/tests/ui/structs/structure-constructor-type-mismatch.stderr @@ -68,18 +68,15 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/structure-constructor-type-mismatch.rs:48:15 | LL | let pt3 = PointF:: { - | ^^^^^^ expected 0 generic arguments + | ^^^^^^------- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/structure-constructor-type-mismatch.rs:6:6 | LL | type PointF = Point; | ^^^^^^ -help: remove the unnecessary generics - | -LL - let pt3 = PointF:: { -LL + let pt3 = PointF { - | error[E0308]: mismatched types --> $DIR/structure-constructor-type-mismatch.rs:49:12 @@ -107,18 +104,15 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/structure-constructor-type-mismatch.rs:54:9 | LL | PointF:: { .. } => {} - | ^^^^^^ expected 0 generic arguments + | ^^^^^^------- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/structure-constructor-type-mismatch.rs:6:6 | LL | type PointF = Point; | ^^^^^^ -help: remove the unnecessary generics - | -LL - PointF:: { .. } => {} -LL + PointF { .. } => {} - | error[E0308]: mismatched types --> $DIR/structure-constructor-type-mismatch.rs:54:9 diff --git a/tests/ui/suggestions/issue-101421.stderr b/tests/ui/suggestions/issue-101421.stderr index 7adf07aa531c0..12b4c04c2a335 100644 --- a/tests/ui/suggestions/issue-101421.stderr +++ b/tests/ui/suggestions/issue-101421.stderr @@ -2,18 +2,15 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-101421.rs:10:8 | LL | ().f::<()>(()); - | ^ expected 0 generic arguments + | ^------ help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/issue-101421.rs:2:8 | LL | fn f(&self, _: ()); | ^ -help: remove the unnecessary generics - | -LL - ().f::<()>(()); -LL + ().f(()); - | error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-104287.stderr b/tests/ui/suggestions/issue-104287.stderr index 808f956280581..d728e6c3d8c19 100644 --- a/tests/ui/suggestions/issue-104287.stderr +++ b/tests/ui/suggestions/issue-104287.stderr @@ -2,18 +2,15 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/issue-104287.rs:10:5 | LL | foo::<()>(x); - | ^^^ expected 0 generic arguments + | ^^^------ help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/issue-104287.rs:6:8 | LL | fn foo(&self) {} | ^^^ -help: remove the unnecessary generics - | -LL - foo::<()>(x); -LL + foo(x); - | error[E0425]: cannot find function `foo` in this scope --> $DIR/issue-104287.rs:10:5 diff --git a/tests/ui/suggestions/issue-89064.stderr b/tests/ui/suggestions/issue-89064.stderr index a64a1986af847..837fef60d1e62 100644 --- a/tests/ui/suggestions/issue-89064.stderr +++ b/tests/ui/suggestions/issue-89064.stderr @@ -46,18 +46,15 @@ error[E0107]: associated function takes 0 generic arguments but 1 generic argume --> $DIR/issue-89064.rs:27:21 | LL | let _ = A::::foo::(); - | ^^^ expected 0 generic arguments + | ^^^----- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: associated function defined here, with 0 generic parameters --> $DIR/issue-89064.rs:4:8 | LL | fn foo() {} | ^^^ -help: remove the unnecessary generics - | -LL - let _ = A::::foo::(); -LL + let _ = A::::foo(); - | error[E0107]: method takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-89064.rs:31:16 diff --git a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr index d25192b3d6d86..a22d88b7c59fa 100644 --- a/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr +++ b/tests/ui/traits/associated_type_bound/116464-invalid-assoc-type-suggestion-in-trait-impl.stderr @@ -117,18 +117,15 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:40:58 | LL | impl, U> YetAnotherTrait for Struct {} - | ^^^^^^ expected 1 generic argument + | ^^^^^^ --- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` --> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:26:8 | LL | struct Struct> { | ^^^^^^ - -help: remove the unnecessary generic argument - | -LL - impl, U> YetAnotherTrait for Struct {} -LL + impl, U> YetAnotherTrait for Struct {} - | error: aborting due to 9 previous errors diff --git a/tests/ui/traits/object/vs-lifetime.stderr b/tests/ui/traits/object/vs-lifetime.stderr index 889e1e82876aa..916197ff09653 100644 --- a/tests/ui/traits/object/vs-lifetime.stderr +++ b/tests/ui/traits/object/vs-lifetime.stderr @@ -8,18 +8,15 @@ error[E0107]: struct takes 1 lifetime argument but 2 lifetime arguments were sup --> $DIR/vs-lifetime.rs:11:12 | LL | let _: S<'static, 'static>; - | ^ expected 1 lifetime argument + | ^ --------- help: remove the lifetime argument + | | + | expected 1 lifetime argument | note: struct defined here, with 1 lifetime parameter: `'a` --> $DIR/vs-lifetime.rs:4:8 | LL | struct S<'a, T>(&'a u8, T); | ^ -- -help: remove the lifetime argument - | -LL - let _: S<'static, 'static>; -LL + let _: S<'static>; - | error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied --> $DIR/vs-lifetime.rs:11:12 diff --git a/tests/ui/traits/test-2.stderr b/tests/ui/traits/test-2.stderr index d64497309ef93..0ee64cc095223 100644 --- a/tests/ui/traits/test-2.stderr +++ b/tests/ui/traits/test-2.stderr @@ -2,35 +2,29 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/test-2.rs:9:8 | LL | 10.dup::(); - | ^^^ expected 0 generic arguments + | ^^^------- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/test-2.rs:4:16 | LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } | ^^^ -help: remove the unnecessary generics - | -LL - 10.dup::(); -LL + 10.dup(); - | error[E0107]: method takes 1 generic argument but 2 generic arguments were supplied --> $DIR/test-2.rs:11:8 | LL | 10.blah::(); - | ^^^^ expected 1 generic argument + | ^^^^ ----- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: method defined here, with 1 generic parameter: `X` --> $DIR/test-2.rs:4:39 | LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } | ^^^^ - -help: remove the unnecessary generic argument - | -LL - 10.blah::(); -LL + 10.blah::(); - | error[E0038]: the trait `bar` cannot be made into an object --> $DIR/test-2.rs:13:22 diff --git a/tests/ui/transmutability/issue-101739-2.stderr b/tests/ui/transmutability/issue-101739-2.stderr index dabb51ee7aef8..6b0a36a414bfd 100644 --- a/tests/ui/transmutability/issue-101739-2.stderr +++ b/tests/ui/transmutability/issue-101739-2.stderr @@ -1,17 +1,15 @@ error[E0107]: trait takes at most 2 generic arguments but 5 generic arguments were supplied --> $DIR/issue-101739-2.rs:17:14 | -LL | Dst: BikeshedIntrinsicFrom< - | ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments - | -help: remove the unnecessary generic arguments - | -LL - ASSUME_ALIGNMENT, -LL - ASSUME_LIFETIMES, -LL - ASSUME_VALIDITY, -LL - ASSUME_VISIBILITY, -LL + ASSUME_ALIGNMENT, - | +LL | Dst: BikeshedIntrinsicFrom< + | ^^^^^^^^^^^^^^^^^^^^^ expected at most 2 generic arguments +LL | Src, +LL | ASSUME_ALIGNMENT, + | _____________________________- +LL | | ASSUME_LIFETIMES, +LL | | ASSUME_VALIDITY, +LL | | ASSUME_VISIBILITY, + | |_____________________________- help: remove the unnecessary generic arguments error: aborting due to 1 previous error diff --git a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr index aaed6a9b54469..482a314db602e 100644 --- a/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr +++ b/tests/ui/type-alias-enum-variants/enum-variant-generic-args.stderr @@ -308,35 +308,29 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:64:5 | LL | AliasFixed::<()>::TSVariant(()); - | ^^^^^^^^^^ expected 0 generic arguments + | ^^^^^^^^^^------ help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -help: remove the unnecessary generics - | -LL - AliasFixed::<()>::TSVariant(()); -LL + AliasFixed::TSVariant(()); - | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:66:5 | LL | AliasFixed::<()>::TSVariant::<()>(()); - | ^^^^^^^^^^ expected 0 generic arguments + | ^^^^^^^^^^------ help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -help: remove the unnecessary generics - | -LL - AliasFixed::<()>::TSVariant::<()>(()); -LL + AliasFixed::TSVariant::<()>(()); - | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:66:35 @@ -405,35 +399,29 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:82:5 | LL | AliasFixed::<()>::SVariant { v: () }; - | ^^^^^^^^^^ expected 0 generic arguments + | ^^^^^^^^^^------ help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -help: remove the unnecessary generics - | -LL - AliasFixed::<()>::SVariant { v: () }; -LL + AliasFixed::SVariant { v: () }; - | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:84:5 | LL | AliasFixed::<()>::SVariant::<()> { v: () }; - | ^^^^^^^^^^ expected 0 generic arguments + | ^^^^^^^^^^------ help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -help: remove the unnecessary generics - | -LL - AliasFixed::<()>::SVariant::<()> { v: () }; -LL + AliasFixed::SVariant::<()> { v: () }; - | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:84:34 @@ -486,35 +474,29 @@ error[E0107]: type alias takes 0 generic arguments but 1 generic argument was su --> $DIR/enum-variant-generic-args.rs:100:5 | LL | AliasFixed::<()>::UVariant; - | ^^^^^^^^^^ expected 0 generic arguments + | ^^^^^^^^^^------ help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -help: remove the unnecessary generics - | -LL - AliasFixed::<()>::UVariant; -LL + AliasFixed::UVariant; - | error[E0107]: type alias takes 0 generic arguments but 1 generic argument was supplied --> $DIR/enum-variant-generic-args.rs:102:5 | LL | AliasFixed::<()>::UVariant::<()>; - | ^^^^^^^^^^ expected 0 generic arguments + | ^^^^^^^^^^------ help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: type alias defined here, with 0 generic parameters --> $DIR/enum-variant-generic-args.rs:9:6 | LL | type AliasFixed = Enum<()>; | ^^^^^^^^^^ -help: remove the unnecessary generics - | -LL - AliasFixed::<()>::UVariant::<()>; -LL + AliasFixed::UVariant::<()>; - | error[E0109]: type arguments are not allowed on this type --> $DIR/enum-variant-generic-args.rs:102:34 diff --git a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr index dbcc03ee955f4..4235a14cdc00a 100644 --- a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr +++ b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr @@ -2,99 +2,69 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/typeck-builtin-bound-type-parameters.rs:1:11 | LL | fn foo1, U>(x: T) {} - | ^^^^ expected 0 generic arguments - | -help: remove the unnecessary generics - | -LL - fn foo1, U>(x: T) {} -LL + fn foo1(x: T) {} - | + | ^^^^--- help: remove the unnecessary generics + | | + | expected 0 generic arguments error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 | LL | trait Trait: Copy {} - | ^^^^ expected 0 generic arguments - | -help: remove the unnecessary generics - | -LL - trait Trait: Copy {} -LL + trait Trait: Copy {} - | + | ^^^^---------- help: remove the unnecessary generics + | | + | expected 0 generic arguments error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 | LL | trait Trait: Copy {} - | ^^^^ expected 0 generic arguments + | ^^^^---------- help: remove the unnecessary generics + | | + | expected 0 generic arguments | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove the unnecessary generics - | -LL - trait Trait: Copy {} -LL + trait Trait: Copy {} - | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 | LL | trait Trait: Copy {} - | ^^^^ expected 0 generic arguments + | ^^^^---------- help: remove the unnecessary generics + | | + | expected 0 generic arguments | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -help: remove the unnecessary generics - | -LL - trait Trait: Copy {} -LL + trait Trait: Copy {} - | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:9:21 | LL | struct MyStruct1>(T); - | ^^^^ expected 0 generic arguments - | -help: remove the unnecessary generics - | -LL - struct MyStruct1>(T); -LL + struct MyStruct1(T); - | + | ^^^^--- help: remove the unnecessary generics + | | + | expected 0 generic arguments error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:12:25 | LL | struct MyStruct2<'a, T: Copy<'a>>(&'a T); - | ^^^^ expected 0 lifetime arguments - | -help: remove the unnecessary generics - | -LL - struct MyStruct2<'a, T: Copy<'a>>(&'a T); -LL + struct MyStruct2<'a, T: Copy>(&'a T); - | + | ^^^^---- help: remove the unnecessary generics + | | + | expected 0 lifetime arguments error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:15:15 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} - | ^^^^ expected 0 lifetime arguments - | -help: remove the lifetime argument - | -LL - fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} -LL + fn foo2<'a, T:Copy<, U>, U>(x: T) {} - | + | ^^^^ -- help: remove the lifetime argument + | | + | expected 0 lifetime arguments error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/typeck-builtin-bound-type-parameters.rs:15:15 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} - | ^^^^ expected 0 generic arguments - | -help: remove the unnecessary generic argument - | -LL - fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} -LL + fn foo2<'a, T:Copy<'a, >, U>(x: T) {} - | + | ^^^^ - help: remove the unnecessary generic argument + | | + | expected 0 generic arguments error: aborting due to 8 previous errors diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr index 116dd18664591..bb1b6e4fc730e 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_1.stderr @@ -2,18 +2,15 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/typeck_type_placeholder_lifetime_1.rs:9:12 | LL | let c: Foo<_, _> = Foo { r: &5 }; - | ^^^ expected 1 generic argument + | ^^^ --- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` --> $DIR/typeck_type_placeholder_lifetime_1.rs:4:8 | LL | struct Foo<'a, T:'a> { | ^^^ - -help: remove the unnecessary generic argument - | -LL - let c: Foo<_, _> = Foo { r: &5 }; -LL + let c: Foo<_> = Foo { r: &5 }; - | error: aborting due to 1 previous error diff --git a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr index d2734f4acc892..6b8f1e98d2c49 100644 --- a/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr +++ b/tests/ui/typeck/typeck_type_placeholder_lifetime_2.stderr @@ -2,18 +2,15 @@ error[E0107]: struct takes 1 generic argument but 2 generic arguments were suppl --> $DIR/typeck_type_placeholder_lifetime_2.rs:9:12 | LL | let c: Foo<_, usize> = Foo { r: &5 }; - | ^^^ expected 1 generic argument + | ^^^ ------- help: remove the unnecessary generic argument + | | + | expected 1 generic argument | note: struct defined here, with 1 generic parameter: `T` --> $DIR/typeck_type_placeholder_lifetime_2.rs:4:8 | LL | struct Foo<'a, T:'a> { | ^^^ - -help: remove the unnecessary generic argument - | -LL - let c: Foo<_, usize> = Foo { r: &5 }; -LL + let c: Foo<_> = Foo { r: &5 }; - | error: aborting due to 1 previous error diff --git a/tests/ui/ufcs/ufcs-qpath-missing-params.stderr b/tests/ui/ufcs/ufcs-qpath-missing-params.stderr index e7e576d7c6630..048cf96bcc8e8 100644 --- a/tests/ui/ufcs/ufcs-qpath-missing-params.stderr +++ b/tests/ui/ufcs/ufcs-qpath-missing-params.stderr @@ -34,18 +34,15 @@ error[E0107]: method takes 0 generic arguments but 1 generic argument was suppli --> $DIR/ufcs-qpath-missing-params.rs:17:26 | LL | ::into_cow::("foo".to_string()); - | ^^^^^^^^ expected 0 generic arguments + | ^^^^^^^^------- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: method defined here, with 0 generic parameters --> $DIR/ufcs-qpath-missing-params.rs:4:8 | LL | fn into_cow(self) -> Cow<'a, B>; | ^^^^^^^^ -help: remove the unnecessary generics - | -LL - ::into_cow::("foo".to_string()); -LL + ::into_cow("foo".to_string()); - | error: aborting due to 3 previous errors diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr index 5090097328269..a4e7232c8b35e 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr @@ -2,18 +2,15 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:17 | LL | fn foo1(_: &dyn Zero()) { - | ^^^^ expected 0 generic arguments + | ^^^^-- help: remove the unnecessary parenthetical generics + | | + | expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ -help: remove the unnecessary parenthetical generics - | -LL - fn foo1(_: &dyn Zero()) { -LL + fn foo1(_: &dyn Zero) { - | error[E0220]: associated type `Output` not found for `Zero` --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:5:17 @@ -25,52 +22,43 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:10:17 | LL | fn foo2(_: &dyn Zero) { - | ^^^^ expected 0 generic arguments + | ^^^^------- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ -help: remove the unnecessary generics - | -LL - fn foo2(_: &dyn Zero) { -LL + fn foo2(_: &dyn Zero) { - | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:14:17 | LL | fn foo3(_: &dyn Zero < usize >) { - | ^^^^ expected 0 generic arguments + | ^^^^-------------- help: remove the unnecessary generics + | | + | expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ -help: remove the unnecessary generics - | -LL - fn foo3(_: &dyn Zero < usize >) { -LL + fn foo3(_: &dyn Zero) { - | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:18:17 | LL | fn foo4(_: &dyn Zero(usize)) { - | ^^^^ expected 0 generic arguments + | ^^^^------- help: remove the unnecessary parenthetical generics + | | + | expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ -help: remove the unnecessary parenthetical generics - | -LL - fn foo4(_: &dyn Zero(usize)) { -LL + fn foo4(_: &dyn Zero) { - | error[E0220]: associated type `Output` not found for `Zero` --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:18:17 @@ -82,18 +70,15 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:23:17 | LL | fn foo5(_: &dyn Zero ( usize )) { - | ^^^^ expected 0 generic arguments + | ^^^^-------------- help: remove the unnecessary parenthetical generics + | | + | expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:3:7 | LL | trait Zero { fn dummy(&self); } | ^^^^ -help: remove the unnecessary parenthetical generics - | -LL - fn foo5(_: &dyn Zero ( usize )) { -LL + fn foo5(_: &dyn Zero) { - | error[E0220]: associated type `Output` not found for `Zero` --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:23:17 diff --git a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr index aecfe502cf98b..f5ef58fc91ee6 100644 --- a/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr +++ b/tests/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr @@ -2,18 +2,15 @@ error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplie --> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:8 | LL | fn f isize>(x: F) {} - | ^^^^^ expected 0 generic arguments + | ^^^^^------- help: remove the unnecessary parenthetical generics + | | + | expected 0 generic arguments | note: trait defined here, with 0 generic parameters --> $DIR/unboxed-closure-sugar-wrong-trait.rs:3:7 | LL | trait Trait {} | ^^^^^ -help: remove the unnecessary parenthetical generics - | -LL - fn f isize>(x: F) {} -LL + fn f isize>(x: F) {} - | error[E0220]: associated type `Output` not found for `Trait` --> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:24 From 2561d91983019e2be56e9033f9b14299a291f5f9 Mon Sep 17 00:00:00 2001 From: B I Mohammed Abbas Date: Tue, 23 Jul 2024 10:47:01 +0530 Subject: [PATCH 09/18] Allow unused unsafe for vxworks in read_at and write at --- library/std/src/sys/pal/unix/fd.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/std/src/sys/pal/unix/fd.rs b/library/std/src/sys/pal/unix/fd.rs index 1701717db597c..c1ab20b4b35c6 100644 --- a/library/std/src/sys/pal/unix/fd.rs +++ b/library/std/src/sys/pal/unix/fd.rs @@ -120,6 +120,7 @@ impl FileDesc { (&mut me).read_to_end(buf) } + #[cfg_attr(target_os = "vxworks", allow(unused_unsafe))] pub fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result { #[cfg(not(any( all(target_os = "linux", not(target_env = "musl")), @@ -313,6 +314,7 @@ impl FileDesc { cfg!(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))) } + #[cfg_attr(target_os = "vxworks", allow(unused_unsafe))] pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result { #[cfg(not(any( all(target_os = "linux", not(target_env = "musl")), From a598ca0f86926c91f87992796f88d5dd80a5d244 Mon Sep 17 00:00:00 2001 From: B I Mohammed Abbas Date: Tue, 23 Jul 2024 10:52:53 +0530 Subject: [PATCH 10/18] Disable dirfd for vxworks, Return unsupported error from set_times and lchown for vxworks --- library/std/src/sys/pal/unix/fs.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/library/std/src/sys/pal/unix/fs.rs b/library/std/src/sys/pal/unix/fs.rs index f9d6b5fbc86a4..553b09bf40885 100644 --- a/library/std/src/sys/pal/unix/fs.rs +++ b/library/std/src/sys/pal/unix/fs.rs @@ -857,6 +857,7 @@ impl Drop for Dir { target_os = "espidf", target_os = "fuchsia", target_os = "horizon", + target_os = "vxworks", )))] { let fd = unsafe { libc::dirfd(self.0) }; @@ -1313,7 +1314,12 @@ impl File { } pub fn set_times(&self, times: FileTimes) -> io::Result<()> { - #[cfg(not(any(target_os = "redox", target_os = "espidf", target_os = "horizon")))] + #[cfg(not(any( + target_os = "redox", + target_os = "espidf", + target_os = "horizon", + target_os = "vxworks" + )))] let to_timespec = |time: Option| match time { Some(time) if let Some(ts) = time.t.to_timespec() => Ok(ts), Some(time) if time > crate::sys::time::UNIX_EPOCH => Err(io::const_io_error!( @@ -1327,10 +1333,11 @@ impl File { None => Ok(libc::timespec { tv_sec: 0, tv_nsec: libc::UTIME_OMIT as _ }), }; cfg_if::cfg_if! { - if #[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon"))] { + if #[cfg(any(target_os = "redox", target_os = "espidf", target_os = "horizon", target_os = "vxworks"))] { // Redox doesn't appear to support `UTIME_OMIT`. // ESP-IDF and HorizonOS do not support `futimens` at all and the behavior for those OS is therefore // the same as for Redox. + // `futimens` and `UTIME_OMIT` are a work in progress for vxworks. let _ = times; Err(io::const_io_error!( io::ErrorKind::Unsupported, @@ -1962,6 +1969,7 @@ pub fn fchown(fd: c_int, uid: u32, gid: u32) -> io::Result<()> { Ok(()) } +#[cfg(not(target_os = "vxworks"))] pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> { run_path_with_cstr(path, &|path| { cvt(unsafe { libc::lchown(path.as_ptr(), uid as libc::uid_t, gid as libc::gid_t) }) @@ -1969,6 +1977,12 @@ pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> { }) } +#[cfg(target_os = "vxworks")] +pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> { + let (_, _, _) = (path, uid, gid); + Err(io::const_io_error!(io::ErrorKind::Unsupported, "lchown not supported by vxworks",)) +} + #[cfg(not(any(target_os = "fuchsia", target_os = "vxworks")))] pub fn chroot(dir: &Path) -> io::Result<()> { run_path_with_cstr(dir, &|dir| cvt(unsafe { libc::chroot(dir.as_ptr()) }).map(|_| ())) From 5c9f3762d0e90ac97485f3b3eb99bcee647322c5 Mon Sep 17 00:00:00 2001 From: B I Mohammed Abbas Date: Tue, 23 Jul 2024 10:55:54 +0530 Subject: [PATCH 11/18] Cfg disable on_broken_pipe_flag_used() for vxworks --- library/std/src/sys/pal/unix/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/std/src/sys/pal/unix/mod.rs b/library/std/src/sys/pal/unix/mod.rs index d016e5e32d404..17960e4fe128f 100644 --- a/library/std/src/sys/pal/unix/mod.rs +++ b/library/std/src/sys/pal/unix/mod.rs @@ -210,6 +210,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { target_os = "emscripten", target_os = "fuchsia", target_os = "horizon", + target_os = "vxworks", )))] static ON_BROKEN_PIPE_FLAG_USED: crate::sync::atomic::AtomicBool = crate::sync::atomic::AtomicBool::new(false); @@ -219,6 +220,7 @@ static ON_BROKEN_PIPE_FLAG_USED: crate::sync::atomic::AtomicBool = target_os = "emscripten", target_os = "fuchsia", target_os = "horizon", + target_os = "vxworks", )))] pub(crate) fn on_broken_pipe_flag_used() -> bool { ON_BROKEN_PIPE_FLAG_USED.load(crate::sync::atomic::Ordering::Relaxed) From 786ad3d3ae8cd4dabf311d2cfcd5b03b420a249f Mon Sep 17 00:00:00 2001 From: B I Mohammed Abbas Date: Tue, 23 Jul 2024 16:58:00 +0530 Subject: [PATCH 12/18] Update process vxworks, set default stack size of 256 Kib for vxworks. User can set the stack size using RUST_MIN_STACK, with min size of libc::PTHREAD_STACK_MIN(4kib) --- library/std/src/sys/pal/unix/process/process_vxworks.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/std/src/sys/pal/unix/process/process_vxworks.rs b/library/std/src/sys/pal/unix/process/process_vxworks.rs index 5007dbd34b4ab..26b8a0a39dc44 100644 --- a/library/std/src/sys/pal/unix/process/process_vxworks.rs +++ b/library/std/src/sys/pal/unix/process/process_vxworks.rs @@ -3,8 +3,8 @@ use crate::io::{self, ErrorKind}; use crate::num::NonZero; use crate::sys; use crate::sys::cvt; +use crate::sys::pal::unix::thread; use crate::sys::process::process_common::*; -use crate::sys_common::thread; use libc::RTP_ID; use libc::{self, c_char, c_int}; @@ -68,7 +68,12 @@ impl Command { .as_ref() .map(|c| c.as_ptr()) .unwrap_or_else(|| *sys::os::environ() as *const _); - let stack_size = thread::min_stack(); + let stack_size = crate::cmp::max( + crate::env::var_os("RUST_MIN_STACK") + .and_then(|s| s.to_str().and_then(|s| s.parse().ok())) + .unwrap_or(thread::DEFAULT_MIN_STACK_SIZE), + libc::PTHREAD_STACK_MIN, + ); // ensure that access to the environment is synchronized let _lock = sys::os::env_read_lock(); From 23e346e706578d51ecbb873d71ab28bf154ebd45 Mon Sep 17 00:00:00 2001 From: donno2048 Date: Tue, 23 Jul 2024 19:38:47 +0000 Subject: [PATCH 13/18] make tidy fast without compromising case alternation --- src/tools/tidy/src/style.rs | 47 +++++++++++++++++++------------ src/tools/tidy/src/style/tests.rs | 19 ++++--------- 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index 8e693c35adcbf..8d8cc7ad6d398 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -18,9 +18,9 @@ // ignore-tidy-dbg use crate::walk::{filter_dirs, walk}; -use regex::RegexSet; +use regex::RegexSetBuilder; use rustc_hash::FxHashMap; -use std::{ffi::OsStr, path::Path}; +use std::{ffi::OsStr, path::Path, sync::LazyLock}; #[cfg(test)] mod tests; @@ -110,16 +110,26 @@ const ROOT_PROBLEMATIC_CONSTS: &[u32] = &[ 173390526, 721077, ]; +const LETTER_DIGIT: &[(char, char)] = &[('A', '4'), ('B', '8'), ('E', '3')]; + // Returns all permutations of problematic consts, over 2000 elements. fn generate_problematic_strings( consts: &[u32], letter_digit: &FxHashMap, ) -> Vec { generate_problems(consts, letter_digit) - .flat_map(|v| vec![v.to_string(), format!("{:x}", v), format!("{:X}", v)]) + .flat_map(|v| vec![v.to_string(), format!("{:X}", v)]) .collect() } +static PROBLEMATIC_CONSTS_STRINGS: LazyLock> = LazyLock::new(|| { + generate_problematic_strings(ROOT_PROBLEMATIC_CONSTS, &LETTER_DIGIT.iter().cloned().collect()) +}); + +fn contains_problematic_const(trimmed: &str) -> bool { + PROBLEMATIC_CONSTS_STRINGS.iter().any(|s| trimmed.to_uppercase().contains(s)) +} + const INTERNAL_COMPILER_DOCS_LINE: &str = "#### This error code is internal to the compiler and will not be emitted with normal Rust code."; /// Parser states for `line_is_url`. @@ -316,14 +326,14 @@ pub fn check(path: &Path, bad: &mut bool) { // We only check CSS files in rustdoc. path.extension().map_or(false, |e| e == "css") && !is_in(path, "src", "librustdoc") } - let problematic_consts_strings = generate_problematic_strings( - ROOT_PROBLEMATIC_CONSTS, - &[('A', '4'), ('B', '8'), ('E', '3')].iter().cloned().collect(), - ); + // This creates a RegexSet as regex contains performance optimizations to be able to deal with these over // 2000 needles efficiently. This runs over the entire source code, so performance matters. - let problematic_regex = RegexSet::new(problematic_consts_strings.as_slice()).unwrap(); - + let problematic_regex = RegexSetBuilder::new(PROBLEMATIC_CONSTS_STRINGS.as_slice()) + .case_insensitive(true) + .build() + .unwrap(); + let style_file = Path::new(file!()); walk(path, skip, &mut |entry, contents| { let file = entry.path(); let filename = file.file_name().unwrap().to_string_lossy(); @@ -389,10 +399,15 @@ pub fn check(path: &Path, bad: &mut bool) { let mut lines = 0; let mut last_safety_comment = false; let mut comment_block: Option<(usize, usize)> = None; - let is_test = file.components().any(|c| c.as_os_str() == "tests"); + let is_test = file.components().any(|c| c.as_os_str() == "tests") + || file.file_stem().unwrap() == "tests"; + let is_style = file.ends_with(style_file) || style_file.ends_with(file); + let is_style_test = + is_test && file.parent().unwrap().ends_with(style_file.with_extension("")); // scanning the whole file for multiple needles at once is more efficient than // executing lines times needles separate searches. - let any_problematic_line = problematic_regex.is_match(contents); + let any_problematic_line = + !is_style && !is_style_test && problematic_regex.is_match(contents); for (i, line) in contents.split('\n').enumerate() { if line.is_empty() { if i == 0 { @@ -451,7 +466,7 @@ pub fn check(path: &Path, bad: &mut bool) { if line.contains('\r') { suppressible_tidy_err!(err, skip_cr, "CR character"); } - if filename != "style.rs" { + if !is_style { // Allow using TODO in diagnostic suggestions by marking the // relevant line with `// ignore-tidy-todo`. if trimmed.contains("TODO") && !trimmed.contains("ignore-tidy-todo") { @@ -462,12 +477,8 @@ pub fn check(path: &Path, bad: &mut bool) { if trimmed.contains("//") && trimmed.contains(" XXX") { err("Instead of XXX use FIXME") } - if any_problematic_line { - for s in problematic_consts_strings.iter() { - if trimmed.contains(s) { - err("Don't use magic numbers that spell things (consider 0x12345678)"); - } - } + if any_problematic_line && contains_problematic_const(trimmed) { + err("Don't use magic numbers that spell things (consider 0x12345678)"); } } // for now we just check libcore diff --git a/src/tools/tidy/src/style/tests.rs b/src/tools/tidy/src/style/tests.rs index 292e23916d241..8a3586dad0e36 100644 --- a/src/tools/tidy/src/style/tests.rs +++ b/src/tools/tidy/src/style/tests.rs @@ -1,17 +1,10 @@ use super::*; #[test] -fn test_generate_problematic_strings() { - let problematic_regex = RegexSet::new( - generate_problematic_strings( - ROOT_PROBLEMATIC_CONSTS, - &[('A', '4'), ('B', '8'), ('E', '3'), ('0', 'F')].iter().cloned().collect(), // use "futile" F intentionally - ) - .as_slice(), - ) - .unwrap(); - assert!(problematic_regex.is_match("786357")); // check with no "decimal" hex digits - converted to integer - assert!(problematic_regex.is_match("589701")); // check with "decimal" replacements - converted to integer - assert!(problematic_regex.is_match("8FF85")); // check for hex display - assert!(!problematic_regex.is_match("1193046")); // check for non-matching value +fn test_contains_problematic_const() { + assert!(contains_problematic_const("721077")); // check with no "decimal" hex digits - converted to integer + assert!(contains_problematic_const("524421")); // check with "decimal" replacements - converted to integer + assert!(contains_problematic_const(&(285 * 281).to_string())); // check for hex display + assert!(contains_problematic_const(&format!("{:x}B5", 2816))); // check for case-alternating hex display + assert!(!contains_problematic_const("1193046")); // check for non-matching value } From b82f878f03a9133f61f4b652fea906322747a379 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Tue, 23 Jul 2024 19:10:22 -0400 Subject: [PATCH 14/18] Gate AsyncFn* under async_closure feature --- compiler/rustc_ast_lowering/src/path.rs | 22 +++++++++++++------ library/alloc/src/lib.rs | 1 + library/core/src/ops/async_function.rs | 6 ++--- tests/ui/async-await/async-fn/edition-2015.rs | 2 ++ .../async-await/async-fn/edition-2015.stderr | 22 ++++++++++++++++++- tests/ui/async-await/async-fn/simple.rs | 2 +- 6 files changed, 43 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/path.rs b/compiler/rustc_ast_lowering/src/path.rs index 6303584bb7846..ac36b07460969 100644 --- a/compiler/rustc_ast_lowering/src/path.rs +++ b/compiler/rustc_ast_lowering/src/path.rs @@ -44,13 +44,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let mut res = self.lower_res(base_res); // When we have an `async` kw on a bound, map the trait it resolves to. - let mut bound_modifier_allowed_features = None; if let Some(TraitBoundModifiers { asyncness: BoundAsyncness::Async(_), .. }) = modifiers { match res { Res::Def(DefKind::Trait, def_id) => { - if let Some((async_def_id, features)) = self.map_trait_to_async_trait(def_id) { + if let Some(async_def_id) = self.map_trait_to_async_trait(def_id) { res = Res::Def(DefKind::Trait, async_def_id); - bound_modifier_allowed_features = Some(features); } else { self.dcx().emit_err(AsyncBoundOnlyForFnTraits { span: p.span }); } @@ -67,6 +65,16 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } } + // Ungate the `async_fn_traits` feature in the path if the trait is + // named via either `async Fn*()` or `AsyncFn*()`. + let bound_modifier_allowed_features = if let Res::Def(DefKind::Trait, async_def_id) = res + && self.tcx.async_fn_trait_kind_from_def_id(async_def_id).is_some() + { + Some(self.allow_async_fn_traits.clone()) + } else { + None + }; + let path_span_lo = p.span.shrink_to_lo(); let proj_start = p.segments.len() - unresolved_segments; let path = self.arena.alloc(hir::Path { @@ -506,14 +514,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { /// This only needs to be done until we unify `AsyncFn` and `Fn` traits into one /// that is generic over `async`ness, if that's ever possible, or modify the /// lowering of `async Fn()` bounds to desugar to another trait like `LendingFn`. - fn map_trait_to_async_trait(&self, def_id: DefId) -> Option<(DefId, Lrc<[Symbol]>)> { + fn map_trait_to_async_trait(&self, def_id: DefId) -> Option { let lang_items = self.tcx.lang_items(); if Some(def_id) == lang_items.fn_trait() { - Some((lang_items.async_fn_trait()?, self.allow_async_fn_traits.clone())) + lang_items.async_fn_trait() } else if Some(def_id) == lang_items.fn_mut_trait() { - Some((lang_items.async_fn_mut_trait()?, self.allow_async_fn_traits.clone())) + lang_items.async_fn_mut_trait() } else if Some(def_id) == lang_items.fn_once_trait() { - Some((lang_items.async_fn_once_trait()?, self.allow_async_fn_traits.clone())) + lang_items.async_fn_once_trait() } else { None } diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index a7715740cbd8f..4491a717dc2ea 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -101,6 +101,7 @@ #![feature(array_windows)] #![feature(ascii_char)] #![feature(assert_matches)] +#![feature(async_closure)] #![feature(async_fn_traits)] #![feature(async_iterator)] #![feature(clone_to_uninit)] diff --git a/library/core/src/ops/async_function.rs b/library/core/src/ops/async_function.rs index 48d1042d9df4a..37fac2b126fac 100644 --- a/library/core/src/ops/async_function.rs +++ b/library/core/src/ops/async_function.rs @@ -4,7 +4,7 @@ use crate::marker::Tuple; /// An async-aware version of the [`Fn`](crate::ops::Fn) trait. /// /// All `async fn` and functions returning futures implement this trait. -#[unstable(feature = "async_fn_traits", issue = "none")] +#[unstable(feature = "async_closure", issue = "62290")] #[rustc_paren_sugar] #[fundamental] #[must_use = "async closures are lazy and do nothing unless called"] @@ -18,7 +18,7 @@ pub trait AsyncFn: AsyncFnMut { /// An async-aware version of the [`FnMut`](crate::ops::FnMut) trait. /// /// All `async fn` and functions returning futures implement this trait. -#[unstable(feature = "async_fn_traits", issue = "none")] +#[unstable(feature = "async_closure", issue = "62290")] #[rustc_paren_sugar] #[fundamental] #[must_use = "async closures are lazy and do nothing unless called"] @@ -39,7 +39,7 @@ pub trait AsyncFnMut: AsyncFnOnce { /// An async-aware version of the [`FnOnce`](crate::ops::FnOnce) trait. /// /// All `async fn` and functions returning futures implement this trait. -#[unstable(feature = "async_fn_traits", issue = "none")] +#[unstable(feature = "async_closure", issue = "62290")] #[rustc_paren_sugar] #[fundamental] #[must_use = "async closures are lazy and do nothing unless called"] diff --git a/tests/ui/async-await/async-fn/edition-2015.rs b/tests/ui/async-await/async-fn/edition-2015.rs index 83b9d415ddab4..50448313b301a 100644 --- a/tests/ui/async-await/async-fn/edition-2015.rs +++ b/tests/ui/async-await/async-fn/edition-2015.rs @@ -3,5 +3,7 @@ fn foo(x: impl async Fn()) -> impl async Fn() { x } //~| ERROR `async` trait bounds are only allowed in Rust 2018 or later //~| ERROR async closures are unstable //~| ERROR async closures are unstable +//~| ERROR use of unstable library feature 'async_closure' +//~| ERROR use of unstable library feature 'async_closure' fn main() {} diff --git a/tests/ui/async-await/async-fn/edition-2015.stderr b/tests/ui/async-await/async-fn/edition-2015.stderr index 0029d53868d4f..23ffee0d0a6b2 100644 --- a/tests/ui/async-await/async-fn/edition-2015.stderr +++ b/tests/ui/async-await/async-fn/edition-2015.stderr @@ -38,6 +38,26 @@ LL | fn foo(x: impl async Fn()) -> impl async Fn() { x } = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date = help: to use an async block, remove the `||`: `async {` -error: aborting due to 4 previous errors +error[E0658]: use of unstable library feature 'async_closure' + --> $DIR/edition-2015.rs:1:22 + | +LL | fn foo(x: impl async Fn()) -> impl async Fn() { x } + | ^^^^ + | + = note: see issue #62290 for more information + = help: add `#![feature(async_closure)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: use of unstable library feature 'async_closure' + --> $DIR/edition-2015.rs:1:42 + | +LL | fn foo(x: impl async Fn()) -> impl async Fn() { x } + | ^^^^ + | + = note: see issue #62290 for more information + = help: add `#![feature(async_closure)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/async-await/async-fn/simple.rs b/tests/ui/async-await/async-fn/simple.rs index 21972ba5aefad..3f15b08560af2 100644 --- a/tests/ui/async-await/async-fn/simple.rs +++ b/tests/ui/async-await/async-fn/simple.rs @@ -2,7 +2,7 @@ //@ edition: 2021 //@ build-pass -#![feature(async_fn_traits)] +#![feature(async_closure)] extern crate block_on; From 0ea5694c7c7e2ecda818262ef043ef8ef765ad3c Mon Sep 17 00:00:00 2001 From: B I Mohammed Abbas Date: Wed, 24 Jul 2024 09:59:04 +0530 Subject: [PATCH 15/18] Add chroot unsupported implementation for VxWorks --- library/std/src/os/unix/fs.rs | 2 +- library/std/src/sys/pal/unix/fs.rs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/library/std/src/os/unix/fs.rs b/library/std/src/os/unix/fs.rs index 970023d8cf19e..20c472040fadb 100644 --- a/library/std/src/os/unix/fs.rs +++ b/library/std/src/os/unix/fs.rs @@ -1064,7 +1064,7 @@ pub fn lchown>(dir: P, uid: Option, gid: Option) -> io: /// } /// ``` #[stable(feature = "unix_chroot", since = "1.56.0")] -#[cfg(not(any(target_os = "fuchsia", target_os = "vxworks")))] +#[cfg(not(target_os = "fuchsia"))] pub fn chroot>(dir: P) -> io::Result<()> { sys::fs::chroot(dir.as_ref()) } diff --git a/library/std/src/sys/pal/unix/fs.rs b/library/std/src/sys/pal/unix/fs.rs index 553b09bf40885..655565e614dc8 100644 --- a/library/std/src/sys/pal/unix/fs.rs +++ b/library/std/src/sys/pal/unix/fs.rs @@ -1980,7 +1980,7 @@ pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> { #[cfg(target_os = "vxworks")] pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> { let (_, _, _) = (path, uid, gid); - Err(io::const_io_error!(io::ErrorKind::Unsupported, "lchown not supported by vxworks",)) + Err(io::const_io_error!(io::ErrorKind::Unsupported, "lchown not supported by vxworks")) } #[cfg(not(any(target_os = "fuchsia", target_os = "vxworks")))] @@ -1988,6 +1988,12 @@ pub fn chroot(dir: &Path) -> io::Result<()> { run_path_with_cstr(dir, &|dir| cvt(unsafe { libc::chroot(dir.as_ptr()) }).map(|_| ())) } +#[cfg(target_os = "vxworks")] +pub fn chroot(dir: &Path) -> io::Result<()> { + let _ = dir; + Err(io::const_io_error!(io::ErrorKind::Unsupported, "chroot not supported by vxworks")) +} + pub use remove_dir_impl::remove_dir_all; // Fallback for REDOX, ESP-ID, Horizon, Vita, Vxworks and Miri From 9b87fbc3e5394a93489003aea38e44c2d2735c7b Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Wed, 24 Jul 2024 08:27:22 +0000 Subject: [PATCH 16/18] Import `core::ffi::c_void` in more places --- library/std/src/sys/pal/windows/alloc.rs | 8 ++++---- library/std/src/sys/pal/windows/c.rs | 24 +++++++++++------------ library/std/src/sys/pal/windows/handle.rs | 11 ++++++----- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/library/std/src/sys/pal/windows/alloc.rs b/library/std/src/sys/pal/windows/alloc.rs index 987be6b69eec9..020a2a4f3a28f 100644 --- a/library/std/src/sys/pal/windows/alloc.rs +++ b/library/std/src/sys/pal/windows/alloc.rs @@ -37,7 +37,7 @@ windows_targets::link!("kernel32.dll" "system" fn GetProcessHeap() -> c::HANDLE) // Note that `dwBytes` is allowed to be zero, contrary to some other allocators. // // See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-heapalloc -windows_targets::link!("kernel32.dll" "system" fn HeapAlloc(hheap: c::HANDLE, dwflags: u32, dwbytes: usize) -> *mut core::ffi::c_void); +windows_targets::link!("kernel32.dll" "system" fn HeapAlloc(hheap: c::HANDLE, dwflags: u32, dwbytes: usize) -> *mut c_void); // Reallocate a block of memory behind a given pointer `lpMem` from a given heap `hHeap`, // to a block of at least `dwBytes` bytes, either shrinking the block in place, @@ -61,9 +61,9 @@ windows_targets::link!("kernel32.dll" "system" fn HeapAlloc(hheap: c::HANDLE, dw windows_targets::link!("kernel32.dll" "system" fn HeapReAlloc( hheap: c::HANDLE, dwflags : u32, - lpmem: *const core::ffi::c_void, + lpmem: *const c_void, dwbytes: usize -) -> *mut core::ffi::c_void); +) -> *mut c_void); // Free a block of memory behind a given pointer `lpMem` from a given heap `hHeap`. // Returns a nonzero value if the operation is successful, and zero if the operation fails. @@ -79,7 +79,7 @@ windows_targets::link!("kernel32.dll" "system" fn HeapReAlloc( // Note that `lpMem` is allowed to be null, which will not cause the operation to fail. // // See https://docs.microsoft.com/windows/win32/api/heapapi/nf-heapapi-heapfree -windows_targets::link!("kernel32.dll" "system" fn HeapFree(hheap: c::HANDLE, dwflags: u32, lpmem: *const core::ffi::c_void) -> c::BOOL); +windows_targets::link!("kernel32.dll" "system" fn HeapFree(hheap: c::HANDLE, dwflags: u32, lpmem: *const c_void) -> c::BOOL); // Cached handle to the default heap of the current process. // Either a non-null handle returned by `GetProcessHeap`, or null when not yet initialized or `GetProcessHeap` failed. diff --git a/library/std/src/sys/pal/windows/c.rs b/library/std/src/sys/pal/windows/c.rs index f8d8398b8250e..fa350f4e58332 100644 --- a/library/std/src/sys/pal/windows/c.rs +++ b/library/std/src/sys/pal/windows/c.rs @@ -4,12 +4,10 @@ #![cfg_attr(test, allow(dead_code))] #![unstable(issue = "none", feature = "windows_c")] #![allow(clippy::style)] -#![allow(unsafe_op_in_unsafe_fn)] -use crate::ffi::CStr; -use crate::mem; -use crate::os::raw::{c_uint, c_ulong, c_ushort, c_void}; -use crate::ptr; +use core::ffi::{c_uint, c_ulong, c_ushort, c_void, CStr}; +use core::mem; +use core::ptr; pub(super) mod windows_targets; @@ -188,12 +186,12 @@ extern "system" { compat_fn_optional! { crate::sys::compat::load_synch_functions(); pub fn WaitOnAddress( - address: *const ::core::ffi::c_void, - compareaddress: *const ::core::ffi::c_void, + address: *const c_void, + compareaddress: *const c_void, addresssize: usize, dwmilliseconds: u32 ) -> BOOL; - pub fn WakeByAddressSingle(address: *const ::core::ffi::c_void); + pub fn WakeByAddressSingle(address: *const c_void); } #[cfg(any(target_vendor = "win7", target_vendor = "uwp"))] @@ -240,7 +238,7 @@ compat_fn_with_fallback! { shareaccess: FILE_SHARE_MODE, createdisposition: NTCREATEFILE_CREATE_DISPOSITION, createoptions: NTCREATEFILE_CREATE_OPTIONS, - eabuffer: *const ::core::ffi::c_void, + eabuffer: *const c_void, ealength: u32 ) -> NTSTATUS { STATUS_NOT_IMPLEMENTED @@ -250,9 +248,9 @@ compat_fn_with_fallback! { filehandle: HANDLE, event: HANDLE, apcroutine: PIO_APC_ROUTINE, - apccontext: *const core::ffi::c_void, + apccontext: *const c_void, iostatusblock: *mut IO_STATUS_BLOCK, - buffer: *mut core::ffi::c_void, + buffer: *mut c_void, length: u32, byteoffset: *const i64, key: *const u32 @@ -264,9 +262,9 @@ compat_fn_with_fallback! { filehandle: HANDLE, event: HANDLE, apcroutine: PIO_APC_ROUTINE, - apccontext: *const core::ffi::c_void, + apccontext: *const c_void, iostatusblock: *mut IO_STATUS_BLOCK, - buffer: *const core::ffi::c_void, + buffer: *const c_void, length: u32, byteoffset: *const i64, key: *const u32 diff --git a/library/std/src/sys/pal/windows/handle.rs b/library/std/src/sys/pal/windows/handle.rs index 94408f69e2503..e5b2da697821e 100644 --- a/library/std/src/sys/pal/windows/handle.rs +++ b/library/std/src/sys/pal/windows/handle.rs @@ -3,16 +3,17 @@ #[cfg(test)] mod tests; -use crate::cmp; use crate::io::{self, BorrowedCursor, ErrorKind, IoSlice, IoSliceMut, Read}; -use crate::mem; use crate::os::windows::io::{ AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, IntoRawHandle, OwnedHandle, RawHandle, }; -use crate::ptr; use crate::sys::c; use crate::sys::cvt; use crate::sys_common::{AsInner, FromInner, IntoInner}; +use core::cmp; +use core::ffi::c_void; +use core::mem; +use core::ptr; /// An owned container for `HANDLE` object, closing them on Drop. /// @@ -255,7 +256,7 @@ impl Handle { None, ptr::null_mut(), &mut io_status, - buf.cast::(), + buf.cast::(), len, offset.as_ref().map(|n| ptr::from_ref(n).cast::()).unwrap_or(ptr::null()), ptr::null(), @@ -305,7 +306,7 @@ impl Handle { None, ptr::null_mut(), &mut io_status, - buf.as_ptr().cast::(), + buf.as_ptr().cast::(), len, offset.as_ref().map(|n| ptr::from_ref(n).cast::()).unwrap_or(ptr::null()), ptr::null(), From 7cd25b1b1183a58c1f6652826e3ec5ed23f8d9ef Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Wed, 24 Jul 2024 08:28:47 +0000 Subject: [PATCH 17/18] Forbid unsafe_op_in_unsafe_fn in sys/pal/windows --- library/std/src/sys/pal/windows/c.rs | 8 ++++---- library/std/src/sys/pal/windows/compat.rs | 14 +++++++++----- library/std/src/sys/pal/windows/mod.rs | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/library/std/src/sys/pal/windows/c.rs b/library/std/src/sys/pal/windows/c.rs index fa350f4e58332..8ebcf10dd1f2e 100644 --- a/library/std/src/sys/pal/windows/c.rs +++ b/library/std/src/sys/pal/windows/c.rs @@ -134,26 +134,26 @@ compat_fn_with_fallback! { // >= Win10 1607 // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreaddescription pub fn SetThreadDescription(hthread: HANDLE, lpthreaddescription: PCWSTR) -> HRESULT { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED as u32); E_NOTIMPL + unsafe { SetLastError(ERROR_CALL_NOT_IMPLEMENTED as u32); E_NOTIMPL } } // >= Win10 1607 // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getthreaddescription pub fn GetThreadDescription(hthread: HANDLE, lpthreaddescription: *mut PWSTR) -> HRESULT { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED as u32); E_NOTIMPL + unsafe { SetLastError(ERROR_CALL_NOT_IMPLEMENTED as u32); E_NOTIMPL } } // >= Win8 / Server 2012 // https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime #[cfg(target_vendor = "win7")] pub fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> () { - GetSystemTimeAsFileTime(lpsystemtimeasfiletime) + unsafe { GetSystemTimeAsFileTime(lpsystemtimeasfiletime) } } // >= Win11 / Server 2022 // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2a pub fn GetTempPath2W(bufferlength: u32, buffer: PWSTR) -> u32 { - GetTempPathW(bufferlength, buffer) + unsafe { GetTempPathW(bufferlength, buffer) } } } diff --git a/library/std/src/sys/pal/windows/compat.rs b/library/std/src/sys/pal/windows/compat.rs index 49fa1603f3e1e..75232dfc0b0f1 100644 --- a/library/std/src/sys/pal/windows/compat.rs +++ b/library/std/src/sys/pal/windows/compat.rs @@ -158,8 +158,10 @@ macro_rules! compat_fn_with_fallback { static PTR: AtomicPtr = AtomicPtr::new(load as *mut _); unsafe extern "system" fn load($($argname: $argtype),*) -> $rettype { - let func = load_from_module(Module::new($module)); - func($($argname),*) + unsafe { + let func = load_from_module(Module::new($module)); + func($($argname),*) + } } fn load_from_module(module: Option) -> F { @@ -182,8 +184,10 @@ macro_rules! compat_fn_with_fallback { #[inline(always)] pub unsafe fn call($($argname: $argtype),*) -> $rettype { - let func: F = mem::transmute(PTR.load(Ordering::Relaxed)); - func($($argname),*) + unsafe { + let func: F = mem::transmute(PTR.load(Ordering::Relaxed)); + func($($argname),*) + } } } #[allow(unused)] @@ -225,7 +229,7 @@ macro_rules! compat_fn_optional { } #[inline] pub unsafe extern "system" fn $symbol($($argname: $argtype),*) $(-> $rettype)? { - $symbol::option().unwrap()($($argname),*) + unsafe { $symbol::option().unwrap()($($argname),*) } } )+ ) diff --git a/library/std/src/sys/pal/windows/mod.rs b/library/std/src/sys/pal/windows/mod.rs index b85a8318bcbbd..881ca17936d31 100644 --- a/library/std/src/sys/pal/windows/mod.rs +++ b/library/std/src/sys/pal/windows/mod.rs @@ -1,5 +1,5 @@ #![allow(missing_docs, nonstandard_style)] -#![deny(unsafe_op_in_unsafe_fn)] +#![forbid(unsafe_op_in_unsafe_fn)] use crate::ffi::{OsStr, OsString}; use crate::io::ErrorKind; From ac26b883bf3824de42e7adbf0fa69e24f2586ddf Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 24 Jul 2024 20:29:28 +1000 Subject: [PATCH 18/18] Improve spans on evaluated `cfg_attr`s. When converting something like `#![cfg_attr(cond, attr)]` into `#![attr]`, we currently duplicate the `#` token and the `!` token. But weirdly, there is also this comment: // We don't really have a good span to use for the synthesized `[]` // in `#[attr]`, so just use the span of the `#` token. Maybe that comment used to be true? But now it is false: we can duplicate the existing delimiters (and their spans and spacing), much like we do for the `#` and `!`. This commit does that, thus removing the incorrect comment, and improving the spans on `Group`s in a few proc-macro tests. --- compiler/rustc_expand/src/config.rs | 56 +++++++++---------- tests/ui/proc-macro/cfg-eval-inner.stdout | 6 +- tests/ui/proc-macro/cfg-eval.stdout | 4 +- tests/ui/proc-macro/expand-to-derive.stdout | 2 +- tests/ui/proc-macro/inner-attrs.stdout | 2 +- .../proc-macro/issue-75930-derive-cfg.stdout | 6 +- .../proc-macro/macro-rules-derive-cfg.stdout | 6 +- 7 files changed, 41 insertions(+), 41 deletions(-) diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs index 9da4aa84db525..6c02c237115c5 100644 --- a/compiler/rustc_expand/src/config.rs +++ b/compiler/rustc_expand/src/config.rs @@ -6,7 +6,7 @@ use crate::errors::{ }; use rustc_ast::ptr::P; use rustc_ast::token::{Delimiter, Token, TokenKind}; -use rustc_ast::tokenstream::{AttrTokenStream, AttrTokenTree, DelimSpacing, DelimSpan, Spacing}; +use rustc_ast::tokenstream::{AttrTokenStream, AttrTokenTree, Spacing}; use rustc_ast::tokenstream::{LazyAttrTokenStream, TokenTree}; use rustc_ast::NodeId; use rustc_ast::{self as ast, AttrStyle, Attribute, HasAttrs, HasTokens, MetaItem}; @@ -298,47 +298,47 @@ impl<'a> StripUnconfigured<'a> { cfg_attr: &Attribute, (item, item_span): (ast::AttrItem, Span), ) -> Attribute { - // We are taking an attribute of the form `#[cfg_attr(pred, attr)]` - // and producing an attribute of the form `#[attr]`. We - // have captured tokens for `attr` itself, but we need to - // synthesize tokens for the wrapper `#` and `[]`, which - // we do below. - - // Use the `#` in `#[cfg_attr(pred, attr)]` as the `#` token - // for `attr` when we expand it to `#[attr]` + // Convert `#[cfg_attr(pred, attr)]` to `#[attr]`. + + // Use the `#` from `#[cfg_attr(pred, attr)]` in the result `#[attr]`. let mut orig_trees = cfg_attr.token_trees().into_iter(); - let TokenTree::Token(pound_token @ Token { kind: TokenKind::Pound, .. }, _) = - orig_trees.next().unwrap().clone() + let Some(TokenTree::Token(pound_token @ Token { kind: TokenKind::Pound, .. }, _)) = + orig_trees.next() else { panic!("Bad tokens for attribute {cfg_attr:?}"); }; - // We don't really have a good span to use for the synthesized `[]` - // in `#[attr]`, so just use the span of the `#` token. - let bracket_group = AttrTokenTree::Delimited( - DelimSpan::from_single(pound_token.span), - DelimSpacing::new(Spacing::JointHidden, Spacing::Alone), - Delimiter::Bracket, - item.tokens - .as_ref() - .unwrap_or_else(|| panic!("Missing tokens for {item:?}")) - .to_attr_token_stream(), - ); - let trees = if cfg_attr.style == AttrStyle::Inner { - // For inner attributes, we do the same thing for the `!` in `#![some_attr]` - let TokenTree::Token(bang_token @ Token { kind: TokenKind::Not, .. }, _) = - orig_trees.next().unwrap().clone() + // For inner attributes, we do the same thing for the `!` in `#![attr]`. + let mut trees = if cfg_attr.style == AttrStyle::Inner { + let Some(TokenTree::Token(bang_token @ Token { kind: TokenKind::Not, .. }, _)) = + orig_trees.next() else { panic!("Bad tokens for attribute {cfg_attr:?}"); }; vec![ AttrTokenTree::Token(pound_token, Spacing::Joint), AttrTokenTree::Token(bang_token, Spacing::JointHidden), - bracket_group, ] } else { - vec![AttrTokenTree::Token(pound_token, Spacing::JointHidden), bracket_group] + vec![AttrTokenTree::Token(pound_token, Spacing::JointHidden)] }; + + // And the same thing for the `[`/`]` delimiters in `#[attr]`. + let Some(TokenTree::Delimited(delim_span, delim_spacing, Delimiter::Bracket, _)) = + orig_trees.next() + else { + panic!("Bad tokens for attribute {cfg_attr:?}"); + }; + trees.push(AttrTokenTree::Delimited( + delim_span, + delim_spacing, + Delimiter::Bracket, + item.tokens + .as_ref() + .unwrap_or_else(|| panic!("Missing tokens for {item:?}")) + .to_attr_token_stream(), + )); + let tokens = Some(LazyAttrTokenStream::new(AttrTokenStream::new(trees))); let attr = attr::mk_attr_from_item( &self.sess.psess.attr_id_generator, diff --git a/tests/ui/proc-macro/cfg-eval-inner.stdout b/tests/ui/proc-macro/cfg-eval-inner.stdout index 9fa8f437d0efa..1aac28b2ec2fb 100644 --- a/tests/ui/proc-macro/cfg-eval-inner.stdout +++ b/tests/ui/proc-macro/cfg-eval-inner.stdout @@ -73,7 +73,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/cfg-eval-inner.rs:19:40: 19:54 (#0), }, ], - span: $DIR/cfg-eval-inner.rs:19:5: 19:6 (#0), + span: $DIR/cfg-eval-inner.rs:19:7: 19:56 (#0), }, Punct { ch: '#', @@ -168,7 +168,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/cfg-eval-inner.rs:23:48: 23:70 (#0), }, ], - span: $DIR/cfg-eval-inner.rs:23:13: 23:14 (#0), + span: $DIR/cfg-eval-inner.rs:23:15: 23:72 (#0), }, Literal { kind: Integer, @@ -233,7 +233,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/cfg-eval-inner.rs:32:40: 32:56 (#0), }, ], - span: $DIR/cfg-eval-inner.rs:32:5: 32:6 (#0), + span: $DIR/cfg-eval-inner.rs:32:7: 32:58 (#0), }, Ident { ident: "fn", diff --git a/tests/ui/proc-macro/cfg-eval.stdout b/tests/ui/proc-macro/cfg-eval.stdout index e26e16f5a8ce8..5d88297ad6880 100644 --- a/tests/ui/proc-macro/cfg-eval.stdout +++ b/tests/ui/proc-macro/cfg-eval.stdout @@ -60,7 +60,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/cfg-eval.rs:22:36: 22:38 (#0), }, ], - span: $DIR/cfg-eval.rs:22:5: 22:6 (#0), + span: $DIR/cfg-eval.rs:22:6: 22:40 (#0), }, Ident { ident: "field_true", @@ -99,7 +99,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/cfg-eval.rs:35:62: 35:73 (#0), }, ], - span: $DIR/cfg-eval.rs:35:39: 35:40 (#0), + span: $DIR/cfg-eval.rs:35:40: 35:75 (#0), }, Group { delimiter: Parenthesis, diff --git a/tests/ui/proc-macro/expand-to-derive.stdout b/tests/ui/proc-macro/expand-to-derive.stdout index d59b7e5b88f45..81fc52ea22d7b 100644 --- a/tests/ui/proc-macro/expand-to-derive.stdout +++ b/tests/ui/proc-macro/expand-to-derive.stdout @@ -57,7 +57,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/expand-to-derive.rs:27:28: 27:39 (#0), }, ], - span: $DIR/expand-to-derive.rs:27:5: 27:6 (#0), + span: $DIR/expand-to-derive.rs:27:6: 27:41 (#0), }, Ident { ident: "struct", diff --git a/tests/ui/proc-macro/inner-attrs.stdout b/tests/ui/proc-macro/inner-attrs.stdout index c8d93babe3a48..ed47ee2cf5ac4 100644 --- a/tests/ui/proc-macro/inner-attrs.stdout +++ b/tests/ui/proc-macro/inner-attrs.stdout @@ -674,7 +674,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/inner-attrs.rs:41:52: 41:59 (#0), }, ], - span: $DIR/inner-attrs.rs:41:17: 41:18 (#0), + span: $DIR/inner-attrs.rs:41:19: 41:61 (#0), }, Ident { ident: "true", diff --git a/tests/ui/proc-macro/issue-75930-derive-cfg.stdout b/tests/ui/proc-macro/issue-75930-derive-cfg.stdout index cc712abf2a576..4dcf2b717d8a8 100644 --- a/tests/ui/proc-macro/issue-75930-derive-cfg.stdout +++ b/tests/ui/proc-macro/issue-75930-derive-cfg.stdout @@ -119,7 +119,7 @@ PRINT-ATTR INPUT (DEBUG): TokenStream [ span: $DIR/issue-75930-derive-cfg.rs:50:29: 50:40 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:50:1: 50:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:50:2: 50:42 (#0), }, Punct { ch: '#', @@ -1395,7 +1395,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/issue-75930-derive-cfg.rs:50:29: 50:40 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:50:1: 50:2 (#0), + span: $DIR/issue-75930-derive-cfg.rs:50:2: 50:42 (#0), }, Punct { ch: '#', @@ -1571,7 +1571,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/issue-75930-derive-cfg.rs:63:41: 63:51 (#0), }, ], - span: $DIR/issue-75930-derive-cfg.rs:63:13: 63:14 (#0), + span: $DIR/issue-75930-derive-cfg.rs:63:14: 63:53 (#0), }, Ident { ident: "false", diff --git a/tests/ui/proc-macro/macro-rules-derive-cfg.stdout b/tests/ui/proc-macro/macro-rules-derive-cfg.stdout index 257d59974b88d..fadf210127e4d 100644 --- a/tests/ui/proc-macro/macro-rules-derive-cfg.stdout +++ b/tests/ui/proc-macro/macro-rules-derive-cfg.stdout @@ -88,7 +88,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/macro-rules-derive-cfg.rs:19:59: 19:66 (#3), }, ], - span: $DIR/macro-rules-derive-cfg.rs:19:25: 19:26 (#3), + span: $DIR/macro-rules-derive-cfg.rs:19:26: 19:68 (#3), }, Punct { ch: '#', @@ -113,7 +113,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/macro-rules-derive-cfg.rs:26:47: 26:55 (#0), }, ], - span: $DIR/macro-rules-derive-cfg.rs:26:13: 26:14 (#0), + span: $DIR/macro-rules-derive-cfg.rs:26:14: 26:57 (#0), }, Group { delimiter: Brace, @@ -146,7 +146,7 @@ PRINT-DERIVE INPUT (DEBUG): TokenStream [ span: $DIR/macro-rules-derive-cfg.rs:27:34: 27:42 (#0), }, ], - span: $DIR/macro-rules-derive-cfg.rs:27:5: 27:6 (#0), + span: $DIR/macro-rules-derive-cfg.rs:27:7: 27:44 (#0), }, Literal { kind: Integer,