From cb4519e59c75b848e808a28f2046c8bc2f91b943 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Fri, 30 Jul 2021 17:28:44 +0100 Subject: [PATCH 01/18] os current_exe using same approach as linux to get always the full absolute path but in case of failure (e.g. prcfs not mounted) still using getexecname. --- library/std/src/sys/unix/os.rs | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs index cc0802ed709cb..14f0747bedcc3 100644 --- a/library/std/src/sys/unix/os.rs +++ b/library/std/src/sys/unix/os.rs @@ -368,20 +368,24 @@ pub fn current_exe() -> io::Result { #[cfg(any(target_os = "solaris", target_os = "illumos"))] pub fn current_exe() -> io::Result { - extern "C" { - fn getexecname() -> *const c_char; - } - unsafe { - let path = getexecname(); - if path.is_null() { - Err(io::Error::last_os_error()) - } else { - let filename = CStr::from_ptr(path).to_bytes(); - let path = PathBuf::from(::from_bytes(filename)); + if let Ok(path) = crate::fs::read_link("/proc/self/path/a.out") { + Ok(path) + } else { + extern "C" { + fn getexecname() -> *const c_char; + } + unsafe { + let path = getexecname(); + if path.is_null() { + Err(io::Error::last_os_error()) + } else { + let filename = CStr::from_ptr(path).to_bytes(); + let path = PathBuf::from(::from_bytes(filename)); - // Prepend a current working directory to the path if - // it doesn't contain an absolute pathname. - if filename[0] == b'/' { Ok(path) } else { getcwd().map(|cwd| cwd.join(path)) } + // Prepend a current working directory to the path if + // it doesn't contain an absolute pathname. + if filename[0] == b'/' { Ok(path) } else { getcwd().map(|cwd| cwd.join(path)) } + } } } } From ce450f893d551e25123e0bdb27acc9a85d15cb7f Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Sat, 4 Sep 2021 15:11:26 -0500 Subject: [PATCH 02/18] Use the 64b inner:monotonize() implementation not the 128b one for aarch64 aarch64 prior to v8.4 (FEAT_LSE2) doesn't have an instruction that guarantees untorn 128b reads except for completing a 128b load/store exclusive pair (ldxp/stxp) or compare-and-swap (casp) successfully. The requirement to complete a 128b read+write atomic is actually more expensive and more unfair than the previous implementation of monotonize() which used a Mutex on aarch64, especially at large core counts. For aarch64 switch to the 64b atomic implementation which is about 13x faster for a benchmark that involves many calls to Instant::now(). --- library/std/src/time/monotonic.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/std/src/time/monotonic.rs b/library/std/src/time/monotonic.rs index fa96b7abff6d6..5783fa760dff8 100644 --- a/library/std/src/time/monotonic.rs +++ b/library/std/src/time/monotonic.rs @@ -5,7 +5,7 @@ pub(super) fn monotonize(raw: time::Instant) -> time::Instant { inner::monotonize(raw) } -#[cfg(all(target_has_atomic = "64", not(target_has_atomic = "128")))] +#[cfg(any(all(target_has_atomic = "64", not(target_has_atomic = "128")), target_arch = "aarch64"))] pub mod inner { use crate::sync::atomic::AtomicU64; use crate::sync::atomic::Ordering::*; @@ -70,7 +70,7 @@ pub mod inner { } } -#[cfg(target_has_atomic = "128")] +#[cfg(all(target_has_atomic = "128", not(target_arch = "aarch64")))] pub mod inner { use crate::sync::atomic::AtomicU128; use crate::sync::atomic::Ordering::*; From 4f5563d0275118cbebbc2a3d3d60be1a7600adaa Mon Sep 17 00:00:00 2001 From: Orson Peters Date: Thu, 9 Sep 2021 16:58:41 +0200 Subject: [PATCH 03/18] Added abs_diff for integer types. --- library/core/src/num/int_macros.rs | 40 +++++++++++++++++++++++++++++ library/core/src/num/uint_macros.rs | 21 +++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 2a02545041dcf..187be5d47573a 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -2227,6 +2227,46 @@ macro_rules! int_impl { } } + /// Computes the absolute difference between `self` and `other`. + /// + /// This function always returns the correct answer without overflow or + /// panics by returning an unsigned integer. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(int_abs_diff)] + #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".abs_diff(80), 20", stringify!($UnsignedT), ");")] + #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".abs_diff(110), 10", stringify!($UnsignedT), ");")] + #[doc = concat!("assert_eq!((-100", stringify!($SelfT), ").abs_diff(80), 180", stringify!($UnsignedT), ");")] + #[doc = concat!("assert_eq!((-100", stringify!($SelfT), ").abs_diff(-120), 20", stringify!($UnsignedT), ");")] + #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.abs_diff(", stringify!($SelfT), "::MAX), ", stringify!($UnsignedT), "::MAX);")] + /// ``` + #[unstable(feature = "int_abs_diff", issue = "none")] + #[inline] + pub const fn abs_diff(self, other: Self) -> $UnsignedT { + if self < other { + // Converting a non-negative x from signed to unsigned by using + // `x as U` is left unchanged, but a negative x is converted + // to value x + 2^N. Thus if `s` and `o` are binary variables + // respectively indicating whether `self` and `other` are + // negative, we are computing the mathematical value: + // + // (other + o*2^N) - (self + s*2^N) mod 2^N + // other - self + (o-s)*2^N mod 2^N + // other - self mod 2^N + // + // Finally, taking the mod 2^N of the mathematical value of + // `other - self` does not change it as it already is + // in the range [0, 2^N). + (other as $UnsignedT).wrapping_sub(self as $UnsignedT) + } else { + (self as $UnsignedT).wrapping_sub(other as $UnsignedT) + } + } + /// Returns a number representing sign of `self`. /// /// - `0` if the number is zero diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index 7523d8ec976dd..1bba4179f9955 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -1490,6 +1490,27 @@ macro_rules! uint_impl { (c, b | d) } + /// Computes the absolute difference between `self` and `other`. + /// + /// # Examples + /// + /// Basic usage: + /// + /// ``` + /// #![feature(int_abs_diff)] + #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".abs_diff(80), 20", stringify!($SelfT), ");")] + #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".abs_diff(110), 10", stringify!($SelfT), ");")] + /// ``` + #[unstable(feature = "int_abs_diff", issue = "none")] + #[inline] + pub const fn abs_diff(self, other: Self) -> Self { + if self < other { + other - self + } else { + self - other + } + } + /// Calculates the multiplication of `self` and `rhs`. /// /// Returns a tuple of the multiplication along with a boolean From 77e7f8ae88910d64ebeba5689e90d7c1a01f2bf3 Mon Sep 17 00:00:00 2001 From: Orson Peters Date: Thu, 9 Sep 2021 23:01:28 +0200 Subject: [PATCH 04/18] Added psadbw support for u8::abs_diff. --- library/core/src/num/uint_macros.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index 1bba4179f9955..a5f12447fdc32 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -1504,10 +1504,16 @@ macro_rules! uint_impl { #[unstable(feature = "int_abs_diff", issue = "none")] #[inline] pub const fn abs_diff(self, other: Self) -> Self { - if self < other { - other - self + if mem::size_of::() == 1 { + // Trick LLVM into generating the psadbw instruction when SSE2 + // is available and this function is autovectorized for u8's. + (self as i32).wrapping_sub(other as i32).abs() as Self } else { - self - other + if self < other { + other - self + } else { + self - other + } } } From f83853e3426f829ec5331cbd62628ce23013df43 Mon Sep 17 00:00:00 2001 From: DeveloperC Date: Sat, 25 Sep 2021 13:09:17 +0100 Subject: [PATCH 05/18] refactor: VecDeques PairSlices fields to private --- library/alloc/src/collections/vec_deque/pair_slices.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/alloc/src/collections/vec_deque/pair_slices.rs b/library/alloc/src/collections/vec_deque/pair_slices.rs index 8e3ac9cfd1d87..6735424a3ef33 100644 --- a/library/alloc/src/collections/vec_deque/pair_slices.rs +++ b/library/alloc/src/collections/vec_deque/pair_slices.rs @@ -20,10 +20,10 @@ use super::VecDeque; /// /// and the uneven remainder of either A or B is skipped. pub struct PairSlices<'a, 'b, T> { - pub(crate) a0: &'a mut [T], - pub(crate) a1: &'a mut [T], - pub(crate) b0: &'b [T], - pub(crate) b1: &'b [T], + a0: &'a mut [T], + a1: &'a mut [T], + b0: &'b [T], + b1: &'b [T], } impl<'a, 'b, T> PairSlices<'a, 'b, T> { From e18a8efb8b8b87eb2576a12176c45dd59e5c5d18 Mon Sep 17 00:00:00 2001 From: Hirochika Matsumoto Date: Sat, 28 Aug 2021 22:01:56 +0900 Subject: [PATCH 06/18] Don't ignore impls for primitive types --- src/librustdoc/json/conversions.rs | 3 ++- src/librustdoc/json/mod.rs | 23 +++++++++++++++++++++-- src/rustdoc-json-types/lib.rs | 2 ++ src/test/rustdoc-json/primitive.rs | 14 ++++++++++++++ 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 src/test/rustdoc-json/primitive.rs diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index fda9070305797..830e54d51b673 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -218,6 +218,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum { ConstantItem(c) => ItemEnum::Constant(c.into_tcx(tcx)), MacroItem(m) => ItemEnum::Macro(m.source), ProcMacroItem(m) => ItemEnum::ProcMacro(m.into_tcx(tcx)), + PrimitiveItem(p) => ItemEnum::PrimitiveType(p.as_sym().to_string()), AssocConstItem(t, s) => ItemEnum::AssocConst { type_: t.into_tcx(tcx), default: s }, AssocTypeItem(g, t) => ItemEnum::AssocType { bounds: g.into_iter().map(|x| x.into_tcx(tcx)).collect(), @@ -225,7 +226,7 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum { }, // `convert_item` early returns `None` for striped items StrippedItem(_) => unreachable!(), - PrimitiveItem(_) | KeywordItem(_) => { + KeywordItem(_) => { panic!("{:?} is not supported for JSON output", item) } ExternCrateItem { ref src } => ItemEnum::ExternCrate { diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs index 5089cc30a1e39..ee81250864a48 100644 --- a/src/librustdoc/json/mod.rs +++ b/src/librustdoc/json/mod.rs @@ -69,7 +69,21 @@ impl JsonRenderer<'tcx> { .iter() .filter_map(|i| { let item = &i.impl_item; - if item.def_id.is_local() { + + // HACK(hkmatsumoto): For impls of primitive types, we index them + // regardless of whether they're local. This is because users can + // document primitive items in an arbitrary crate by using + // `doc(primitive)`. + let mut is_primitive_impl = false; + if let clean::types::ItemKind::ImplItem(ref impl_) = *item.kind { + if impl_.trait_.is_none() { + if let clean::types::Type::Primitive(_) = impl_.for_ { + is_primitive_impl = true; + } + } + } + + if item.def_id.is_local() || is_primitive_impl { self.item(item.clone()).unwrap(); Some(from_item_id(item.def_id)) } else { @@ -189,6 +203,11 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { fn after_krate(&mut self) -> Result<(), Error> { debug!("Done with crate"); + + for primitive in Rc::clone(&self.cache).primitive_locations.values() { + self.get_impls(primitive.clone()); + } + let mut index = (*self.index).clone().into_inner(); index.extend(self.get_trait_items()); // This needs to be the default HashMap for compatibility with the public interface for @@ -234,7 +253,7 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> { ) }) .collect(), - format_version: 7, + format_version: 8, }; let mut p = self.out_path.clone(); p.push(output.index.get(&output.root).unwrap().name.clone().unwrap()); diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index 37cdc94441df7..22debd296c236 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs @@ -221,6 +221,8 @@ pub enum ItemEnum { Macro(String), ProcMacro(ProcMacro), + PrimitiveType(String), + AssocConst { #[serde(rename = "type")] type_: Type, diff --git a/src/test/rustdoc-json/primitive.rs b/src/test/rustdoc-json/primitive.rs new file mode 100644 index 0000000000000..3a7d6d18c1bd0 --- /dev/null +++ b/src/test/rustdoc-json/primitive.rs @@ -0,0 +1,14 @@ +// edition:2018 + +#![feature(doc_primitive)] + +#[doc(primitive = "usize")] +mod usize {} + +// @set local_crate_id = primitive.json "$.index[*][?(@.name=='primitive')].crate_id" + +// @has - "$.index[*][?(@.name=='log10')]" +// @!is - "$.index[*][?(@.name=='log10')].crate_id" $local_crate_id +// @has - "$.index[*][?(@.name=='checked_add')]" +// @!is - "$.index[*][?(@.name=='checked_add')]" $local_crate_id +// @!has - "$.index[*][?(@.name=='is_ascii_uppercase')]" From e46fc9d1d9d6a768e349de25cbc718c1d9852283 Mon Sep 17 00:00:00 2001 From: Hirochika Matsumoto Date: Thu, 30 Sep 2021 00:11:14 +0900 Subject: [PATCH 07/18] Encode json files with UTF-8 --- src/etc/check_missing_items.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/check_missing_items.py b/src/etc/check_missing_items.py index 7572b8c6f4a8c..7ed317c778fce 100644 --- a/src/etc/check_missing_items.py +++ b/src/etc/check_missing_items.py @@ -9,7 +9,7 @@ import sys import json -crate = json.load(open(sys.argv[1])) +crate = json.load(open(sys.argv[1], encoding="utf-8")) def get_local_item(item_id): From 03cf07f85ff365c4b9f4fd048252bfd0d3334325 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 1 Oct 2021 20:51:38 -0700 Subject: [PATCH 08/18] Update to the final LLVM 13.0.0 release --- .gitmodules | 2 +- src/llvm-project | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index e22d576279042..c60a0dd2c7c43 100644 --- a/.gitmodules +++ b/.gitmodules @@ -34,7 +34,7 @@ [submodule "src/llvm-project"] path = src/llvm-project url = https://github.com/rust-lang/llvm-project.git - branch = rustc/13.0-2021-08-08 + branch = rustc/13.0-2021-09-30 [submodule "src/doc/embedded-book"] path = src/doc/embedded-book url = https://github.com/rust-embedded/book.git diff --git a/src/llvm-project b/src/llvm-project index 522c3e3d9c097..a7348ae0df3c7 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 522c3e3d9c097b53ede7682cc28544b461597b20 +Subproject commit a7348ae0df3c71581dbe3d355fc0fb6ce6332dd0 From 98dde56eb1b4bc5ef03d84c77d25e094f8d66403 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 2 Oct 2021 12:40:25 +0100 Subject: [PATCH 09/18] haiku thread affinity build fix --- library/std/src/sys/unix/thread.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/unix/thread.rs index 05f51a46168f6..5631834eca6fe 100644 --- a/library/std/src/sys/unix/thread.rs +++ b/library/std/src/sys/unix/thread.rs @@ -339,14 +339,18 @@ pub fn available_concurrency() -> io::Result { Ok(unsafe { NonZeroUsize::new_unchecked(cpus as usize) }) } else if #[cfg(target_os = "haiku")] { - let mut sinfo: libc::system_info = crate::mem::zeroed(); - let res = libc::get_system_info(&mut sinfo); + // system_info cpu_count field gets the static data set at boot time with `smp_set_num_cpus` + // `get_system_info` calls then `smp_get_num_cpus` + unsafe { + let mut sinfo: libc::system_info = crate::mem::zeroed(); + let res = libc::get_system_info(&mut sinfo); - if res != libc::B_OK { - return Err(io::Error::last_os_error()); - } + if res != libc::B_OK { + return Err(io::Error::new_const(io::ErrorKind::NotFound, &"The number of hardware threads is not known for the target platform")); + } - Ok(unsafe { NonZeroUsize::new_unchecked(sinfo.cpu_count as usize) }) + Ok(NonZeroUsize::new_unchecked(sinfo.cpu_count as usize)) + } } else { // FIXME: implement on vxWorks, Redox, l4re Err(io::Error::new_const(io::ErrorKind::Unsupported, &"Getting the number of hardware threads is not supported on the target platform")) From fb0b1a54663ca96dd406847b9268cda547f0d8d6 Mon Sep 17 00:00:00 2001 From: Hirochika Matsumoto Date: Sun, 3 Oct 2021 14:28:39 +0900 Subject: [PATCH 10/18] Follow the diagnostic output style guide --- compiler/rustc_const_eval/src/transform/check_consts/ops.rs | 2 +- compiler/rustc_typeck/src/check/check.rs | 2 +- .../cmse-nonsecure-call/wrong-abi-location-1.stderr | 2 +- .../cmse-nonsecure-call/wrong-abi-location-2.stderr | 2 +- .../min_const_fn/min_const_fn_libstd_stability.stderr | 6 +++--- .../min_const_unsafe_fn_libstd_stability.stderr | 6 +++--- .../min_const_unsafe_fn_libstd_stability2.stderr | 6 +++--- src/test/ui/rfc-2632-const-trait-impl/stability.stderr | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs index 1d0ee949a221b..c24e9c2df7de3 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs @@ -102,7 +102,7 @@ impl NonConstOp for FnCallUnstable { ); if ccx.is_const_stable_const_fn() { - err.help("Const-stable functions can only call other const-stable functions"); + err.help("const-stable functions can only call other const-stable functions"); } else if ccx.tcx.sess.is_nightly_build() { if let Some(feature) = feature { err.help(&format!( diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs index 47da8e9572b7c..db50c5d891e13 100644 --- a/compiler/rustc_typeck/src/check/check.rs +++ b/compiler/rustc_typeck/src/check/check.rs @@ -58,7 +58,7 @@ pub(super) fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: Ab tcx.sess, span, E0781, - "the `\"C-cmse-nonsecure-call\"` ABI is only allowed on function pointers." + "the `\"C-cmse-nonsecure-call\"` ABI is only allowed on function pointers" ) .emit() } diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr index 3564ab4b6cd4d..08b763b260822 100644 --- a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr @@ -1,4 +1,4 @@ -error[E0781]: the `"C-cmse-nonsecure-call"` ABI is only allowed on function pointers. +error[E0781]: the `"C-cmse-nonsecure-call"` ABI is only allowed on function pointers --> $DIR/wrong-abi-location-1.rs:8:1 | LL | pub extern "C-cmse-nonsecure-call" fn test() {} diff --git a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr index 76073f548848a..3ade9891e48a5 100644 --- a/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr +++ b/src/test/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr @@ -1,4 +1,4 @@ -error[E0781]: the `"C-cmse-nonsecure-call"` ABI is only allowed on function pointers. +error[E0781]: the `"C-cmse-nonsecure-call"` ABI is only allowed on function pointers --> $DIR/wrong-abi-location-2.rs:8:1 | LL | / extern "C-cmse-nonsecure-call" { diff --git a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr index d3017c5602a8c..778b0e55f6620 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr @@ -4,7 +4,7 @@ error: `foo` is not yet stable as a const fn LL | const fn bar() -> u32 { foo() } | ^^^^^ | - = help: Const-stable functions can only call other const-stable functions + = help: const-stable functions can only call other const-stable functions error: `foo2` is not yet stable as a const fn --> $DIR/min_const_fn_libstd_stability.rs:24:26 @@ -12,7 +12,7 @@ error: `foo2` is not yet stable as a const fn LL | const fn bar2() -> u32 { foo2() } | ^^^^^^ | - = help: Const-stable functions can only call other const-stable functions + = help: const-stable functions can only call other const-stable functions error: const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]` --> $DIR/min_const_fn_libstd_stability.rs:29:26 @@ -35,7 +35,7 @@ error: `foo2_gated` is not yet stable as a const fn LL | const fn bar2_gated() -> u32 { foo2_gated() } | ^^^^^^^^^^^^ | - = help: Const-stable functions can only call other const-stable functions + = help: const-stable functions can only call other const-stable functions error: aborting due to 4 previous errors diff --git a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr index 53a59467e3d20..0174cb77f332d 100644 --- a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr @@ -4,7 +4,7 @@ error: `foo` is not yet stable as a const fn LL | const unsafe fn bar() -> u32 { unsafe { foo() } } | ^^^^^ | - = help: Const-stable functions can only call other const-stable functions + = help: const-stable functions can only call other const-stable functions error: `foo2` is not yet stable as a const fn --> $DIR/min_const_unsafe_fn_libstd_stability.rs:24:42 @@ -12,7 +12,7 @@ error: `foo2` is not yet stable as a const fn LL | const unsafe fn bar2() -> u32 { unsafe { foo2() } } | ^^^^^^ | - = help: Const-stable functions can only call other const-stable functions + = help: const-stable functions can only call other const-stable functions error: const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]` --> $DIR/min_const_unsafe_fn_libstd_stability.rs:29:33 @@ -35,7 +35,7 @@ error: `foo2_gated` is not yet stable as a const fn LL | const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } } | ^^^^^^^^^^^^ | - = help: Const-stable functions can only call other const-stable functions + = help: const-stable functions can only call other const-stable functions error: aborting due to 4 previous errors diff --git a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr index 891c34a888a70..e90ba9b912fe1 100644 --- a/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability2.stderr @@ -4,7 +4,7 @@ error: `foo` is not yet stable as a const fn LL | const unsafe fn bar() -> u32 { foo() } | ^^^^^ | - = help: Const-stable functions can only call other const-stable functions + = help: const-stable functions can only call other const-stable functions error: `foo2` is not yet stable as a const fn --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:24:33 @@ -12,7 +12,7 @@ error: `foo2` is not yet stable as a const fn LL | const unsafe fn bar2() -> u32 { foo2() } | ^^^^^^ | - = help: Const-stable functions can only call other const-stable functions + = help: const-stable functions can only call other const-stable functions error: `foo2_gated` is not yet stable as a const fn --> $DIR/min_const_unsafe_fn_libstd_stability2.rs:33:39 @@ -20,7 +20,7 @@ error: `foo2_gated` is not yet stable as a const fn LL | const unsafe fn bar2_gated() -> u32 { foo2_gated() } | ^^^^^^^^^^^^ | - = help: Const-stable functions can only call other const-stable functions + = help: const-stable functions can only call other const-stable functions error: aborting due to 3 previous errors diff --git a/src/test/ui/rfc-2632-const-trait-impl/stability.stderr b/src/test/ui/rfc-2632-const-trait-impl/stability.stderr index 86b685959a6cb..5649f688fe7c6 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/stability.stderr +++ b/src/test/ui/rfc-2632-const-trait-impl/stability.stderr @@ -13,7 +13,7 @@ error: `::add` is not yet stable as a const fn LL | Int(1i32) + Int(2i32) | ^^^^^^^^^^^^^^^^^^^^^ | - = help: Const-stable functions can only call other const-stable functions + = help: const-stable functions can only call other const-stable functions error: aborting due to 2 previous errors From a0cc9bb0f681e6ee9130d6683bf836fee36570f6 Mon Sep 17 00:00:00 2001 From: Stefan Schindler Date: Fri, 10 Sep 2021 13:40:38 +0200 Subject: [PATCH 11/18] Add a test to detect overlapping entries in overview tables Detects https://github.com/rust-lang/rust/issues/88545 --- .../rustdoc-gui/huge-collection-of-constants.goml | 5 +++++ src/test/rustdoc-gui/src/test_docs/Cargo.toml | 2 ++ src/test/rustdoc-gui/src/test_docs/build.rs | 15 +++++++++++++++ src/test/rustdoc-gui/src/test_docs/lib.rs | 4 ++++ 4 files changed, 26 insertions(+) create mode 100644 src/test/rustdoc-gui/huge-collection-of-constants.goml create mode 100644 src/test/rustdoc-gui/src/test_docs/build.rs diff --git a/src/test/rustdoc-gui/huge-collection-of-constants.goml b/src/test/rustdoc-gui/huge-collection-of-constants.goml new file mode 100644 index 0000000000000..924fab1ea9106 --- /dev/null +++ b/src/test/rustdoc-gui/huge-collection-of-constants.goml @@ -0,0 +1,5 @@ +goto: file://|DOC_PATH|/test_docs/huge_amount_of_consts/index.html + +// Make sure that the last two entries are more than 12 pixels apart and not stacked on each other. + +compare-elements-position-near-false: ("//*[@class='item-table']//div[last()-1]", "//*[@class='item-table']//div[last()-3]", {"y": 12}) diff --git a/src/test/rustdoc-gui/src/test_docs/Cargo.toml b/src/test/rustdoc-gui/src/test_docs/Cargo.toml index 7f3c65746fcf8..5f527078e79a8 100644 --- a/src/test/rustdoc-gui/src/test_docs/Cargo.toml +++ b/src/test/rustdoc-gui/src/test_docs/Cargo.toml @@ -3,5 +3,7 @@ name = "test_docs" version = "0.1.0" edition = "2018" +build = "build.rs" + [lib] path = "lib.rs" diff --git a/src/test/rustdoc-gui/src/test_docs/build.rs b/src/test/rustdoc-gui/src/test_docs/build.rs new file mode 100644 index 0000000000000..16c96ded9120c --- /dev/null +++ b/src/test/rustdoc-gui/src/test_docs/build.rs @@ -0,0 +1,15 @@ +//! generate 2000 constants for testing + +use std::{fs::write, path::PathBuf}; + +fn main() -> std::io::Result<()> { + let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR is not defined"); + + let mut output = String::new(); + for i in 0..2000 { + let line = format!("/// Some const A{0}\npub const A{0}: isize = 0;\n", i); + output.push_str(&*line); + }; + + write(&[&*out_dir, "huge_amount_of_consts.rs"].iter().collect::(), output) +} diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index af4f28047fc0d..0aa1426a36abf 100644 --- a/src/test/rustdoc-gui/src/test_docs/lib.rs +++ b/src/test/rustdoc-gui/src/test_docs/lib.rs @@ -116,3 +116,7 @@ pub mod keyword {} /// Just some type alias. pub type SomeType = u32; + +pub mod huge_amount_of_consts { + include!(concat!(env!("OUT_DIR"), "/huge_amount_of_consts.rs")); +} From 677fb6b1dba6666ded51c42638acbdfe877244b2 Mon Sep 17 00:00:00 2001 From: Stefan Schindler Date: Sat, 11 Sep 2021 18:43:22 +0200 Subject: [PATCH 12/18] Show how many tests are running in parallel --- src/tools/rustdoc-gui/tester.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/rustdoc-gui/tester.js b/src/tools/rustdoc-gui/tester.js index d34dcc0f0942f..b598c63f52ac8 100644 --- a/src/tools/rustdoc-gui/tester.js +++ b/src/tools/rustdoc-gui/tester.js @@ -172,7 +172,7 @@ async function main(argv) { } files.sort(); - console.log(`Running ${files.length} rustdoc-gui tests...`); + console.log(`Running ${files.length} rustdoc-gui (${opts["jobs"]} concurrently) ...`); if (opts["jobs"] < 1) { process.setMaxListeners(files.length + 1); From e599e2df49adae96d482a3a3a0364e7668abd14e Mon Sep 17 00:00:00 2001 From: Stefan Schindler Date: Sun, 12 Sep 2021 01:18:39 +0200 Subject: [PATCH 13/18] Move from grid layout to table based layout because of browser limits that overlay row entries after a UA specific amount of rows --- src/librustdoc/html/render/print_item.rs | 19 ++++++++----------- src/librustdoc/html/static/css/rustdoc.css | 19 +++++++++---------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index fa0d211efe630..28b2eded7cc3e 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -34,6 +34,8 @@ use crate::html::markdown::MarkdownSummaryLine; const ITEM_TABLE_OPEN: &'static str = "
"; const ITEM_TABLE_CLOSE: &'static str = "
"; +const ITEM_TABLE_ROW_OPEN: &'static str = "
"; +const ITEM_TABLE_ROW_CLOSE: &'static str = "
"; pub(super) fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer, page: &Page<'_>) { debug_assert!(!item.is_stripped()); @@ -256,9 +258,6 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl debug!("{:?}", indices); let mut curty = None; - // See: https://github.com/rust-lang/rust/issues/88545 - let item_table_block_size = 900usize; - let mut item_table_nth_element = 0usize; for &idx in &indices { let myitem = &items[idx]; @@ -285,13 +284,13 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl id = cx.derive_id(short.to_owned()), name = name ); - item_table_nth_element = 0; } match *myitem.kind { clean::ExternCrateItem { ref src } => { use crate::html::format::anchor; + w.write_str(ITEM_TABLE_ROW_OPEN); match *src { Some(ref src) => write!( w, @@ -312,6 +311,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl ), } w.write_str(""); + w.write_str(ITEM_TABLE_ROW_CLOSE); } clean::ImportItem(ref import) => { @@ -336,6 +336,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl let add = if stab.is_some() { " " } else { "" }; + w.write_str(ITEM_TABLE_ROW_OPEN); write!( w, "
\ @@ -348,6 +349,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl imp = import.print(cx), stab_tags = stab_tags.unwrap_or_default(), ); + w.write_str(ITEM_TABLE_ROW_CLOSE); } _ => { @@ -368,6 +370,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl let add = if stab.is_some() { " " } else { "" }; let doc_value = myitem.doc_value().unwrap_or_default(); + w.write_str(ITEM_TABLE_ROW_OPEN); write!( w, "
\ @@ -390,15 +393,9 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl .collect::>() .join(" "), ); + w.write_str(ITEM_TABLE_ROW_CLOSE); } } - - item_table_nth_element += 1; - if item_table_nth_element > item_table_block_size { - w.write_str(ITEM_TABLE_CLOSE); - w.write_str(ITEM_TABLE_OPEN); - item_table_nth_element = 0; - } } if curty.is_some() { diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index eb7cc9309f416..341d9b80fd82d 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -773,22 +773,18 @@ h2.small-section-header > .anchor { .block a.current.crate { font-weight: 500; } .item-table { - display: grid; - column-gap: 1.2rem; - row-gap: 0.0rem; - grid-template-columns: auto 1fr; + display: table-row; /* align content left */ justify-items: start; } - +.item-row { + display: table-row; +} .item-left, .item-right { - display: block; + display: table-cell; } .item-left { - grid-column: 1; -} -.item-right { - grid-column: 2; + padding-right: 1.2rem; } .search-container { @@ -1891,6 +1887,9 @@ details.undocumented[open] > summary::before { /* Display an alternating layout on tablets and phones */ .item-table { + display: block; + } + .item-row { display: flex; flex-flow: column wrap; } From 9626f2bd84ccf99635dfdbca3da782db3596190a Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Sat, 2 Oct 2021 22:18:11 +0200 Subject: [PATCH 14/18] Fix extra `non_snake_case` warning for shorthand field bindings --- compiler/rustc_lint/src/nonstandard_style.rs | 13 +++++++------ src/test/ui/lint/issue-89469.rs | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 src/test/ui/lint/issue-89469.rs diff --git a/compiler/rustc_lint/src/nonstandard_style.rs b/compiler/rustc_lint/src/nonstandard_style.rs index 03344973bb3e6..bcddc4f3d7643 100644 --- a/compiler/rustc_lint/src/nonstandard_style.rs +++ b/compiler/rustc_lint/src/nonstandard_style.rs @@ -437,12 +437,13 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase { if let hir::Node::Pat(parent_pat) = cx.tcx.hir().get(cx.tcx.hir().get_parent_node(hid)) { if let PatKind::Struct(_, field_pats, _) = &parent_pat.kind { - for field in field_pats.iter() { - if field.ident != ident { - // Only check if a new name has been introduced, to avoid warning - // on both the struct definition and this pattern. - self.check_snake_case(cx, "variable", &ident); - } + if field_pats + .iter() + .any(|field| !field.is_shorthand && field.pat.hir_id == p.hir_id) + { + // Only check if a new name has been introduced, to avoid warning + // on both the struct definition and this pattern. + self.check_snake_case(cx, "variable", &ident); } return; } diff --git a/src/test/ui/lint/issue-89469.rs b/src/test/ui/lint/issue-89469.rs new file mode 100644 index 0000000000000..3a6ab452840ac --- /dev/null +++ b/src/test/ui/lint/issue-89469.rs @@ -0,0 +1,20 @@ +// Regression test for #89469, where an extra non_snake_case warning was +// reported for a shorthand field binding. + +// check-pass +#![deny(non_snake_case)] + +#[allow(non_snake_case)] +struct Entry { + A: u16, + a: u16 +} + +fn foo() -> Entry {todo!()} + +pub fn f() { + let Entry { A, a } = foo(); + let _ = (A, a); +} + +fn main() {} From 6dd6e7c002bae653a3db236e2c0d5ec25f8810b5 Mon Sep 17 00:00:00 2001 From: Orson Peters Date: Sun, 3 Oct 2021 17:44:07 +0200 Subject: [PATCH 15/18] Added tracking issue numbers for int_abs_diff. --- library/core/src/num/int_macros.rs | 2 +- library/core/src/num/uint_macros.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 187be5d47573a..14a3a1dda8eb5 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -2244,7 +2244,7 @@ macro_rules! int_impl { #[doc = concat!("assert_eq!((-100", stringify!($SelfT), ").abs_diff(-120), 20", stringify!($UnsignedT), ");")] #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.abs_diff(", stringify!($SelfT), "::MAX), ", stringify!($UnsignedT), "::MAX);")] /// ``` - #[unstable(feature = "int_abs_diff", issue = "none")] + #[unstable(feature = "int_abs_diff", issue = "89492")] #[inline] pub const fn abs_diff(self, other: Self) -> $UnsignedT { if self < other { diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index a5f12447fdc32..4fdba778b3406 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -1501,7 +1501,7 @@ macro_rules! uint_impl { #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".abs_diff(80), 20", stringify!($SelfT), ");")] #[doc = concat!("assert_eq!(100", stringify!($SelfT), ".abs_diff(110), 10", stringify!($SelfT), ");")] /// ``` - #[unstable(feature = "int_abs_diff", issue = "none")] + #[unstable(feature = "int_abs_diff", issue = "89492")] #[inline] pub const fn abs_diff(self, other: Self) -> Self { if mem::size_of::() == 1 { From e34fd546111c3cad82c91a9f466284d55a53e5fb Mon Sep 17 00:00:00 2001 From: Fabian Wolff Date: Sun, 3 Oct 2021 17:58:10 +0200 Subject: [PATCH 16/18] Deny `where` clauses on `auto` traits --- .../rustc_ast_passes/src/ast_validation.rs | 49 ++++++++++++++----- .../auto-traits/auto-trait-validation.fixed | 13 +++++ .../ui/auto-traits/auto-trait-validation.rs | 8 ++- .../auto-traits/auto-trait-validation.stderr | 31 +++++++----- src/test/ui/auto-traits/issue-23080-2.stderr | 6 +-- src/test/ui/auto-traits/issue-23080.stderr | 13 +++-- src/test/ui/auto-traits/issue-84075.rs | 16 ++++++ src/test/ui/auto-traits/issue-84075.stderr | 11 +++++ .../typeck-auto-trait-no-supertraits-2.rs | 1 + .../typeck-auto-trait-no-supertraits-2.stderr | 18 +++++-- .../typeck-auto-trait-no-supertraits.stderr | 8 +-- .../supertrait-auto-trait.stderr | 8 +-- 12 files changed, 135 insertions(+), 47 deletions(-) create mode 100644 src/test/ui/auto-traits/auto-trait-validation.fixed create mode 100644 src/test/ui/auto-traits/issue-84075.rs create mode 100644 src/test/ui/auto-traits/issue-84075.stderr diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index 24108f779c818..0f5580db30f63 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -683,31 +683,53 @@ impl<'a> AstValidator<'a> { } } + fn emit_e0568(&self, span: Span, ident_span: Span) { + struct_span_err!( + self.session, + span, + E0568, + "auto traits cannot have super traits or lifetime bounds" + ) + .span_label(ident_span, "auto trait cannot have super traits or lifetime bounds") + .span_suggestion( + span, + "remove the super traits or lifetime bounds", + String::new(), + Applicability::MachineApplicable, + ) + .emit(); + } + fn deny_super_traits(&self, bounds: &GenericBounds, ident_span: Span) { - if let [first @ last] | [first, .., last] = &bounds[..] { - let span = first.span().to(last.span()); - struct_span_err!(self.session, span, E0568, "auto traits cannot have super traits") - .span_label(ident_span, "auto trait cannot have super traits") - .span_suggestion( - span, - "remove the super traits", - String::new(), - Applicability::MachineApplicable, - ) - .emit(); + if let [.., last] = &bounds[..] { + let span = ident_span.shrink_to_hi().to(last.span()); + self.emit_e0568(span, ident_span); + } + } + + fn deny_where_clause(&self, where_clause: &WhereClause, ident_span: Span) { + if !where_clause.predicates.is_empty() { + self.emit_e0568(where_clause.span, ident_span); } } fn deny_items(&self, trait_items: &[P], ident_span: Span) { if !trait_items.is_empty() { let spans: Vec<_> = trait_items.iter().map(|i| i.ident.span).collect(); + let total_span = trait_items.first().unwrap().span.to(trait_items.last().unwrap().span); struct_span_err!( self.session, spans, E0380, - "auto traits cannot have methods or associated items" + "auto traits cannot have associated items" + ) + .span_suggestion( + total_span, + "remove these associated items", + String::new(), + Applicability::MachineApplicable, ) - .span_label(ident_span, "auto trait cannot have items") + .span_label(ident_span, "auto trait cannot have associated items") .emit(); } } @@ -1184,6 +1206,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { // Auto traits cannot have generics, super traits nor contain items. self.deny_generic_params(generics, item.ident.span); self.deny_super_traits(bounds, item.ident.span); + self.deny_where_clause(&generics.where_clause, item.ident.span); self.deny_items(trait_items, item.ident.span); } self.no_questions_in_bounds(bounds, "supertraits", true); diff --git a/src/test/ui/auto-traits/auto-trait-validation.fixed b/src/test/ui/auto-traits/auto-trait-validation.fixed new file mode 100644 index 0000000000000..da878ac6222bb --- /dev/null +++ b/src/test/ui/auto-traits/auto-trait-validation.fixed @@ -0,0 +1,13 @@ +#![feature(auto_traits)] + +// run-rustfix + +auto trait Generic {} +//~^ auto traits cannot have generic parameters [E0567] +auto trait Bound {} +//~^ auto traits cannot have super traits or lifetime bounds [E0568] +auto trait LifetimeBound {} +//~^ auto traits cannot have super traits or lifetime bounds [E0568] +auto trait MyTrait { } +//~^ auto traits cannot have associated items [E0380] +fn main() {} diff --git a/src/test/ui/auto-traits/auto-trait-validation.rs b/src/test/ui/auto-traits/auto-trait-validation.rs index a997b044c8ff8..d43055e270bd5 100644 --- a/src/test/ui/auto-traits/auto-trait-validation.rs +++ b/src/test/ui/auto-traits/auto-trait-validation.rs @@ -1,9 +1,13 @@ #![feature(auto_traits)] +// run-rustfix + auto trait Generic {} //~^ auto traits cannot have generic parameters [E0567] auto trait Bound : Copy {} -//~^ auto traits cannot have super traits [E0568] +//~^ auto traits cannot have super traits or lifetime bounds [E0568] +auto trait LifetimeBound : 'static {} +//~^ auto traits cannot have super traits or lifetime bounds [E0568] auto trait MyTrait { fn foo() {} } -//~^ auto traits cannot have methods or associated items [E0380] +//~^ auto traits cannot have associated items [E0380] fn main() {} diff --git a/src/test/ui/auto-traits/auto-trait-validation.stderr b/src/test/ui/auto-traits/auto-trait-validation.stderr index 4040e66c6af77..2c380e5b09a6e 100644 --- a/src/test/ui/auto-traits/auto-trait-validation.stderr +++ b/src/test/ui/auto-traits/auto-trait-validation.stderr @@ -1,28 +1,37 @@ error[E0567]: auto traits cannot have generic parameters - --> $DIR/auto-trait-validation.rs:3:19 + --> $DIR/auto-trait-validation.rs:5:19 | LL | auto trait Generic {} | -------^^^ help: remove the parameters | | | auto trait cannot have generic parameters -error[E0568]: auto traits cannot have super traits - --> $DIR/auto-trait-validation.rs:5:20 +error[E0568]: auto traits cannot have super traits or lifetime bounds + --> $DIR/auto-trait-validation.rs:7:17 | LL | auto trait Bound : Copy {} - | ----- ^^^^ help: remove the super traits + | -----^^^^^^^ help: remove the super traits or lifetime bounds | | - | auto trait cannot have super traits + | auto trait cannot have super traits or lifetime bounds -error[E0380]: auto traits cannot have methods or associated items - --> $DIR/auto-trait-validation.rs:7:25 +error[E0568]: auto traits cannot have super traits or lifetime bounds + --> $DIR/auto-trait-validation.rs:9:25 | -LL | auto trait MyTrait { fn foo() {} } - | ------- ^^^ +LL | auto trait LifetimeBound : 'static {} + | -------------^^^^^^^^^^ help: remove the super traits or lifetime bounds | | - | auto trait cannot have items + | auto trait cannot have super traits or lifetime bounds + +error[E0380]: auto traits cannot have associated items + --> $DIR/auto-trait-validation.rs:11:25 + | +LL | auto trait MyTrait { fn foo() {} } + | ------- ---^^^----- + | | | + | | help: remove these associated items + | auto trait cannot have associated items -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors Some errors have detailed explanations: E0380, E0567, E0568. For more information about an error, try `rustc --explain E0380`. diff --git a/src/test/ui/auto-traits/issue-23080-2.stderr b/src/test/ui/auto-traits/issue-23080-2.stderr index efeceafdd2a7d..267a712f62fa0 100644 --- a/src/test/ui/auto-traits/issue-23080-2.stderr +++ b/src/test/ui/auto-traits/issue-23080-2.stderr @@ -1,10 +1,10 @@ -error[E0380]: auto traits cannot have methods or associated items +error[E0380]: auto traits cannot have associated items --> $DIR/issue-23080-2.rs:5:10 | LL | unsafe auto trait Trait { - | ----- auto trait cannot have items + | ----- auto trait cannot have associated items LL | type Output; - | ^^^^^^ + | -----^^^^^^- help: remove these associated items error: aborting due to previous error diff --git a/src/test/ui/auto-traits/issue-23080.stderr b/src/test/ui/auto-traits/issue-23080.stderr index 73ecb1c362e17..c1b16b2f403d7 100644 --- a/src/test/ui/auto-traits/issue-23080.stderr +++ b/src/test/ui/auto-traits/issue-23080.stderr @@ -1,10 +1,13 @@ -error[E0380]: auto traits cannot have methods or associated items +error[E0380]: auto traits cannot have associated items --> $DIR/issue-23080.rs:5:8 | -LL | unsafe auto trait Trait { - | ----- auto trait cannot have items -LL | fn method(&self) { - | ^^^^^^ +LL | unsafe auto trait Trait { + | ----- auto trait cannot have associated items +LL | fn method(&self) { + | _____- ^^^^^^ +LL | | println!("Hello"); +LL | | } + | |_____- help: remove these associated items error: aborting due to previous error diff --git a/src/test/ui/auto-traits/issue-84075.rs b/src/test/ui/auto-traits/issue-84075.rs new file mode 100644 index 0000000000000..a6afe24ea4c8b --- /dev/null +++ b/src/test/ui/auto-traits/issue-84075.rs @@ -0,0 +1,16 @@ +// Regression test for issue #84075. + +#![feature(auto_traits)] + +auto trait Magic where Self: Copy {} //~ ERROR E0568 +impl Magic for T {} + +fn copy(x: T) -> (T, T) { (x, x) } + +#[derive(Debug)] +struct NoClone; + +fn main() { + let (a, b) = copy(NoClone); + println!("{:?} {:?}", a, b); +} diff --git a/src/test/ui/auto-traits/issue-84075.stderr b/src/test/ui/auto-traits/issue-84075.stderr new file mode 100644 index 0000000000000..02dca598ec250 --- /dev/null +++ b/src/test/ui/auto-traits/issue-84075.stderr @@ -0,0 +1,11 @@ +error[E0568]: auto traits cannot have super traits or lifetime bounds + --> $DIR/issue-84075.rs:5:18 + | +LL | auto trait Magic where Self: Copy {} + | ----- ^^^^^^^^^^^^^^^^ help: remove the super traits or lifetime bounds + | | + | auto trait cannot have super traits or lifetime bounds + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0568`. diff --git a/src/test/ui/auto-traits/typeck-auto-trait-no-supertraits-2.rs b/src/test/ui/auto-traits/typeck-auto-trait-no-supertraits-2.rs index 6cceaf821f6bf..98359ef51b764 100644 --- a/src/test/ui/auto-traits/typeck-auto-trait-no-supertraits-2.rs +++ b/src/test/ui/auto-traits/typeck-auto-trait-no-supertraits-2.rs @@ -2,6 +2,7 @@ #![feature(negative_impls)] auto trait Magic : Sized where Option : Magic {} //~ ERROR E0568 +//~^ ERROR E0568 impl Magic for T {} fn copy(x: T) -> (T, T) { (x, x) } diff --git a/src/test/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr b/src/test/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr index 63b3300f6dbf4..4827916fa5c53 100644 --- a/src/test/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr +++ b/src/test/ui/auto-traits/typeck-auto-trait-no-supertraits-2.stderr @@ -1,11 +1,19 @@ -error[E0568]: auto traits cannot have super traits - --> $DIR/typeck-auto-trait-no-supertraits-2.rs:4:20 +error[E0568]: auto traits cannot have super traits or lifetime bounds + --> $DIR/typeck-auto-trait-no-supertraits-2.rs:4:17 | LL | auto trait Magic : Sized where Option : Magic {} - | ----- ^^^^^ help: remove the super traits + | -----^^^^^^^^ help: remove the super traits or lifetime bounds | | - | auto trait cannot have super traits + | auto trait cannot have super traits or lifetime bounds -error: aborting due to previous error +error[E0568]: auto traits cannot have super traits or lifetime bounds + --> $DIR/typeck-auto-trait-no-supertraits-2.rs:4:26 + | +LL | auto trait Magic : Sized where Option : Magic {} + | ----- ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the super traits or lifetime bounds + | | + | auto trait cannot have super traits or lifetime bounds + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0568`. diff --git a/src/test/ui/auto-traits/typeck-auto-trait-no-supertraits.stderr b/src/test/ui/auto-traits/typeck-auto-trait-no-supertraits.stderr index 796638fc54dce..d7716f4b61f04 100644 --- a/src/test/ui/auto-traits/typeck-auto-trait-no-supertraits.stderr +++ b/src/test/ui/auto-traits/typeck-auto-trait-no-supertraits.stderr @@ -1,10 +1,10 @@ -error[E0568]: auto traits cannot have super traits - --> $DIR/typeck-auto-trait-no-supertraits.rs:28:19 +error[E0568]: auto traits cannot have super traits or lifetime bounds + --> $DIR/typeck-auto-trait-no-supertraits.rs:28:17 | LL | auto trait Magic: Copy {} - | ----- ^^^^ help: remove the super traits + | -----^^^^^^ help: remove the super traits or lifetime bounds | | - | auto trait cannot have super traits + | auto trait cannot have super traits or lifetime bounds error: aborting due to previous error diff --git a/src/test/ui/traits/inductive-overflow/supertrait-auto-trait.stderr b/src/test/ui/traits/inductive-overflow/supertrait-auto-trait.stderr index 7895e50eef5c4..8405d7ddc7aa5 100644 --- a/src/test/ui/traits/inductive-overflow/supertrait-auto-trait.stderr +++ b/src/test/ui/traits/inductive-overflow/supertrait-auto-trait.stderr @@ -1,10 +1,10 @@ -error[E0568]: auto traits cannot have super traits - --> $DIR/supertrait-auto-trait.rs:8:19 +error[E0568]: auto traits cannot have super traits or lifetime bounds + --> $DIR/supertrait-auto-trait.rs:8:17 | LL | auto trait Magic: Copy {} - | ----- ^^^^ help: remove the super traits + | -----^^^^^^ help: remove the super traits or lifetime bounds | | - | auto trait cannot have super traits + | auto trait cannot have super traits or lifetime bounds error[E0277]: the trait bound `NoClone: Copy` is not satisfied --> $DIR/supertrait-auto-trait.rs:16:23 From fdd8a0dde53e09b2f0ec869088fcb1d882031bd6 Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Sun, 3 Oct 2021 16:29:34 -0500 Subject: [PATCH 17/18] Don't suggest replacing region with 'static in NLL Fixes #73159 This is similar to #69350 - if the user didn't initially write out a 'static lifetime, adding 'static in response to a lifetime error is usually the wrong thing to do. --- .../src/diagnostics/outlives_suggestion.rs | 4 +-- ...-fn-ret-contravariant.transmute.nll.stderr | 2 -- ...ject-fn-ret-invariant.transmute.nll.stderr | 2 -- .../expect-fn-supply-fn.nll.stderr | 2 -- .../expect-region-supply-region-2.nll.stderr | 2 -- .../ui/hrtb/hrtb-just-for-static.nll.stderr | 2 -- .../hrtb/hrtb-perfect-forwarding.nll.stderr | 2 -- .../dyn-trait.nll.stderr | 2 -- ...t_outlive_least_region_or_bound.nll.stderr | 3 -- .../static-return-lifetime-infered.nll.stderr | 1 - src/test/ui/issues/issue-10291.nll.stderr | 2 -- src/test/ui/issues/issue-26217.nll.stderr | 2 -- src/test/ui/issues/issue-54943.nll.stderr | 2 -- src/test/ui/issues/issue-55796.nll.stderr | 4 --- src/test/ui/issues/issue-75777.nll.stderr | 2 -- ...etime-bound-will-change-warning.nll.stderr | 4 --- src/test/ui/lub-if.nll.stderr | 4 --- src/test/ui/lub-match.nll.stderr | 4 --- ...oximated-shorter-to-static-no-bound.stderr | 2 -- ...mated-shorter-to-static-wrong-bound.stderr | 2 -- ...n-lbr-named-does-not-outlive-static.stderr | 2 -- src/test/ui/nll/issue-50716.nll.stderr | 2 -- src/test/ui/nll/issue-55401.nll.stderr | 2 -- src/test/ui/nll/issue-58299.stderr | 4 --- src/test/ui/nll/issue-73159-rpit-static.rs | 14 ++++++++ .../ui/nll/issue-73159-rpit-static.stderr | 10 ++++++ src/test/ui/nll/mir_check_cast_reify.stderr | 2 -- .../ui/nll/mir_check_cast_unsafe_fn.stderr | 2 -- src/test/ui/nll/mir_check_cast_unsize.stderr | 2 -- .../ui/nll/outlives-suggestion-more.stderr | 4 --- .../ui/nll/outlives-suggestion-simple.stderr | 4 --- .../ui/nll/ty-outlives/wf-unreachable.stderr | 16 ---------- .../user-annotations/closure-substs.stderr | 4 --- .../constant-in-expr-inherent-1.nll.stderr | 2 -- .../constant-in-expr-normalize.nll.stderr | 2 -- .../constant-in-expr-trait-item-1.nll.stderr | 2 -- .../constant-in-expr-trait-item-2.nll.stderr | 2 -- .../constant-in-expr-trait-item-3.nll.stderr | 2 -- .../inherent-associated-constants.stderr | 2 -- .../nll/user-annotations/issue-54124.stderr | 2 -- ...-55748-pat-types-constrain-bindings.stderr | 6 ---- .../issue-57731-ascibed-coupled-types.stderr | 8 ----- .../ui/nll/user-annotations/patterns.stderr | 8 ----- ...ime-default-from-rptr-box-error.nll.stderr | 2 -- ...-default-from-rptr-struct-error.nll.stderr | 2 -- .../object-lifetime-default-mybox.nll.stderr | 2 -- ...nvariant-static-error-reporting.nll.stderr | 2 -- ...unded-by-trait-requiring-static.nll.stderr | 12 ------- ...-bounded-method-type-parameters.nll.stderr | 2 -- ...ions-close-object-into-object-2.nll.stderr | 2 -- ...ions-close-object-into-object-4.nll.stderr | 2 -- ...ns-infer-invariance-due-to-decl.nll.stderr | 2 -- ...-invariance-due-to-mutability-3.nll.stderr | 2 -- ...-invariance-due-to-mutability-4.nll.stderr | 2 -- .../ui/regions/regions-nested-fns.nll.stderr | 2 -- .../regions-static-bound.migrate.nll.stderr | 2 -- .../regions/regions-static-bound.nll.stderr | 2 -- ...ariance-invariant-use-covariant.nll.stderr | 2 -- ...rait-with-implicit-static-bound.nll.stderr | 8 ----- ...ait-object-nested-in-impl-trait.nll.stderr | 3 -- .../variance-associated-types2.nll.stderr | 2 -- .../variance-btree-invariant-types.nll.stderr | 32 ------------------- 62 files changed, 25 insertions(+), 214 deletions(-) create mode 100644 src/test/ui/nll/issue-73159-rpit-static.rs create mode 100644 src/test/ui/nll/issue-73159-rpit-static.stderr diff --git a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs index 9de0c62f186c0..b15e55cd6675e 100644 --- a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs +++ b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs @@ -171,9 +171,7 @@ impl OutlivesSuggestionBuilder { let outlived_fr_name = self.region_vid_to_name(mbcx, errci.outlived_fr); if let (Some(fr_name), Some(outlived_fr_name)) = (fr_name, outlived_fr_name) { - if let RegionNameSource::Static = outlived_fr_name.source { - diag.help(&format!("consider replacing `{}` with `'static`", fr_name)); - } else { + if !matches!(outlived_fr_name.source, RegionNameSource::Static) { diag.help(&format!( "consider adding the following bound: `{}: {}`", fr_name, outlived_fr_name diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr index 558f394ef8644..f532c96ed2cc7 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr @@ -5,8 +5,6 @@ LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | bar(foo, x) | ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr index db82c9fd43794..c417cdd543e4d 100644 --- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr +++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr @@ -6,8 +6,6 @@ LL | fn baz<'a, 'b>(x: Type<'a>) -> Type<'static> { ... LL | bar(foo, x) | ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr index 768dc8e12db50..26f47eb684dfc 100644 --- a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr +++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr @@ -18,8 +18,6 @@ LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) { ... LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {}); | ^ requires that `'x` must outlive `'static` - | - = help: consider replacing `'x` with `'static` error[E0308]: mismatched types --> $DIR/expect-fn-supply-fn.rs:32:49 diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.nll.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.nll.stderr index 52bca8dd63e1f..9aab51c986cac 100644 --- a/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.nll.stderr +++ b/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.nll.stderr @@ -17,8 +17,6 @@ LL | fn expect_bound_supply_named<'x>() { ... LL | closure_expecting_bound(|x: &'x u32| { | ^ requires that `'x` must outlive `'static` - | - = help: consider replacing `'x` with `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/hrtb/hrtb-just-for-static.nll.stderr b/src/test/ui/hrtb/hrtb-just-for-static.nll.stderr index 17d59bb321a45..a5770431eaff1 100644 --- a/src/test/ui/hrtb/hrtb-just-for-static.nll.stderr +++ b/src/test/ui/hrtb/hrtb-just-for-static.nll.stderr @@ -14,8 +14,6 @@ LL | fn give_some<'a>() { | -- lifetime `'a` defined here LL | want_hrtb::<&'a u32>() | ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: implementation of `Foo` is not general enough --> $DIR/hrtb-just-for-static.rs:30:5 diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr index aefe3cdfd6487..68da46d46bd14 100644 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.nll.stderr @@ -54,8 +54,6 @@ LL | fn foo_hrtb_bar_not<'b, T>(mut t: T) ... LL | foo_hrtb_bar_not(&mut t); | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'b` must outlive `'static` - | - = help: consider replacing `'b` with `'static` error: implementation of `Bar` is not general enough --> $DIR/hrtb-perfect-forwarding.rs:43:5 diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr index d72435bc63111..e49bd9da754d6 100644 --- a/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr @@ -5,8 +5,6 @@ LL | fn with_dyn_debug_static<'a>(x: Box) { | - `x` is a reference that is only valid in the function body LL | static_val(x); | ^^^^^^^^^^^^^ `x` escapes the function body here - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr index 3b75939ff02c5..812093e6e7621 100644 --- a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr +++ b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr @@ -19,7 +19,6 @@ LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x } | | | lifetime `'a` defined here | - = help: consider replacing `'a` with `'static` help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a bound | LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x } @@ -42,7 +41,6 @@ LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x } | -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static` | = help: consider replacing `'a` with `'static` - = help: consider replacing `'a` with `'static` error[E0621]: explicit lifetime required in the type of `x` --> $DIR/must_outlive_least_region_or_bound.rs:11:41 @@ -67,7 +65,6 @@ LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x } | -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static` | = help: consider replacing `'a` with `'static` - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/must_outlive_least_region_or_bound.rs:32:61 diff --git a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr index 05a9ed1d4e15d..a3aeff50eee4c 100644 --- a/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr +++ b/src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr @@ -19,7 +19,6 @@ LL | fn iter_values<'a>(&'a self) -> impl Iterator { | | | lifetime `'a` defined here | - = help: consider replacing `'a` with `'static` help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a bound | LL | fn iter_values<'a>(&'a self) -> impl Iterator + 'a { diff --git a/src/test/ui/issues/issue-10291.nll.stderr b/src/test/ui/issues/issue-10291.nll.stderr index 1ebb0c6cf1e7b..a7b827d27a87b 100644 --- a/src/test/ui/issues/issue-10291.nll.stderr +++ b/src/test/ui/issues/issue-10291.nll.stderr @@ -6,8 +6,6 @@ LL | fn test<'x>(x: &'x isize) { LL | drop:: FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { LL | x | ^ returning this value requires that `'x` must outlive `'static` - | - = help: consider replacing `'x` with `'static` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-26217.nll.stderr b/src/test/ui/issues/issue-26217.nll.stderr index 83f10c67d43a5..c7601caacdca3 100644 --- a/src/test/ui/issues/issue-26217.nll.stderr +++ b/src/test/ui/issues/issue-26217.nll.stderr @@ -5,8 +5,6 @@ LL | fn bar<'a>() { | -- lifetime `'a` defined here LL | foo::<&'a i32>(); | ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-54943.nll.stderr b/src/test/ui/issues/issue-54943.nll.stderr index 5bf6d3382d2eb..59be0f983b907 100644 --- a/src/test/ui/issues/issue-54943.nll.stderr +++ b/src/test/ui/issues/issue-54943.nll.stderr @@ -6,8 +6,6 @@ LL | fn boo<'a>() { ... LL | let x = foo::<&'a u32>(); | ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-55796.nll.stderr b/src/test/ui/issues/issue-55796.nll.stderr index 61d4070d485e7..c1a3084f30eae 100644 --- a/src/test/ui/issues/issue-55796.nll.stderr +++ b/src/test/ui/issues/issue-55796.nll.stderr @@ -6,8 +6,6 @@ LL | pub trait Graph<'a> { ... LL | Box::new(self.out_edges(u).map(|e| e.target())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/issue-55796.rs:23:9 @@ -17,8 +15,6 @@ LL | pub trait Graph<'a> { ... LL | Box::new(self.in_edges(u).map(|e| e.target())) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-75777.nll.stderr b/src/test/ui/issues/issue-75777.nll.stderr index 98aacb1711906..d779753687ed5 100644 --- a/src/test/ui/issues/issue-75777.nll.stderr +++ b/src/test/ui/issues/issue-75777.nll.stderr @@ -6,8 +6,6 @@ LL | fn inject<'a, Env: 'a, A: 'a + Send>(v: A) -> Box Bo LL | let fut: BoxFuture<'a, A> = Box::pin(future::ready(v)); LL | Box::new(move |_| fut) | ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr index 57dab46df6b6a..050d5fcf05ef4 100644 --- a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr +++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr @@ -6,8 +6,6 @@ LL | fn test2<'a>(x: &'a Box) { LL | // but ref_obj will not, so warn. LL | ref_obj(x) | ^^^^^^^^^^ `x` escapes the function body here - | - = help: consider replacing `'a` with `'static` error[E0521]: borrowed data escapes outside of function --> $DIR/lifetime-bound-will-change-warning.rs:39:5 @@ -17,8 +15,6 @@ LL | fn test2cc<'a>(x: &'a Box) { LL | // same as test2, but cross crate LL | lib::ref_obj(x) | ^^^^^^^^^^^^^^^ `x` escapes the function body here - | - = help: consider replacing `'a` with `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/lub-if.nll.stderr b/src/test/ui/lub-if.nll.stderr index 1ef479fcd4bc0..832688f5162b3 100644 --- a/src/test/ui/lub-if.nll.stderr +++ b/src/test/ui/lub-if.nll.stderr @@ -6,8 +6,6 @@ LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { ... LL | s | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/lub-if.rs:35:9 @@ -17,8 +15,6 @@ LL | pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { ... LL | s | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/lub-match.nll.stderr b/src/test/ui/lub-match.nll.stderr index ed551da54f55e..3a344a77d2c2d 100644 --- a/src/test/ui/lub-match.nll.stderr +++ b/src/test/ui/lub-match.nll.stderr @@ -6,8 +6,6 @@ LL | pub fn opt_str2<'a>(maybestr: &'a Option) -> &'static str { ... LL | s | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/lub-match.rs:39:13 @@ -17,8 +15,6 @@ LL | pub fn opt_str3<'a>(maybestr: &'a Option) -> &'static str { ... LL | s | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr index 29993b129c71a..d17a40a95c1b8 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-no-bound.stderr @@ -46,8 +46,6 @@ LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) LL | | }); | |______^ `cell_a` escapes the function body here - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr index cb505d8b1eceb..06c46ec8259a0 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-wrong-bound.stderr @@ -46,8 +46,6 @@ LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) LL | | }); | |______^ `cell_a` escapes the function body here - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr index 1fa3d01017af5..d0a24a267fd4f 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr +++ b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr @@ -5,8 +5,6 @@ LL | fn foo<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | &*x | ^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-50716.nll.stderr b/src/test/ui/nll/issue-50716.nll.stderr index 7b83e4beaf387..38dd1b5f6fe73 100644 --- a/src/test/ui/nll/issue-50716.nll.stderr +++ b/src/test/ui/nll/issue-50716.nll.stderr @@ -6,8 +6,6 @@ LL | fn foo<'a, T: 'static>(s: Box<<&'a T as A>::X>) ... LL | let _x = *s; | ^^ proving this value is `Sized` requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-55401.nll.stderr b/src/test/ui/nll/issue-55401.nll.stderr index df320aa0844ad..4f797f26a1a7c 100644 --- a/src/test/ui/nll/issue-55401.nll.stderr +++ b/src/test/ui/nll/issue-55401.nll.stderr @@ -6,8 +6,6 @@ LL | fn static_to_a_to_static_through_ref_in_tuple<'a>(x: &'a u32) -> &'static u LL | let (ref y, _z): (&'a u32, u32) = (&22, 44); LL | *y | ^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/issue-58299.stderr b/src/test/ui/nll/issue-58299.stderr index 5be4e56171c52..aba07542d026e 100644 --- a/src/test/ui/nll/issue-58299.stderr +++ b/src/test/ui/nll/issue-58299.stderr @@ -6,8 +6,6 @@ LL | fn foo<'a>(x: i32) { ... LL | A::<'a>::X..=A::<'static>::X => (), | ^^^^^^^^^^ requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/issue-58299.rs:24:27 @@ -17,8 +15,6 @@ LL | fn bar<'a>(x: i32) { ... LL | A::<'static>::X..=A::<'a>::X => (), | ^^^^^^^^^^ requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/issue-73159-rpit-static.rs b/src/test/ui/nll/issue-73159-rpit-static.rs new file mode 100644 index 0000000000000..a5455a3f9eb7b --- /dev/null +++ b/src/test/ui/nll/issue-73159-rpit-static.rs @@ -0,0 +1,14 @@ +// Regression test for issue #73159 +// Tests thar we don't suggest replacing 'a with 'static' + +#![feature(nll)] + +struct Foo<'a>(&'a [u8]); + +impl<'a> Foo<'a> { + fn make_it(&self) -> impl Iterator { //~ ERROR lifetime may not live + self.0.iter().copied() + } +} + +fn main() {} diff --git a/src/test/ui/nll/issue-73159-rpit-static.stderr b/src/test/ui/nll/issue-73159-rpit-static.stderr new file mode 100644 index 0000000000000..60b1552701af9 --- /dev/null +++ b/src/test/ui/nll/issue-73159-rpit-static.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/issue-73159-rpit-static.rs:9:26 + | +LL | impl<'a> Foo<'a> { + | -- lifetime `'a` defined here +LL | fn make_it(&self) -> impl Iterator { + | ^^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/src/test/ui/nll/mir_check_cast_reify.stderr b/src/test/ui/nll/mir_check_cast_reify.stderr index 1722da8f343de..4e8eec330a579 100644 --- a/src/test/ui/nll/mir_check_cast_reify.stderr +++ b/src/test/ui/nll/mir_check_cast_reify.stderr @@ -6,8 +6,6 @@ LL | fn bar<'a>(x: &'a u32) -> &'static u32 { ... LL | f(x) | ^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr b/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr index c87425ecfc0fa..52959850a3332 100644 --- a/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr +++ b/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr @@ -6,8 +6,6 @@ LL | fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 { ... LL | unsafe { g(input) } | ^^^^^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/mir_check_cast_unsize.stderr b/src/test/ui/nll/mir_check_cast_unsize.stderr index cb7328d117984..364d6c17ea7f6 100644 --- a/src/test/ui/nll/mir_check_cast_unsize.stderr +++ b/src/test/ui/nll/mir_check_cast_unsize.stderr @@ -5,8 +5,6 @@ LL | fn bar<'a>(x: &'a u32) -> &'static dyn Debug { | -- lifetime `'a` defined here LL | x | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/outlives-suggestion-more.stderr b/src/test/ui/nll/outlives-suggestion-more.stderr index 2ebcbf5cbafda..a80e59d4822fb 100644 --- a/src/test/ui/nll/outlives-suggestion-more.stderr +++ b/src/test/ui/nll/outlives-suggestion-more.stderr @@ -46,8 +46,6 @@ LL | fn foo2<'a, 'b, 'c>(x: &'a usize, y: &'b usize) -> (&'c usize, &'static usi | -- lifetime `'b` defined here LL | (x, y) | ^^^^^^ returning this value requires that `'b` must outlive `'static` - | - = help: consider replacing `'b` with `'static` help: the following changes may resolve your lifetime errors | @@ -88,8 +86,6 @@ LL | fn foo3<'a, 'b, 'c, 'd, 'e>( ... LL | (x, y, z) | ^^^^^^^^^ returning this value requires that `'c` must outlive `'static` - | - = help: consider replacing `'c` with `'static` help: the following changes may resolve your lifetime errors | diff --git a/src/test/ui/nll/outlives-suggestion-simple.stderr b/src/test/ui/nll/outlives-suggestion-simple.stderr index bfe98a71a99b1..fa85ce2799083 100644 --- a/src/test/ui/nll/outlives-suggestion-simple.stderr +++ b/src/test/ui/nll/outlives-suggestion-simple.stderr @@ -17,8 +17,6 @@ LL | fn foo2<'a>(x: &'a usize) -> &'static usize { | -- lifetime `'a` defined here LL | x | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/outlives-suggestion-simple.rs:14:5 @@ -66,8 +64,6 @@ LL | pub fn foo<'a>(x: &'a usize) -> Self { | -- lifetime `'a` defined here LL | Foo { x } | ^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/outlives-suggestion-simple.rs:41:9 diff --git a/src/test/ui/nll/ty-outlives/wf-unreachable.stderr b/src/test/ui/nll/ty-outlives/wf-unreachable.stderr index f15c2ffd0d7eb..9128fd1647959 100644 --- a/src/test/ui/nll/ty-outlives/wf-unreachable.stderr +++ b/src/test/ui/nll/ty-outlives/wf-unreachable.stderr @@ -6,8 +6,6 @@ LL | fn uninit<'a>() { LL | return; LL | let x: &'static &'a (); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/wf-unreachable.rs:13:12 @@ -17,8 +15,6 @@ LL | fn var_type<'a>() { LL | return; LL | let x: &'static &'a () = &&(); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/wf-unreachable.rs:17:12 @@ -27,8 +23,6 @@ LL | fn uninit_infer<'a>() { | -- lifetime `'a` defined here LL | let x: &'static &'a _; | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/wf-unreachable.rs:23:12 @@ -38,8 +32,6 @@ LL | fn infer<'a>() { LL | return; LL | let x: &'static &'a _ = &&(); | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/wf-unreachable.rs:28:12 @@ -49,8 +41,6 @@ LL | fn uninit_no_var<'a>() { LL | return; LL | let _: &'static &'a (); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/wf-unreachable.rs:33:12 @@ -60,8 +50,6 @@ LL | fn no_var<'a>() { LL | return; LL | let _: &'static &'a () = &&(); | ^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/wf-unreachable.rs:38:12 @@ -71,8 +59,6 @@ LL | fn infer_no_var<'a>() { LL | return; LL | let _: &'static &'a _ = &&(); | ^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/wf-unreachable.rs:51:12 @@ -82,8 +68,6 @@ LL | fn required_substs<'a>() { LL | return; LL | let _: C<'static, 'a, _> = C((), &(), &()); | ^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to 8 previous errors diff --git a/src/test/ui/nll/user-annotations/closure-substs.stderr b/src/test/ui/nll/user-annotations/closure-substs.stderr index 37e751aeb67b7..55bb3a6090c01 100644 --- a/src/test/ui/nll/user-annotations/closure-substs.stderr +++ b/src/test/ui/nll/user-annotations/closure-substs.stderr @@ -6,8 +6,6 @@ LL | fn foo<'a>() { ... LL | return x; | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/closure-substs.rs:15:16 @@ -25,8 +23,6 @@ LL | fn bar<'a>() { ... LL | b(x); | ^^^^ argument requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error[E0521]: borrowed data escapes outside of closure --> $DIR/closure-substs.rs:29:9 diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr index e9a0b8173ceaa..c39301588acfa 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-inherent-1.nll.stderr @@ -5,8 +5,6 @@ LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | >::C | ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr index 52ec36ef542cc..541a2cfaf299a 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-normalize.nll.stderr @@ -5,8 +5,6 @@ LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | <() as Foo<'a>>::C | ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr index 5f3212eb9aa34..ea0fcb6d634cd 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-1.nll.stderr @@ -5,8 +5,6 @@ LL | fn foo<'a>(_: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | <() as Foo<'a>>::C | ^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr index 490030d30f317..ff549f1d88bd4 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-2.nll.stderr @@ -5,8 +5,6 @@ LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { | -- lifetime `'a` defined here LL | >::C | ^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr index 5e687805c6fc3..7f160d8e398b9 100644 --- a/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr +++ b/src/test/ui/nll/user-annotations/constant-in-expr-trait-item-3.nll.stderr @@ -5,8 +5,6 @@ LL | fn foo<'a, T: Foo<'a>>() -> &'static u32 { | -- lifetime `'a` defined here LL | T::C | ^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr b/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr index 7b5646de775ab..768454698987e 100644 --- a/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr +++ b/src/test/ui/nll/user-annotations/inherent-associated-constants.stderr @@ -5,8 +5,6 @@ LL | fn non_wf_associated_const<'a>(x: i32) { | -- lifetime `'a` defined here LL | A::<'a>::IC; | ^^^^^^^^^^^ requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/nll/user-annotations/issue-54124.stderr b/src/test/ui/nll/user-annotations/issue-54124.stderr index 97653b8c199c8..6cfccf7cb69ce 100644 --- a/src/test/ui/nll/user-annotations/issue-54124.stderr +++ b/src/test/ui/nll/user-annotations/issue-54124.stderr @@ -15,8 +15,6 @@ LL | fn test<'a>() { | -- lifetime `'a` defined here LL | let _:fn(&()) = |_:&'a ()| {}; | ^ requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.stderr b/src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.stderr index f23ea9fdb5c31..5929707e41e10 100644 --- a/src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.stderr +++ b/src/test/ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.stderr @@ -6,8 +6,6 @@ LL | fn coupled_regions_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { ... LL | y | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/issue-55748-pat-types-constrain-bindings.rs:49:5 @@ -17,8 +15,6 @@ LL | fn coupled_types_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { ... LL | y | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/issue-55748-pat-types-constrain-bindings.rs:62:5 @@ -28,8 +24,6 @@ LL | fn coupled_wilds_lhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { ... LL | y | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to 3 previous errors diff --git a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr index 426c57ef9c4e7..c99f53c5aa4c5 100644 --- a/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr +++ b/src/test/ui/nll/user-annotations/issue-57731-ascibed-coupled-types.stderr @@ -6,8 +6,6 @@ LL | fn coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { LL | let ((y, _z),) = ((s, _x),): (PairCoupledTypes<_>,); LL | y | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/issue-57731-ascibed-coupled-types.rs:22:5 @@ -17,8 +15,6 @@ LL | fn coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 { LL | let ((y, _z),) = ((s, _x),): (PairCoupledRegions<_>,); LL | y | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/issue-57731-ascibed-coupled-types.rs:32:5 @@ -28,8 +24,6 @@ LL | fn cast_coupled_wilds_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u32 LL | let ((y, _z),) = ((s, _x),) as (PairCoupledTypes<_>,); LL | y | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/issue-57731-ascibed-coupled-types.rs:37:5 @@ -39,8 +33,6 @@ LL | fn cast_coupled_regions_rhs<'a>(_x: &'a u32, s: &'static u32) -> &'static u LL | let ((y, _z),) = ((s, _x),) as (PairCoupledRegions<_>,); LL | y | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to 4 previous errors diff --git a/src/test/ui/nll/user-annotations/patterns.stderr b/src/test/ui/nll/user-annotations/patterns.stderr index c2786f0e8cca2..7ebd0ae227a80 100644 --- a/src/test/ui/nll/user-annotations/patterns.stderr +++ b/src/test/ui/nll/user-annotations/patterns.stderr @@ -156,8 +156,6 @@ LL | fn static_to_a_to_static_through_variable<'a>(x: &'a u32) -> &'static u32 { ... LL | y | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/patterns.rs:125:5 @@ -167,8 +165,6 @@ LL | fn static_to_a_to_static_through_tuple<'a>(x: &'a u32) -> &'static u32 { ... LL | y | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/patterns.rs:130:5 @@ -178,8 +174,6 @@ LL | fn static_to_a_to_static_through_struct<'a>(_x: &'a u32) -> &'static u32 { LL | let Single { value: y }: Single<&'a u32> = Single { value: &22 }; LL | y | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/patterns.rs:134:18 @@ -188,8 +182,6 @@ LL | fn a_to_static_then_static<'a>(x: &'a u32) -> &'static u32 { | -- lifetime `'a` defined here LL | let (y, _z): (&'static u32, u32) = (x, 44); | ^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to 19 previous errors diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr index defffe2b84b0d..7d6f9f39d13ed 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr @@ -5,8 +5,6 @@ LL | fn c<'a>(t: &'a Box, mut ss: SomeStruct<'a>) { | -- lifetime `'a` defined here LL | ss.t = t; | ^^^^^^^^ assignment requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr index 8c28a7a011aba..6df54638ce004 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr @@ -5,8 +5,6 @@ LL | fn c<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { | -- lifetime `'a` defined here LL | ss.t = t; | ^^^^^^^^ assignment requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr index 42dae7e40dbb3..6ce1b2eed85d2 100644 --- a/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr +++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr @@ -18,8 +18,6 @@ LL | fn load2<'a>(ss: &MyBox) -> MyBox { | -- `ss` is a reference that is only valid in the function body LL | load0(ss) | ^^^^^^^^^ `ss` escapes the function body here - | - = help: consider replacing `'a` with `'static` error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr b/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr index 89a22adc8f021..7221759dbd450 100644 --- a/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr +++ b/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr @@ -6,8 +6,6 @@ LL | fn unify<'a>(x: Option>, f: fn(Invariant<'a>)) { LL | let bad = if x.is_some() { LL | x.unwrap() | ^^^^^^^^^^ `x` escapes the function body here - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr index ca153b9d9b1d7..86bd100538d70 100644 --- a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr +++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.nll.stderr @@ -5,8 +5,6 @@ LL | fn param_not_ok<'a>(x: &'a isize) { | -- lifetime `'a` defined here LL | assert_send::<&'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/regions-bounded-by-trait-requiring-static.rs:26:5 @@ -15,8 +13,6 @@ LL | fn param_not_ok1<'a>(_: &'a isize) { | -- lifetime `'a` defined here LL | assert_send::<&'a str>(); | ^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/regions-bounded-by-trait-requiring-static.rs:30:5 @@ -25,8 +21,6 @@ LL | fn param_not_ok2<'a>(_: &'a isize) { | -- lifetime `'a` defined here LL | assert_send::<&'a [isize]>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/regions-bounded-by-trait-requiring-static.rs:44:5 @@ -35,8 +29,6 @@ LL | fn box_with_region_not_ok<'a>() { | -- lifetime `'a` defined here LL | assert_send::>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/regions-bounded-by-trait-requiring-static.rs:55:5 @@ -45,8 +37,6 @@ LL | fn unsafe_ok2<'a>(_: &'a isize) { | -- lifetime `'a` defined here LL | assert_send::<*const &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/regions-bounded-by-trait-requiring-static.rs:59:5 @@ -55,8 +45,6 @@ LL | fn unsafe_ok3<'a>(_: &'a isize) { | -- lifetime `'a` defined here LL | assert_send::<*mut &'a isize>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to 6 previous errors diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr index 2076772b59df4..b6d7b8aac5f19 100644 --- a/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr +++ b/src/test/ui/regions/regions-bounded-method-type-parameters.nll.stderr @@ -5,8 +5,6 @@ LL | fn caller<'a>(x: &isize) { | -- lifetime `'a` defined here LL | Foo.some_method::<&'a isize>(); | ^^^^^^^^^^^ requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr index 410fab962f720..6a0e958616101 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr @@ -5,8 +5,6 @@ LL | fn g<'a, T: 'static>(v: Box + 'a>) -> Box { | -- lifetime `'a` defined here LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-2.rs:9:5 diff --git a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr index e2cd864ea020e..b30626830ad6b 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr @@ -29,8 +29,6 @@ LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | -- lifetime `'a` defined here LL | Box::new(B(&*v)) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-4.rs:9:5 diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr index 3256e3c0dd381..0c1e3989b234a 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr @@ -5,8 +5,6 @@ LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | -- lifetime `'r` defined here LL | b_isize | ^^^^^^^ returning this value requires that `'r` must outlive `'static` - | - = help: consider replacing `'r` with `'static` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr index 991f9a287b9bf..0edeb2723998f 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr @@ -5,8 +5,6 @@ LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | -- lifetime `'r` defined here LL | b_isize | ^^^^^^^ returning this value requires that `'r` must outlive `'static` - | - = help: consider replacing `'r` with `'static` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr index 2d62fb85b81eb..724dd7e3f6d3f 100644 --- a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr +++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr @@ -5,8 +5,6 @@ LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> { | -- lifetime `'r` defined here LL | b_isize | ^^^^^^^ returning this value requires that `'r` must outlive `'static` - | - = help: consider replacing `'r` with `'static` error: aborting due to previous error diff --git a/src/test/ui/regions/regions-nested-fns.nll.stderr b/src/test/ui/regions/regions-nested-fns.nll.stderr index 60754f4c2284c..a0cfa36247228 100644 --- a/src/test/ui/regions/regions-nested-fns.nll.stderr +++ b/src/test/ui/regions/regions-nested-fns.nll.stderr @@ -45,8 +45,6 @@ LL | fn nested<'x>(x: &'x isize) { ... LL | if false { return x; } | ^ returning this value requires that `'x` must outlive `'static` - | - = help: consider replacing `'x` with `'static` error: aborting due to 4 previous errors diff --git a/src/test/ui/regions/regions-static-bound.migrate.nll.stderr b/src/test/ui/regions/regions-static-bound.migrate.nll.stderr index a4c8e721145eb..a280c6f0a02d2 100644 --- a/src/test/ui/regions/regions-static-bound.migrate.nll.stderr +++ b/src/test/ui/regions/regions-static-bound.migrate.nll.stderr @@ -5,8 +5,6 @@ LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { | -- lifetime `'a` defined here LL | t | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error[E0621]: explicit lifetime required in the type of `u` --> $DIR/regions-static-bound.rs:14:5 diff --git a/src/test/ui/regions/regions-static-bound.nll.stderr b/src/test/ui/regions/regions-static-bound.nll.stderr index a4c8e721145eb..a280c6f0a02d2 100644 --- a/src/test/ui/regions/regions-static-bound.nll.stderr +++ b/src/test/ui/regions/regions-static-bound.nll.stderr @@ -5,8 +5,6 @@ LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a { | -- lifetime `'a` defined here LL | t | ^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error[E0621]: explicit lifetime required in the type of `u` --> $DIR/regions-static-bound.rs:14:5 diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr b/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr index 90388a1c51b1f..15853e6ca5d69 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr +++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.nll.stderr @@ -6,8 +6,6 @@ LL | fn use_<'b>(c: Invariant<'b>) { ... LL | let _: Invariant<'static> = c; | ^^^^^^^^^^^^^^^^^^ type annotation requires that `'b` must outlive `'static` - | - = help: consider replacing `'b` with `'static` error: aborting due to previous error diff --git a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.nll.stderr b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.nll.stderr index 6c235ae8f0277..32a2de1e84d8f 100644 --- a/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.nll.stderr +++ b/src/test/ui/suggestions/impl-on-dyn-trait-with-implicit-static-bound.nll.stderr @@ -5,8 +5,6 @@ LL | fn use_it<'a, T>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + | --- `val` is a reference that is only valid in the function body LL | val.use_self::() | ^^^^^^^^^^^^^^^^^^^ `val` escapes the function body here - | - = help: consider replacing `'a` with `'static` error[E0521]: borrowed data escapes outside of function --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:69:9 @@ -15,8 +13,6 @@ LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { | --- `val` is a reference that is only valid in the function body LL | val.use_self() | ^^^^^^^^^^^^^^ `val` escapes the function body here - | - = help: consider replacing `'a` with `'static` error[E0521]: borrowed data escapes outside of function --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:88:9 @@ -25,8 +21,6 @@ LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> { | --- `val` is a reference that is only valid in the function body LL | val.use_self() | ^^^^^^^^^^^^^^ `val` escapes the function body here - | - = help: consider replacing `'a` with `'static` error[E0521]: borrowed data escapes outside of function --> $DIR/impl-on-dyn-trait-with-implicit-static-bound.rs:108:9 @@ -35,8 +29,6 @@ LL | fn use_it<'a>(val: &'a dyn ObjectTrait) -> impl OtherTrait<'a> + 'a { | --- `val` is a reference that is only valid in the function body LL | MyTrait::use_self(val) | ^^^^^^^^^^^^^^^^^^^^^^ `val` escapes the function body here - | - = help: consider replacing `'a` with `'static` error: aborting due to 4 previous errors diff --git a/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.nll.stderr b/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.nll.stderr index b27980300325b..b579635ca7c08 100644 --- a/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.nll.stderr +++ b/src/test/ui/suggestions/lifetimes/trait-object-nested-in-impl-trait.nll.stderr @@ -32,8 +32,6 @@ LL | | current: None, LL | | remaining: self.0.iter(), LL | | } | |_________^ returning this value requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: lifetime may not live long enough --> $DIR/trait-object-nested-in-impl-trait.rs:60:30 @@ -43,7 +41,6 @@ LL | fn iter<'a>(&'a self) -> impl Iterator> { | | | lifetime `'a` defined here | - = help: consider replacing `'a` with `'static` help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a bound | LL | fn iter<'a>(&'a self) -> impl Iterator> + 'a { diff --git a/src/test/ui/variance/variance-associated-types2.nll.stderr b/src/test/ui/variance/variance-associated-types2.nll.stderr index 27d1e1844167e..35871c1236fae 100644 --- a/src/test/ui/variance/variance-associated-types2.nll.stderr +++ b/src/test/ui/variance/variance-associated-types2.nll.stderr @@ -5,8 +5,6 @@ LL | fn take<'a>(_: &'a u32) { | -- lifetime `'a` defined here LL | let _: Box> = make(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` - | - = help: consider replacing `'a` with `'static` error: aborting due to previous error diff --git a/src/test/ui/variance/variance-btree-invariant-types.nll.stderr b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr index 4b653238aa750..1f06949c0331b 100644 --- a/src/test/ui/variance/variance-btree-invariant-types.nll.stderr +++ b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr @@ -5,8 +5,6 @@ LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, & | ---- lifetime `'new` defined here LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:7:5 @@ -15,8 +13,6 @@ LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, ( | ---- lifetime `'new` defined here LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:10:5 @@ -25,8 +21,6 @@ LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, & | ---- lifetime `'new` defined here LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:13:5 @@ -35,8 +29,6 @@ LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, ( | ---- lifetime `'new` defined here LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:17:5 @@ -45,8 +37,6 @@ LL | fn range_cov_key<'a, 'new>(v: RangeMut<'a, &'static (), ()>) -> RangeMut<'a | ---- lifetime `'new` defined here LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:20:5 @@ -55,8 +45,6 @@ LL | fn range_cov_val<'a, 'new>(v: RangeMut<'a, (), &'static ()>) -> RangeMut<'a | ---- lifetime `'new` defined here LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:23:5 @@ -65,8 +53,6 @@ LL | fn range_contra_key<'a, 'new>(v: RangeMut<'a, &'new (), ()>) -> RangeMut<'a | ---- lifetime `'new` defined here LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:26:5 @@ -75,8 +61,6 @@ LL | fn range_contra_val<'a, 'new>(v: RangeMut<'a, (), &'new ()>) -> RangeMut<'a | ---- lifetime `'new` defined here LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:31:5 @@ -86,8 +70,6 @@ LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>) LL | -> OccupiedEntry<'a, &'new (), ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:35:5 @@ -97,8 +79,6 @@ LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>) LL | -> OccupiedEntry<'a, (), &'new ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:39:5 @@ -108,8 +88,6 @@ LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>) LL | -> OccupiedEntry<'a, &'static (), ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:43:5 @@ -119,8 +97,6 @@ LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>) LL | -> OccupiedEntry<'a, (), &'static ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:48:5 @@ -130,8 +106,6 @@ LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>) LL | -> VacantEntry<'a, &'new (), ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:52:5 @@ -141,8 +115,6 @@ LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>) LL | -> VacantEntry<'a, (), &'new ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:56:5 @@ -152,8 +124,6 @@ LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>) LL | -> VacantEntry<'a, &'static (), ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: lifetime may not live long enough --> $DIR/variance-btree-invariant-types.rs:60:5 @@ -163,8 +133,6 @@ LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>) LL | -> VacantEntry<'a, (), &'static ()> { LL | v | ^ returning this value requires that `'new` must outlive `'static` - | - = help: consider replacing `'new` with `'static` error: aborting due to 16 previous errors From ccd2be5b91a5536bc18a90d20a77f10ac052e54c Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Mon, 4 Oct 2021 13:01:50 -0700 Subject: [PATCH 18/18] fix busted JavaScript in error index generator The old JavaScript didn't work. It filled the browser console with "e.previousElementSibling not defined" errors, because it didn't account for the example-wrap div that a newer version of rustdoc added. Additionally, it had copied versions of utility functions that had been optimized in rustdoc main.js. This version updates those. --- src/tools/error_index_generator/main.rs | 53 +++++++++---------------- 1 file changed, 19 insertions(+), 34 deletions(-) diff --git a/src/tools/error_index_generator/main.rs b/src/tools/error_index_generator/main.rs index 01a3fc812b208..0386d8be167ee 100644 --- a/src/tools/error_index_generator/main.rs +++ b/src/tools/error_index_generator/main.rs @@ -143,56 +143,41 @@ impl Formatter for HTMLFormatter { r##"