From 3dcb5a39622fe705647ea0764a355a10b6913832 Mon Sep 17 00:00:00 2001 From: Kornel Date: Sun, 25 Aug 2024 11:20:42 +0100 Subject: [PATCH 1/9] Add str.as_str() for easy dereferencing of Box --- .../rustc_hir_typeck/src/method/suggest.rs | 15 +---------- library/alloc/src/lib.rs | 1 + library/alloc/src/rc/tests.rs | 4 +++ library/core/src/str/mod.rs | 11 ++++++++ tests/ui/suggestions/remove-as_str.rs | 21 --------------- tests/ui/suggestions/remove-as_str.stderr | 27 ------------------- 6 files changed, 17 insertions(+), 62 deletions(-) delete mode 100644 tests/ui/suggestions/remove-as_str.rs delete mode 100644 tests/ui/suggestions/remove-as_str.stderr diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index deabf693af2f5..7964dc3381640 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -1721,20 +1721,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - if item_name.name == sym::as_str && rcvr_ty.peel_refs().is_str() { - let msg = "remove this method call"; - let mut fallback_span = true; - if let SelfSource::MethodCall(expr) = source { - let call_expr = self.tcx.hir().expect_expr(self.tcx.parent_hir_id(expr.hir_id)); - if let Some(span) = call_expr.span.trim_start(expr.span) { - err.span_suggestion(span, msg, "", Applicability::MachineApplicable); - fallback_span = false; - } - } - if fallback_span { - err.span_label(span, msg); - } - } else if let Some(similar_candidate) = similar_candidate { + if let Some(similar_candidate) = similar_candidate { // Don't emit a suggestion if we found an actual method // that had unsatisfied trait bounds if unsatisfied_predicates.is_empty() diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index f0597f295b3f0..ff5ddd16e07e3 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -93,6 +93,7 @@ // tidy-alphabetical-start #![cfg_attr(not(no_global_oom_handling), feature(const_alloc_error))] #![cfg_attr(not(no_global_oom_handling), feature(const_btree_len))] +#![cfg_attr(test, feature(str_as_str))] #![feature(alloc_layout_extra)] #![feature(allocator_api)] #![feature(array_chunks)] diff --git a/library/alloc/src/rc/tests.rs b/library/alloc/src/rc/tests.rs index 84e8b325f71fc..333e1bde31c1e 100644 --- a/library/alloc/src/rc/tests.rs +++ b/library/alloc/src/rc/tests.rs @@ -448,7 +448,11 @@ fn test_from_box_str() { use std::string::String; let s = String::from("foo").into_boxed_str(); + assert_eq!((&&&s).as_str(), "foo"); + let r: Rc = Rc::from(s); + assert_eq!((&r).as_str(), "foo"); + assert_eq!(r.as_str(), "foo"); assert_eq!(&r[..], "foo"); } diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 9373d807f44e3..5b20e681c2409 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -2737,6 +2737,17 @@ impl str { pub fn substr_range(&self, substr: &str) -> Option> { self.as_bytes().subslice_range(substr.as_bytes()) } + + /// Returns the same string as a string slice `&str`. + /// + /// This method is redundant when used directly on `&str`, but + /// it helps dereferencing other string-like types to string slices, + /// for example references to `Box` or `Arc`. + #[inline] + #[unstable(feature = "str_as_str", issue = "130366")] + pub fn as_str(&self) -> &str { + self + } } #[stable(feature = "rust1", since = "1.0.0")] diff --git a/tests/ui/suggestions/remove-as_str.rs b/tests/ui/suggestions/remove-as_str.rs deleted file mode 100644 index 289a784ba6af3..0000000000000 --- a/tests/ui/suggestions/remove-as_str.rs +++ /dev/null @@ -1,21 +0,0 @@ -fn foo1(s: &str) { - s.as_str(); - //~^ ERROR no method named `as_str` found -} - -fn foo2<'a>(s: &'a str) { - s.as_str(); - //~^ ERROR no method named `as_str` found -} - -fn foo3(s: &mut str) { - s.as_str(); - //~^ ERROR no method named `as_str` found -} - -fn foo4(s: &&str) { - s.as_str(); - //~^ ERROR no method named `as_str` found -} - -fn main() {} diff --git a/tests/ui/suggestions/remove-as_str.stderr b/tests/ui/suggestions/remove-as_str.stderr deleted file mode 100644 index 534c497780a95..0000000000000 --- a/tests/ui/suggestions/remove-as_str.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0599]: no method named `as_str` found for reference `&str` in the current scope - --> $DIR/remove-as_str.rs:2:7 - | -LL | s.as_str(); - | -^^^^^^-- help: remove this method call - -error[E0599]: no method named `as_str` found for reference `&'a str` in the current scope - --> $DIR/remove-as_str.rs:7:7 - | -LL | s.as_str(); - | -^^^^^^-- help: remove this method call - -error[E0599]: no method named `as_str` found for mutable reference `&mut str` in the current scope - --> $DIR/remove-as_str.rs:12:7 - | -LL | s.as_str(); - | -^^^^^^-- help: remove this method call - -error[E0599]: no method named `as_str` found for reference `&&str` in the current scope - --> $DIR/remove-as_str.rs:17:7 - | -LL | s.as_str(); - | -^^^^^^-- help: remove this method call - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0599`. From f48c5ec235adb709ab28e03974286dde69369d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Bj=C3=B8rnager=20Jensen?= Date: Sat, 21 Sep 2024 12:32:14 +0200 Subject: [PATCH 2/9] Mark and implement 'char::encode_utf16' as const; Rewrite 'encode_utf16_raw'; --- library/core/src/char/methods.rs | 60 +++++++++++++++++++------------- library/core/src/lib.rs | 1 + 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index 092d427eceae7..23d61e368ce64 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -638,8 +638,7 @@ impl char { #[rustc_const_stable(feature = "const_char_len_utf", since = "1.52.0")] #[inline] pub const fn len_utf16(self) -> usize { - let ch = self as u32; - if (ch & 0xFFFF) == ch { 1 } else { 2 } + len_utf16(self as u32) } /// Encodes this character as UTF-8 into the provided byte buffer, @@ -709,8 +708,9 @@ impl char { /// '𝕊'.encode_utf16(&mut b); /// ``` #[stable(feature = "unicode_encode_char", since = "1.15.0")] + #[rustc_const_unstable(feature = "const_char_encode_utf16", issue = "130660")] #[inline] - pub fn encode_utf16(self, dst: &mut [u16]) -> &mut [u16] { + pub const fn encode_utf16(self, dst: &mut [u16]) -> &mut [u16] { encode_utf16_raw(self as u32, dst) } @@ -1745,7 +1745,12 @@ const fn len_utf8(code: u32) -> usize { } } -/// Encodes a raw u32 value as UTF-8 into the provided byte buffer, +#[inline] +const fn len_utf16(code: u32) -> usize { + if (code & 0xFFFF) == code { 1 } else { 2 } +} + +/// Encodes a raw `u32` value as UTF-8 into the provided byte buffer, /// and then returns the subslice of the buffer that contains the encoded character. /// /// Unlike `char::encode_utf8`, this method also handles codepoints in the surrogate range. @@ -1799,7 +1804,7 @@ pub const fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> &mut [u8] { unsafe { slice::from_raw_parts_mut(dst.as_mut_ptr(), len) } } -/// Encodes a raw u32 value as UTF-16 into the provided `u16` buffer, +/// Encodes a raw `u32` value as UTF-16 into the provided `u16` buffer, /// and then returns the subslice of the buffer that contains the encoded character. /// /// Unlike `char::encode_utf16`, this method also handles codepoints in the surrogate range. @@ -1810,28 +1815,33 @@ pub const fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> &mut [u8] { /// Panics if the buffer is not large enough. /// A buffer of length 2 is large enough to encode any `char`. #[unstable(feature = "char_internals", reason = "exposed only for libstd", issue = "none")] +#[rustc_const_unstable(feature = "const_char_encode_utf16", issue = "130660")] #[doc(hidden)] #[inline] -pub fn encode_utf16_raw(mut code: u32, dst: &mut [u16]) -> &mut [u16] { - // SAFETY: each arm checks whether there are enough bits to write into - unsafe { - if (code & 0xFFFF) == code && !dst.is_empty() { - // The BMP falls through - *dst.get_unchecked_mut(0) = code as u16; - slice::from_raw_parts_mut(dst.as_mut_ptr(), 1) - } else if dst.len() >= 2 { - // Supplementary planes break into surrogates. +pub const fn encode_utf16_raw(mut code: u32, dst: &mut [u16]) -> &mut [u16] { + const fn panic_at_const(_code: u32, _len: usize, _dst_len: usize) { + // Note that we cannot format in constant expressions. + panic!("encode_utf16: buffer does not have enough bytes to encode code point"); + } + fn panic_at_rt(code: u32, len: usize, dst_len: usize) { + panic!( + "encode_utf16: need {len} bytes to encode U+{code:04X} but buffer has just {dst_len}", + ); + } + let len = len_utf16(code); + match (len, &mut *dst) { + (1, [a, ..]) => { + *a = code as u16; + } + (2, [a, b, ..]) => { code -= 0x1_0000; - *dst.get_unchecked_mut(0) = 0xD800 | ((code >> 10) as u16); - *dst.get_unchecked_mut(1) = 0xDC00 | ((code as u16) & 0x3FF); - slice::from_raw_parts_mut(dst.as_mut_ptr(), 2) - } else { - panic!( - "encode_utf16: need {} units to encode U+{:X}, but the buffer has {}", - char::from_u32_unchecked(code).len_utf16(), - code, - dst.len(), - ) + + *a = (code >> 10) as u16 | 0xD800; + *b = (code & 0x3FF) as u16 | 0xDC00; } - } + // FIXME(const-hack): We would prefer to have streamlined panics when formatters become const-friendly. + _ => const_eval_select((code, len, dst.len()), panic_at_const, panic_at_rt), + }; + // SAFETY: `<&mut [u16]>::as_mut_ptr` is guaranteed to return a valid pointer and `len` has been tested to be within bounds. + unsafe { slice::from_raw_parts_mut(dst.as_mut_ptr(), len) } } diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index f25f6922bca20..536a1a83dacf7 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -119,6 +119,7 @@ #![feature(const_bigint_helper_methods)] #![feature(const_black_box)] #![feature(const_cell_into_inner)] +#![feature(const_char_encode_utf16)] #![feature(const_char_encode_utf8)] #![feature(const_eval_select)] #![feature(const_exact_div)] From 95469dc09a9255f6a13d76cae7dc366f90c4db3a Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 21 Sep 2024 12:09:44 -0400 Subject: [PATCH 3/9] No longer mark RTN as incomplete --- compiler/rustc_feature/src/unstable.rs | 2 +- .../bad-inputs-and-output.rs | 1 - .../bad-inputs-and-output.stderr | 29 ++++++----------- .../return-type-notation/bare-path.rs | 1 - .../return-type-notation/bare-path.stderr | 15 ++------- .../return-type-notation/basic.rs | 1 - .../return-type-notation/basic.with.stderr | 11 ------- .../return-type-notation/basic.without.stderr | 17 +++------- .../return-type-notation/display.rs | 1 - .../return-type-notation/display.stderr | 31 +++++++------------ .../return-type-notation/equality.rs | 1 - .../return-type-notation/equality.stderr | 13 ++------ .../higher-ranked-bound-works.rs | 1 - .../higher-ranked-bound-works.stderr | 11 ------- .../issue-120208-higher-ranked-const.rs | 1 - .../issue-120208-higher-ranked-const.stderr | 13 ++------ .../return-type-notation/missing.rs | 1 - .../return-type-notation/missing.stderr | 13 ++------ .../namespace-conflict.rs | 1 - .../namespace-conflict.stderr | 11 ------- .../return-type-notation/non-rpitit.rs | 1 - .../return-type-notation/non-rpitit.stderr | 15 ++------- .../return-type-notation/not-a-method.rs | 1 - .../return-type-notation/not-a-method.stderr | 23 +++++--------- .../return-type-notation/path-ambiguous.rs | 1 - .../path-ambiguous.stderr | 15 ++------- .../path-constrained-in-method.rs | 1 - .../path-constrained-in-method.stderr | 11 ------- .../path-higher-ranked.rs | 1 - .../path-higher-ranked.stderr | 15 ++------- .../return-type-notation/path-missing.rs | 1 - .../return-type-notation/path-missing.stderr | 17 +++------- .../return-type-notation/path-no-qself.rs | 1 - .../return-type-notation/path-no-qself.stderr | 13 ++------ .../path-non-param-qself.rs | 1 - .../path-non-param-qself.stderr | 17 +++------- .../return-type-notation/path-self-qself.rs | 1 - .../path-self-qself.stderr | 11 ------- .../return-type-notation/path-type-param.rs | 1 - .../path-type-param.stderr | 15 ++------- .../return-type-notation/path-unsatisfied.rs | 1 - .../path-unsatisfied.stderr | 17 +++------- .../return-type-notation/path-works.rs | 1 - .../return-type-notation/path-works.stderr | 11 ------- .../issue-110963-early.stderr | 11 +------ .../return-type-notation/issue-110963-late.rs | 1 - .../issue-110963-late.stderr | 11 ------- ...elf-auto-trait-issue-109924.current.stderr | 11 ------- ...g-self-auto-trait-issue-109924.next.stderr | 11 ------- ...ormalizing-self-auto-trait-issue-109924.rs | 1 - .../rtn-implied-in-supertrait.rs | 1 - .../rtn-implied-in-supertrait.stderr | 11 ------- .../rtn-in-impl-signature.rs | 1 - .../rtn-in-impl-signature.stderr | 15 ++------- .../super-method-bound-ambig.rs | 1 - .../super-method-bound-ambig.stderr | 13 ++------ .../super-method-bound.rs | 1 - .../super-method-bound.stderr | 11 ------- .../return-type-notation/supertrait-bound.rs | 1 - .../supertrait-bound.stderr | 11 ------- .../return-type-notation/ty-or-ct-params.rs | 1 - .../ty-or-ct-params.stderr | 15 ++------- .../ui/borrowck/alias-liveness/rtn-static.rs | 1 - .../borrowck/alias-liveness/rtn-static.stderr | 11 ------- 64 files changed, 77 insertions(+), 430 deletions(-) delete mode 100644 tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr delete mode 100644 tests/ui/associated-type-bounds/return-type-notation/higher-ranked-bound-works.stderr delete mode 100644 tests/ui/associated-type-bounds/return-type-notation/namespace-conflict.stderr delete mode 100644 tests/ui/associated-type-bounds/return-type-notation/path-constrained-in-method.stderr delete mode 100644 tests/ui/associated-type-bounds/return-type-notation/path-self-qself.stderr delete mode 100644 tests/ui/associated-type-bounds/return-type-notation/path-works.stderr delete mode 100644 tests/ui/async-await/return-type-notation/issue-110963-late.stderr delete mode 100644 tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr delete mode 100644 tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr delete mode 100644 tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr delete mode 100644 tests/ui/async-await/return-type-notation/super-method-bound.stderr delete mode 100644 tests/ui/async-await/return-type-notation/supertrait-bound.stderr delete mode 100644 tests/ui/borrowck/alias-liveness/rtn-static.stderr diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index edc8e5f075252..4dab8e9256137 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -578,7 +578,7 @@ declare_features! ( /// be used to describe E or vise-versa. (unstable, result_ffi_guarantees, "1.80.0", Some(110503)), /// Allows bounding the return type of AFIT/RPITIT. - (incomplete, return_type_notation, "1.70.0", Some(109417)), + (unstable, return_type_notation, "1.70.0", Some(109417)), /// Allows `extern "rust-cold"`. (unstable, rust_cold_cc, "1.63.0", Some(97544)), /// Allows use of x86 SHA512, SM3 and SM4 target-features and intrinsics diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs index af64901ace022..f00aaec1a8c2c 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.rs @@ -1,7 +1,6 @@ //@ edition: 2021 #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Trait { async fn method() {} diff --git a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr index 6808147008756..c6b9f3eff90ec 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/bad-inputs-and-output.stderr @@ -1,66 +1,57 @@ error[E0575]: expected associated type, found associated function `Trait::method` - --> $DIR/bad-inputs-and-output.rs:28:36 + --> $DIR/bad-inputs-and-output.rs:27:36 | LL | fn foo_qualified() where ::method(i32): Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type error[E0575]: expected associated type, found associated function `Trait::method` - --> $DIR/bad-inputs-and-output.rs:31:36 + --> $DIR/bad-inputs-and-output.rs:30:36 | LL | fn bar_qualified() where ::method() -> (): Send {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a associated type error[E0575]: expected associated type, found associated function `Trait::method` - --> $DIR/bad-inputs-and-output.rs:34:36 + --> $DIR/bad-inputs-and-output.rs:33:36 | LL | fn baz_qualified() where ::method(): Send {} | ^^^^^^^^^^^^^^^^^^^^^^ not a associated type -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/bad-inputs-and-output.rs:3:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error: argument types not allowed with return type notation - --> $DIR/bad-inputs-and-output.rs:10:23 + --> $DIR/bad-inputs-and-output.rs:9:23 | LL | fn foo>() {} | ^^^^^ help: remove the input types: `()` error: return type not allowed with return type notation - --> $DIR/bad-inputs-and-output.rs:13:25 + --> $DIR/bad-inputs-and-output.rs:12:25 | LL | fn bar (): Send>>() {} | ^^^^^^ help: remove the return type error: return type notation arguments must be elided with `..` - --> $DIR/bad-inputs-and-output.rs:16:23 + --> $DIR/bad-inputs-and-output.rs:15:23 | LL | fn baz>() {} | ^^ help: add `..`: `(..)` error: argument types not allowed with return type notation - --> $DIR/bad-inputs-and-output.rs:19:40 + --> $DIR/bad-inputs-and-output.rs:18:40 | LL | fn foo_path() where T::method(i32): Send {} | ^^^^^ help: remove the input types: `()` error: return type not allowed with return type notation - --> $DIR/bad-inputs-and-output.rs:22:42 + --> $DIR/bad-inputs-and-output.rs:21:42 | LL | fn bar_path() where T::method() -> (): Send {} | ^^^^^^ help: remove the return type error: return type notation arguments must be elided with `..` - --> $DIR/bad-inputs-and-output.rs:25:40 + --> $DIR/bad-inputs-and-output.rs:24:40 | LL | fn baz_path() where T::method(): Send {} | ^^ help: add `..`: `(..)` -error: aborting due to 9 previous errors; 1 warning emitted +error: aborting due to 9 previous errors For more information about this error, try `rustc --explain E0575`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/bare-path.rs b/tests/ui/associated-type-bounds/return-type-notation/bare-path.rs index 185c05236332b..2bbeb62b922cb 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/bare-path.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/bare-path.rs @@ -1,5 +1,4 @@ #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Tr { const CONST: usize; diff --git a/tests/ui/associated-type-bounds/return-type-notation/bare-path.stderr b/tests/ui/associated-type-bounds/return-type-notation/bare-path.stderr index dca2bdeab0a7d..913f84b924c28 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/bare-path.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/bare-path.stderr @@ -1,23 +1,14 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/bare-path.rs:1:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error: return type notation not allowed in this position yet - --> $DIR/bare-path.rs:15:23 + --> $DIR/bare-path.rs:14:23 | LL | let _ = T::CONST::(..); | ^^^^ error: return type notation not allowed in this position yet - --> $DIR/bare-path.rs:17:12 + --> $DIR/bare-path.rs:16:12 | LL | let _: T::method(..); | ^^^^^^^^^^^^^ -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.rs b/tests/ui/associated-type-bounds/return-type-notation/basic.rs index be489a19a7ad2..cb5872dff444c 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/basic.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/basic.rs @@ -3,7 +3,6 @@ //@ [with] check-pass #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Foo { async fn method() -> Result<(), ()>; diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr deleted file mode 100644 index 9d4bb356caa8b..0000000000000 --- a/tests/ui/associated-type-bounds/return-type-notation/basic.with.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/basic.rs:5:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr index e9fd8503296e9..110d2a0058310 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/basic.without.stderr @@ -1,29 +1,20 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/basic.rs:5:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error: future cannot be sent between threads safely - --> $DIR/basic.rs:23:13 + --> $DIR/basic.rs:22:13 | LL | is_send(foo::()); | ^^^^^^^^^^ future returned by `foo` is not `Send` | = help: within `impl Future>`, the trait `Send` is not implemented for `impl Future> { ::method(..) }`, which is required by `impl Future>: Send` note: future is not `Send` as it awaits another future which is not `Send` - --> $DIR/basic.rs:13:5 + --> $DIR/basic.rs:12:5 | LL | T::method().await?; | ^^^^^^^^^^^ await occurs here on type `impl Future> { ::method(..) }`, which is not `Send` note: required by a bound in `is_send` - --> $DIR/basic.rs:17:20 + --> $DIR/basic.rs:16:20 | LL | fn is_send(_: impl Send) {} | ^^^^ required by this bound in `is_send` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/associated-type-bounds/return-type-notation/display.rs b/tests/ui/associated-type-bounds/return-type-notation/display.rs index c5be2ca00ea1c..2d613b71c55d2 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/display.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/display.rs @@ -1,5 +1,4 @@ #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Trait {} fn needs_trait(_: impl Trait) {} diff --git a/tests/ui/associated-type-bounds/return-type-notation/display.stderr b/tests/ui/associated-type-bounds/return-type-notation/display.stderr index 4915ec1aa8315..b895d79695272 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/display.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/display.stderr @@ -1,14 +1,5 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/display.rs:1:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: the trait bound `impl Sized { ::method(..) }: Trait` is not satisfied - --> $DIR/display.rs:15:17 + --> $DIR/display.rs:14:17 | LL | needs_trait(T::method()); | ----------- ^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized { ::method(..) }` @@ -16,13 +7,13 @@ LL | needs_trait(T::method()); | required by a bound introduced by this call | note: required by a bound in `needs_trait` - --> $DIR/display.rs:5:24 + --> $DIR/display.rs:4:24 | LL | fn needs_trait(_: impl Trait) {} | ^^^^^ required by this bound in `needs_trait` error[E0277]: the trait bound `impl Sized { ::method_with_lt(..) }: Trait` is not satisfied - --> $DIR/display.rs:17:17 + --> $DIR/display.rs:16:17 | LL | needs_trait(T::method_with_lt()); | ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized { ::method_with_lt(..) }` @@ -30,13 +21,13 @@ LL | needs_trait(T::method_with_lt()); | required by a bound introduced by this call | note: required by a bound in `needs_trait` - --> $DIR/display.rs:5:24 + --> $DIR/display.rs:4:24 | LL | fn needs_trait(_: impl Trait) {} | ^^^^^ required by this bound in `needs_trait` error[E0277]: the trait bound `impl Sized: Trait` is not satisfied - --> $DIR/display.rs:19:17 + --> $DIR/display.rs:18:17 | LL | needs_trait(T::method_with_ty()); | ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized` @@ -44,18 +35,18 @@ LL | needs_trait(T::method_with_ty()); | required by a bound introduced by this call | help: this trait has no implementations, consider adding one - --> $DIR/display.rs:4:1 + --> $DIR/display.rs:3:1 | LL | trait Trait {} | ^^^^^^^^^^^ note: required by a bound in `needs_trait` - --> $DIR/display.rs:5:24 + --> $DIR/display.rs:4:24 | LL | fn needs_trait(_: impl Trait) {} | ^^^^^ required by this bound in `needs_trait` error[E0277]: the trait bound `impl Sized: Trait` is not satisfied - --> $DIR/display.rs:21:17 + --> $DIR/display.rs:20:17 | LL | needs_trait(T::method_with_ct()); | ----------- ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `impl Sized` @@ -63,16 +54,16 @@ LL | needs_trait(T::method_with_ct()); | required by a bound introduced by this call | help: this trait has no implementations, consider adding one - --> $DIR/display.rs:4:1 + --> $DIR/display.rs:3:1 | LL | trait Trait {} | ^^^^^^^^^^^ note: required by a bound in `needs_trait` - --> $DIR/display.rs:5:24 + --> $DIR/display.rs:4:24 | LL | fn needs_trait(_: impl Trait) {} | ^^^^^ required by this bound in `needs_trait` -error: aborting due to 4 previous errors; 1 warning emitted +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.rs b/tests/ui/associated-type-bounds/return-type-notation/equality.rs index 95c16fa1e3f84..cff0df58b7496 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/equality.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/equality.rs @@ -1,7 +1,6 @@ //@ edition: 2021 #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete use std::future::Future; diff --git a/tests/ui/associated-type-bounds/return-type-notation/equality.stderr b/tests/ui/associated-type-bounds/return-type-notation/equality.stderr index d76b1bd1c0510..870f17ee70d2e 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/equality.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/equality.stderr @@ -1,17 +1,8 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/equality.rs:3:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error: return type notation is not allowed to use type equality - --> $DIR/equality.rs:12:18 + --> $DIR/equality.rs:11:18 | LL | fn test>>>() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/associated-type-bounds/return-type-notation/higher-ranked-bound-works.rs b/tests/ui/associated-type-bounds/return-type-notation/higher-ranked-bound-works.rs index d4f21f47c6c64..c6ae6690c72f5 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/higher-ranked-bound-works.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/higher-ranked-bound-works.rs @@ -1,7 +1,6 @@ //@ check-pass #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Trait<'a> { fn late<'b>(&'b self, _: &'a ()) -> impl Sized; diff --git a/tests/ui/associated-type-bounds/return-type-notation/higher-ranked-bound-works.stderr b/tests/ui/associated-type-bounds/return-type-notation/higher-ranked-bound-works.stderr deleted file mode 100644 index c67231c07f723..0000000000000 --- a/tests/ui/associated-type-bounds/return-type-notation/higher-ranked-bound-works.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/higher-ranked-bound-works.rs:3:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.rs b/tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.rs index 4d026b7d1d859..69d0b4b1f8ac4 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.rs @@ -1,7 +1,6 @@ //@ edition: 2021 #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait HealthCheck { async fn check() -> bool; diff --git a/tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.stderr b/tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.stderr index 12f32a75eda32..2abf47f002672 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/issue-120208-higher-ranked-const.stderr @@ -1,14 +1,5 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-120208-higher-ranked-const.rs:3:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error: return type notation is not allowed for functions that have const parameters - --> $DIR/issue-120208-higher-ranked-const.rs:12:21 + --> $DIR/issue-120208-higher-ranked-const.rs:11:21 | LL | async fn check() -> bool; | -------------- const parameter declared here @@ -16,5 +7,5 @@ LL | async fn check() -> bool; LL | HC: HealthCheck + Send + 'static, | ^^^^^^^^^^^^^^^ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/associated-type-bounds/return-type-notation/missing.rs b/tests/ui/associated-type-bounds/return-type-notation/missing.rs index 3a04a56339ba5..e116ae0ca3bb4 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/missing.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/missing.rs @@ -1,7 +1,6 @@ //@ edition: 2021 #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Trait { async fn method() {} diff --git a/tests/ui/associated-type-bounds/return-type-notation/missing.stderr b/tests/ui/associated-type-bounds/return-type-notation/missing.stderr index 5cb8e2642f51c..0eb965603439c 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/missing.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/missing.stderr @@ -1,18 +1,9 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/missing.rs:3:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0220]: associated function `methid` not found for `Trait` - --> $DIR/missing.rs:10:17 + --> $DIR/missing.rs:9:17 | LL | fn bar>() {} | ^^^^^^ help: there is an associated function with a similar name: `method` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0220`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/namespace-conflict.rs b/tests/ui/associated-type-bounds/return-type-notation/namespace-conflict.rs index 9bdc2d00233e0..8dfc2376fbd4e 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/namespace-conflict.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/namespace-conflict.rs @@ -2,7 +2,6 @@ #![allow(non_camel_case_types)] #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Foo { type test; diff --git a/tests/ui/associated-type-bounds/return-type-notation/namespace-conflict.stderr b/tests/ui/associated-type-bounds/return-type-notation/namespace-conflict.stderr deleted file mode 100644 index f4ece074b2856..0000000000000 --- a/tests/ui/associated-type-bounds/return-type-notation/namespace-conflict.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/namespace-conflict.rs:4:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/associated-type-bounds/return-type-notation/non-rpitit.rs b/tests/ui/associated-type-bounds/return-type-notation/non-rpitit.rs index 35d6dd799c703..0e9dd90095286 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/non-rpitit.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/non-rpitit.rs @@ -1,5 +1,4 @@ #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Trait { fn method() {} diff --git a/tests/ui/associated-type-bounds/return-type-notation/non-rpitit.stderr b/tests/ui/associated-type-bounds/return-type-notation/non-rpitit.stderr index e308c927bf0e8..4d3dac2d168f7 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/non-rpitit.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/non-rpitit.stderr @@ -1,14 +1,5 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/non-rpitit.rs:1:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error: return type notation used on function that is not `async` and does not return `impl Trait` - --> $DIR/non-rpitit.rs:8:19 + --> $DIR/non-rpitit.rs:7:19 | LL | fn method() {} | ----------- this function must be `async` or return `impl Trait` @@ -19,7 +10,7 @@ LL | fn bound>() {} = note: function returns `()`, which is not compatible with associated type return bounds error: return type notation used on function that is not `async` and does not return `impl Trait` - --> $DIR/non-rpitit.rs:11:30 + --> $DIR/non-rpitit.rs:10:30 | LL | fn method() {} | ----------- this function must be `async` or return `impl Trait` @@ -29,5 +20,5 @@ LL | fn path() where T: Trait, T::method(..): Send {} | = note: function returns `()`, which is not compatible with associated type return bounds -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/tests/ui/associated-type-bounds/return-type-notation/not-a-method.rs b/tests/ui/associated-type-bounds/return-type-notation/not-a-method.rs index d94ec6b74d9d2..89a414a3bc863 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/not-a-method.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/not-a-method.rs @@ -1,5 +1,4 @@ #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete fn function() {} diff --git a/tests/ui/associated-type-bounds/return-type-notation/not-a-method.stderr b/tests/ui/associated-type-bounds/return-type-notation/not-a-method.stderr index 8add2d4629675..ab987ee48e6c8 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/not-a-method.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/not-a-method.stderr @@ -1,49 +1,40 @@ error[E0575]: expected function, found function `function` - --> $DIR/not-a-method.rs:8:5 + --> $DIR/not-a-method.rs:7:5 | LL | function(..): Send, | ^^^^^^^^^^^^ not a function error[E0573]: expected type, found function `function` - --> $DIR/not-a-method.rs:16:5 + --> $DIR/not-a-method.rs:15:5 | LL | function(): Send, | ^^^^^^^^^^ not a type error[E0576]: cannot find function `method` in this scope - --> $DIR/not-a-method.rs:28:5 + --> $DIR/not-a-method.rs:27:5 | LL | method(..): Send, | ^^^^^^ not found in this scope error[E0412]: cannot find type `method` in this scope - --> $DIR/not-a-method.rs:37:5 + --> $DIR/not-a-method.rs:36:5 | LL | method(): Send, | ^^^^^^ not found in this scope -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/not-a-method.rs:1:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error: return type notation not allowed in this position yet - --> $DIR/not-a-method.rs:8:5 + --> $DIR/not-a-method.rs:7:5 | LL | function(..): Send, | ^^^^^^^^^^^^ error: return type notation not allowed in this position yet - --> $DIR/not-a-method.rs:28:5 + --> $DIR/not-a-method.rs:27:5 | LL | method(..): Send, | ^^^^^^^^^^ -error: aborting due to 6 previous errors; 1 warning emitted +error: aborting due to 6 previous errors Some errors have detailed explanations: E0412, E0573, E0575, E0576. For more information about an error, try `rustc --explain E0412`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.rs b/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.rs index cb42c33e364da..f9aba1754653a 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.rs @@ -1,5 +1,4 @@ #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait A { fn method() -> impl Sized; diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.stderr index e841049ac66bd..80705424035ce 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/path-ambiguous.stderr @@ -1,14 +1,5 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/path-ambiguous.rs:1:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0221]: ambiguous associated function `method` in bounds of `T` - --> $DIR/path-ambiguous.rs:13:5 + --> $DIR/path-ambiguous.rs:12:5 | LL | fn method() -> impl Sized; | -------------------------- ambiguous `method` from `A` @@ -29,7 +20,7 @@ LL | ::method(..): Send, | ~~~~~~~~~~ error[E0221]: ambiguous associated function `method` in bounds of `T` - --> $DIR/path-ambiguous.rs:22:5 + --> $DIR/path-ambiguous.rs:21:5 | LL | fn method() -> impl Sized; | -------------------------- ambiguous `method` from `A` @@ -49,6 +40,6 @@ help: use fully-qualified syntax to disambiguate LL | ::method(..): Send, | ~~~~~~~~~~ -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0221`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-constrained-in-method.rs b/tests/ui/associated-type-bounds/return-type-notation/path-constrained-in-method.rs index 56abd167fb6b7..d8bdec0910752 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-constrained-in-method.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/path-constrained-in-method.rs @@ -1,7 +1,6 @@ //@ check-pass #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Trait { fn method() -> impl Sized; diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-constrained-in-method.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-constrained-in-method.stderr deleted file mode 100644 index 3db033d8cf5ed..0000000000000 --- a/tests/ui/associated-type-bounds/return-type-notation/path-constrained-in-method.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/path-constrained-in-method.rs:3:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.rs b/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.rs index a4d8f00537105..8591357dd9eaa 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.rs @@ -1,5 +1,4 @@ #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait A<'a> { fn method() -> impl Sized; diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.stderr index 22de6165503a1..2a9a1a1e8994c 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/path-higher-ranked.stderr @@ -1,14 +1,5 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/path-higher-ranked.rs:1:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0212]: cannot use the associated function of a trait with uninferred generic parameters - --> $DIR/path-higher-ranked.rs:12:5 + --> $DIR/path-higher-ranked.rs:11:5 | LL | T::method(..): Send, | ^^^^^^^^^^^^^ @@ -19,7 +10,7 @@ LL | >::method(..): Send, | ~~~~~~~~~~~~~~ error[E0212]: cannot use the associated function of a trait with uninferred generic parameters - --> $DIR/path-higher-ranked.rs:20:5 + --> $DIR/path-higher-ranked.rs:19:5 | LL | T::method(..): Send, | ^^^^^^^^^^^^^ @@ -29,6 +20,6 @@ help: use a fully qualified path with inferred lifetimes LL | >::method(..): Send, | ~~~~~~~~~~~~~~ -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0212`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-missing.rs b/tests/ui/associated-type-bounds/return-type-notation/path-missing.rs index c1a7b95ca2daa..8cab48bd0c454 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-missing.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/path-missing.rs @@ -1,5 +1,4 @@ #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait A { #[allow(non_camel_case_types)] diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-missing.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-missing.stderr index 0130c3bc61460..edac09db89dae 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-missing.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/path-missing.stderr @@ -1,33 +1,24 @@ error[E0576]: cannot find method or associated constant `method` in trait `A` - --> $DIR/path-missing.rs:11:15 + --> $DIR/path-missing.rs:10:15 | LL | ::method(..): Send, | ^^^^^^ not found in `A` error[E0575]: expected method or associated constant, found associated type `A::bad` - --> $DIR/path-missing.rs:13:5 + --> $DIR/path-missing.rs:12:5 | LL | ::bad(..): Send, | ^^^^^^^^^^^^^^^^^ | = note: can't use a type alias as a constructor -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/path-missing.rs:1:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0220]: associated function `method` not found for `T` - --> $DIR/path-missing.rs:20:8 + --> $DIR/path-missing.rs:19:8 | LL | T::method(..): Send, | ^^^^^^ associated function `method` not found -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors Some errors have detailed explanations: E0220, E0575, E0576. For more information about an error, try `rustc --explain E0220`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.rs b/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.rs index d2636789c10ab..17a3d0f7af675 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.rs @@ -1,5 +1,4 @@ #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Trait { fn method() -> impl Sized; diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr index d66b0a109fc17..6dbb5dabc0e43 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr @@ -1,14 +1,5 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/path-no-qself.rs:1:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0223]: ambiguous associated type - --> $DIR/path-no-qself.rs:10:5 + --> $DIR/path-no-qself.rs:9:5 | LL | Trait::method(..): Send, | ^^^^^^^^^^^^^^^^^ @@ -18,6 +9,6 @@ help: if there were a type named `Example` that implemented `Trait`, you could u LL | ::method: Send, | ~~~~~~~~~~~~~~~~~~~~~~~~~~ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-non-param-qself.rs b/tests/ui/associated-type-bounds/return-type-notation/path-non-param-qself.rs index b0e6ea852b04d..8107772f151ef 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-non-param-qself.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/path-non-param-qself.rs @@ -1,5 +1,4 @@ #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Trait { fn method() -> impl Sized; diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-non-param-qself.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-non-param-qself.stderr index cd1aa9813e351..38202bdbf0727 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-non-param-qself.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/path-non-param-qself.stderr @@ -1,30 +1,21 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/path-non-param-qself.rs:1:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0223]: ambiguous associated function - --> $DIR/path-non-param-qself.rs:12:5 + --> $DIR/path-non-param-qself.rs:11:5 | LL | <()>::method(..): Send, | ^^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated function - --> $DIR/path-non-param-qself.rs:14:5 + --> $DIR/path-non-param-qself.rs:13:5 | LL | i32::method(..): Send, | ^^^^^^^^^^^^^^^ error[E0223]: ambiguous associated function - --> $DIR/path-non-param-qself.rs:16:5 + --> $DIR/path-non-param-qself.rs:15:5 | LL | Adt::method(..): Send, | ^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-self-qself.rs b/tests/ui/associated-type-bounds/return-type-notation/path-self-qself.rs index 0cf84457ba73f..d805556f4c720 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-self-qself.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/path-self-qself.rs @@ -1,7 +1,6 @@ //@ check-pass #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Foo { fn method() -> impl Sized; diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-self-qself.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-self-qself.stderr deleted file mode 100644 index ab33647583ca3..0000000000000 --- a/tests/ui/associated-type-bounds/return-type-notation/path-self-qself.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/path-self-qself.rs:3:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-type-param.rs b/tests/ui/associated-type-bounds/return-type-notation/path-type-param.rs index 693a300eb1d98..6e2355c389b88 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-type-param.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/path-type-param.rs @@ -1,5 +1,4 @@ #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Foo { fn method() -> impl Sized; diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-type-param.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-type-param.stderr index 0d33d4f97d7ac..67e83060a76b2 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-type-param.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/path-type-param.stderr @@ -1,14 +1,5 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/path-type-param.rs:1:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error: return type notation is not allowed for functions that have type parameters - --> $DIR/path-type-param.rs:10:5 + --> $DIR/path-type-param.rs:9:5 | LL | fn method() -> impl Sized; | - type parameter declared here @@ -17,7 +8,7 @@ LL | ::method(..): Send, | ^^^^^^^^^^^^^^^^^^^^^^ error: return type notation is not allowed for functions that have type parameters - --> $DIR/path-type-param.rs:17:5 + --> $DIR/path-type-param.rs:16:5 | LL | fn method() -> impl Sized; | - type parameter declared here @@ -25,5 +16,5 @@ LL | fn method() -> impl Sized; LL | ::method(..): Send, | ^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-unsatisfied.rs b/tests/ui/associated-type-bounds/return-type-notation/path-unsatisfied.rs index a5b0b0e4e251c..c9cb0f953e26b 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-unsatisfied.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/path-unsatisfied.rs @@ -1,5 +1,4 @@ #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Trait { fn method() -> impl Sized; diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-unsatisfied.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-unsatisfied.stderr index 7d32a428555e8..95810342d5ae2 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-unsatisfied.stderr +++ b/tests/ui/associated-type-bounds/return-type-notation/path-unsatisfied.stderr @@ -1,14 +1,5 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/path-unsatisfied.rs:1:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: `*mut ()` cannot be sent between threads safely - --> $DIR/path-unsatisfied.rs:23:12 + --> $DIR/path-unsatisfied.rs:22:12 | LL | fn method() -> impl Sized { | ---------- within this `impl Sized` @@ -18,12 +9,12 @@ LL | test::(); | = help: within `impl Sized`, the trait `Send` is not implemented for `*mut ()`, which is required by `impl Sized: Send` note: required because it appears within the type `impl Sized` - --> $DIR/path-unsatisfied.rs:10:20 + --> $DIR/path-unsatisfied.rs:9:20 | LL | fn method() -> impl Sized { | ^^^^^^^^^^ note: required by a bound in `test` - --> $DIR/path-unsatisfied.rs:18:20 + --> $DIR/path-unsatisfied.rs:17:20 | LL | fn test() | ---- required by a bound in this function @@ -31,6 +22,6 @@ LL | where LL | T::method(..): Send, | ^^^^ required by this bound in `test` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-works.rs b/tests/ui/associated-type-bounds/return-type-notation/path-works.rs index 027bc89f13e08..87abfc07ee9f2 100644 --- a/tests/ui/associated-type-bounds/return-type-notation/path-works.rs +++ b/tests/ui/associated-type-bounds/return-type-notation/path-works.rs @@ -1,7 +1,6 @@ //@ check-pass #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Trait { fn method() -> impl Sized; diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-works.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-works.stderr deleted file mode 100644 index b1ec8069ba0d4..0000000000000 --- a/tests/ui/associated-type-bounds/return-type-notation/path-works.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/path-works.rs:3:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr index acad8bd379170..d6c3bd12aee3b 100644 --- a/tests/ui/async-await/return-type-notation/issue-110963-early.stderr +++ b/tests/ui/async-await/return-type-notation/issue-110963-early.stderr @@ -1,12 +1,3 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-110963-early.rs:4:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error: implementation of `Send` is not general enough --> $DIR/issue-110963-early.rs:14:5 | @@ -36,5 +27,5 @@ LL | | }); = note: ...but `Send` is actually implemented for the type `impl Future { ::check<'2>(..) }`, for some specific lifetime `'2` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/tests/ui/async-await/return-type-notation/issue-110963-late.rs b/tests/ui/async-await/return-type-notation/issue-110963-late.rs index cb9c0b97f1e99..1f56361f5e50f 100644 --- a/tests/ui/async-await/return-type-notation/issue-110963-late.rs +++ b/tests/ui/async-await/return-type-notation/issue-110963-late.rs @@ -2,7 +2,6 @@ //@ check-pass #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait HealthCheck { async fn check(&mut self) -> bool; diff --git a/tests/ui/async-await/return-type-notation/issue-110963-late.stderr b/tests/ui/async-await/return-type-notation/issue-110963-late.stderr deleted file mode 100644 index 9c6966537a73a..0000000000000 --- a/tests/ui/async-await/return-type-notation/issue-110963-late.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-110963-late.rs:4:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr deleted file mode 100644 index 4837815fad4ad..0000000000000 --- a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.current.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/normalizing-self-auto-trait-issue-109924.rs:7:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr deleted file mode 100644 index 4837815fad4ad..0000000000000 --- a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.next.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/normalizing-self-auto-trait-issue-109924.rs:7:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs index 24041ed080752..3fbd74eddcbbf 100644 --- a/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs +++ b/tests/ui/async-await/return-type-notation/normalizing-self-auto-trait-issue-109924.rs @@ -5,7 +5,6 @@ //@ edition:2021 #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Foo { async fn bar(&self); diff --git a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs index 2f6e04c385384..fdbeb4f3c8758 100644 --- a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs +++ b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.rs @@ -2,7 +2,6 @@ //@ check-pass #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete use std::future::Future; diff --git a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr b/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr deleted file mode 100644 index 4a52e807bff9e..0000000000000 --- a/tests/ui/async-await/return-type-notation/rtn-implied-in-supertrait.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/rtn-implied-in-supertrait.rs:4:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.rs b/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.rs index 1e971d0aea71d..bbdfcf607318b 100644 --- a/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.rs +++ b/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.rs @@ -1,5 +1,4 @@ #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete // Shouldn't ICE when we have a (bad) RTN in an impl header diff --git a/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.stderr b/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.stderr index e061587f49189..2bbf1d504747f 100644 --- a/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.stderr +++ b/tests/ui/async-await/return-type-notation/rtn-in-impl-signature.stderr @@ -1,14 +1,5 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/rtn-in-impl-signature.rs:1:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0229]: associated item constraints are not allowed here - --> $DIR/rtn-in-impl-signature.rs:10:17 + --> $DIR/rtn-in-impl-signature.rs:9:17 | LL | impl Super1<'_, bar(..): Send> for () {} | ^^^^^^^^^^^^^ associated item constraint not allowed here @@ -20,7 +11,7 @@ LL + impl Super1<'_> for () {} | error[E0046]: not all trait items implemented, missing: `bar` - --> $DIR/rtn-in-impl-signature.rs:10:1 + --> $DIR/rtn-in-impl-signature.rs:9:1 | LL | fn bar<'b>() -> bool; | --------------------- `bar` from trait @@ -28,7 +19,7 @@ LL | fn bar<'b>() -> bool; LL | impl Super1<'_, bar(..): Send> for () {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `bar` in implementation -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors Some errors have detailed explanations: E0046, E0229. For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs index 452568f3e4695..1db19628fa37d 100644 --- a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs +++ b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs @@ -1,7 +1,6 @@ //@ edition:2021 #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Super1<'a> { async fn test(); diff --git a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr index 9a6fdd7f2ac6b..e32b07771dc92 100644 --- a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr +++ b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr @@ -1,14 +1,5 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/super-method-bound-ambig.rs:3:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0221]: ambiguous associated function `test` in bounds of `Foo` - --> $DIR/super-method-bound-ambig.rs:25:12 + --> $DIR/super-method-bound-ambig.rs:24:12 | LL | async fn test(); | ---------------- ambiguous `test` from `for<'a> Super1<'a>` @@ -19,6 +10,6 @@ LL | async fn test(); LL | T: Foo, | ^^^^^^^^^^^^^^ ambiguous associated function `test` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0221`. diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.rs b/tests/ui/async-await/return-type-notation/super-method-bound.rs index 1aa8258a09b7d..a1d0307698218 100644 --- a/tests/ui/async-await/return-type-notation/super-method-bound.rs +++ b/tests/ui/async-await/return-type-notation/super-method-bound.rs @@ -2,7 +2,6 @@ //@ check-pass #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Super<'a> { async fn test(); diff --git a/tests/ui/async-await/return-type-notation/super-method-bound.stderr b/tests/ui/async-await/return-type-notation/super-method-bound.stderr deleted file mode 100644 index 64fda71c1a1d9..0000000000000 --- a/tests/ui/async-await/return-type-notation/super-method-bound.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/super-method-bound.rs:4:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.rs b/tests/ui/async-await/return-type-notation/supertrait-bound.rs index 9c74c10b33319..8d73a34ac482f 100644 --- a/tests/ui/async-await/return-type-notation/supertrait-bound.rs +++ b/tests/ui/async-await/return-type-notation/supertrait-bound.rs @@ -1,7 +1,6 @@ //@ check-pass #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete and may not be safe to use trait IntFactory { fn stream(&self) -> impl Iterator; diff --git a/tests/ui/async-await/return-type-notation/supertrait-bound.stderr b/tests/ui/async-await/return-type-notation/supertrait-bound.stderr deleted file mode 100644 index eb6917fc7d58c..0000000000000 --- a/tests/ui/async-await/return-type-notation/supertrait-bound.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/supertrait-bound.rs:3:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs b/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs index 06a966df4451a..edb92d8e26588 100644 --- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs +++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.rs @@ -1,7 +1,6 @@ //@ edition: 2021 #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Foo { async fn bar() {} diff --git a/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr b/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr index 1c000bc6c3318..0e43d69bddc68 100644 --- a/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr +++ b/tests/ui/async-await/return-type-notation/ty-or-ct-params.stderr @@ -1,14 +1,5 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/ty-or-ct-params.rs:3:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - error: return type notation is not allowed for functions that have type parameters - --> $DIR/ty-or-ct-params.rs:14:12 + --> $DIR/ty-or-ct-params.rs:13:12 | LL | async fn bar() {} | - type parameter declared here @@ -17,7 +8,7 @@ LL | T: Foo, | ^^^^^^^^^^^^^ error: return type notation is not allowed for functions that have const parameters - --> $DIR/ty-or-ct-params.rs:14:27 + --> $DIR/ty-or-ct-params.rs:13:27 | LL | async fn baz() {} | -------------- const parameter declared here @@ -25,5 +16,5 @@ LL | async fn baz() {} LL | T: Foo, | ^^^^^^^^^^^^^ -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/alias-liveness/rtn-static.rs b/tests/ui/borrowck/alias-liveness/rtn-static.rs index 6aa5d8fc7a107..5b6cf5b5c7ccc 100644 --- a/tests/ui/borrowck/alias-liveness/rtn-static.rs +++ b/tests/ui/borrowck/alias-liveness/rtn-static.rs @@ -1,7 +1,6 @@ //@ check-pass #![feature(return_type_notation)] -//~^ WARN the feature `return_type_notation` is incomplete trait Foo { fn borrow(&mut self) -> impl Sized + '_; diff --git a/tests/ui/borrowck/alias-liveness/rtn-static.stderr b/tests/ui/borrowck/alias-liveness/rtn-static.stderr deleted file mode 100644 index e9202db2c7902..0000000000000 --- a/tests/ui/borrowck/alias-liveness/rtn-static.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/rtn-static.rs:3:12 - | -LL | #![feature(return_type_notation)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #109417 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - From 86fc6576d5d22dbebad259bb525b5ecb675f9d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Fri, 15 Mar 2024 19:09:24 +0100 Subject: [PATCH 4/9] Try to write the panic message with a single `write_all` call --- library/std/src/panicking.rs | 18 ++++++++++- .../exported_symbol_bad_unwind1.stderr | 1 + .../exported_symbol_bad_unwind2.both.stderr | 2 ++ ...orted_symbol_bad_unwind2.definition.stderr | 2 ++ ...ted_symbol_bad_unwind2.extern_block.stderr | 1 + .../return_pointer_on_unwind.stderr | 1 + .../intrinsics/uninit_uninhabited_type.stderr | 1 + .../tests/fail/intrinsics/zero_fn_ptr.stderr | 1 + .../miri/tests/fail/panic/bad_unwind.stderr | 1 + .../miri/tests/fail/panic/double_panic.stderr | 3 ++ .../miri/tests/fail/panic/panic_abort1.stderr | 1 + .../miri/tests/fail/panic/panic_abort2.stderr | 1 + .../miri/tests/fail/panic/panic_abort3.stderr | 1 + .../miri/tests/fail/panic/panic_abort4.stderr | 1 + .../panic/tls_macro_const_drop_panic.stderr | 1 + .../fail/panic/tls_macro_drop_panic.stderr | 1 + .../tests/fail/terminate-terminator.stderr | 2 ++ .../tests/fail/unwind-action-terminate.stderr | 2 ++ .../panic/alloc_error_handler_hook.stderr | 1 + .../panic/alloc_error_handler_panic.stderr | 1 + .../miri/tests/panic/div-by-zero-2.stderr | 1 + .../exported_symbol_good_unwind.stderr | 3 ++ .../miri/tests/panic/mir-validation.stderr | 1 + .../miri/tests/panic/oob_subslice.stderr | 1 + .../tests/panic/overflowing-lsh-neg.stderr | 1 + .../miri/tests/panic/overflowing-rsh-1.stderr | 1 + .../miri/tests/panic/overflowing-rsh-2.stderr | 1 + src/tools/miri/tests/panic/panic1.stderr | 1 + src/tools/miri/tests/panic/panic2.stderr | 1 + src/tools/miri/tests/panic/panic3.stderr | 1 + src/tools/miri/tests/panic/panic4.stderr | 1 + .../miri/tests/panic/transmute_fat2.stderr | 1 + .../panic/unsupported_foreign_function.stderr | 1 + .../tests/panic/unsupported_syscall.stderr | 1 + .../miri/tests/pass/panic/catch_panic.stderr | 11 +++++++ .../tests/pass/panic/concurrent-panic.stderr | 2 ++ .../pass/panic/nested_panic_caught.stderr | 2 ++ .../miri/tests/pass/panic/thread_panic.stderr | 2 ++ .../run-make/libtest-json/output-default.json | 2 +- .../libtest-json/output-stdout-success.json | 4 +-- .../run-make/libtest-junit/output-default.xml | 2 +- .../libtest-junit/output-stdout-success.xml | 2 +- .../doctest/failed-doctest-output.stdout | 1 + tests/rustdoc-ui/ice-bug-report-url.stderr | 1 + ...p-path-prefix-failed-doctest-output.stdout | 1 + .../synchronized-panic-handler.run.stderr | 2 ++ .../generic_const_exprs/issue-80742.stderr | 1 + .../const-eval/const-eval-query-stack.stderr | 1 + .../extern-types-field-offset.run.stderr | 1 + .../extern-types-size_of_val.align.run.stderr | 1 + .../extern-types-size_of_val.size.run.stderr | 1 + tests/ui/hygiene/panic-location.run.stderr | 1 + ...const-eval-select-backtrace-std.run.stderr | 1 + .../const-eval-select-backtrace.run.stderr | 1 + tests/ui/intrinsics/not-overridden.stderr | 1 + tests/ui/issues/issue-87707.run.stderr | 2 ++ tests/ui/layout/valid_range_oob.stderr | 1 + .../macros/assert-long-condition.run.stderr | 1 + tests/ui/mir/lint/storage-live.stderr | 1 + tests/ui/panics/default-backtrace-ice.stderr | 1 + tests/ui/panics/fmt-only-once.run.stderr | 1 + ...e-47429-short-backtraces.legacy.run.stderr | 1 + ...issue-47429-short-backtraces.v0.run.stderr | 1 + ...location-detail-panic-no-column.run.stderr | 1 + .../location-detail-panic-no-file.run.stderr | 1 + .../location-detail-panic-no-line.run.stderr | 1 + ...n-detail-panic-no-location-info.run.stderr | 1 + .../location-detail-unwrap-no-file.run.stderr | 1 + tests/ui/panics/panic-in-cleanup.run.stderr | 3 ++ tests/ui/panics/panic-in-ffi.run.stderr | 2 ++ .../panics/runtime-switch.legacy.run.stderr | 1 + tests/ui/panics/runtime-switch.v0.run.stderr | 1 + ...hort-ice-remove-middle-frames-2.run.stderr | 1 + .../short-ice-remove-middle-frames.run.stderr | 1 + .../ui/proc-macro/load-panic-backtrace.stderr | 1 + tests/ui/process/multi-panic.rs | 32 ++++++++++++------- .../println-with-broken-pipe.run.stderr | 1 + ...tiple_definitions_attribute_merging.stderr | 3 +- .../proc_macro_generated_packed.stderr | 3 +- .../effects/minicore.stderr | 2 ++ tests/ui/test-attrs/terse.run.stdout | 3 ++ .../test-panic-abort-nocapture.run.stderr | 2 ++ .../ui/test-attrs/test-panic-abort.run.stdout | 1 + .../test-attrs/test-thread-capture.run.stdout | 1 + .../test-thread-nocapture.run.stderr | 1 + tests/ui/track-diagnostics/track.stderr | 1 + tests/ui/treat-err-as-bug/err.stderr | 1 + .../treat-err-as-bug/span_delayed_bug.stderr | 1 + 88 files changed, 156 insertions(+), 20 deletions(-) diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs index 336e34d7b95e5..e527d9207a724 100644 --- a/library/std/src/panicking.rs +++ b/library/std/src/panicking.rs @@ -255,7 +255,23 @@ fn default_hook(info: &PanicHookInfo<'_>) { // Use a lock to prevent mixed output in multithreading context. // Some platforms also require it when printing a backtrace, like `SymFromAddr` on Windows. let mut lock = backtrace::lock(); - let _ = writeln!(err, "thread '{name}' panicked at {location}:\n{msg}"); + // Try to write the panic message to a buffer first to prevent other concurrent outputs + // interleaving with it. + let mut buffer = [0u8; 512]; + let mut cursor = crate::io::Cursor::new(&mut buffer[..]); + + let write_msg = |dst: &mut dyn crate::io::Write| { + // We add a newline to ensure the panic message appears at the start of a line. + writeln!(dst, "\nthread '{name}' panicked at {location}:\n{msg}") + }; + + if write_msg(&mut cursor).is_ok() { + let pos = cursor.position() as usize; + let _ = err.write_all(&buffer[0..pos]); + } else { + // The message did not fit into the buffer, write it directly instead. + let _ = write_msg(err); + }; static FIRST_PANIC: AtomicBool = AtomicBool::new(true); diff --git a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind1.stderr b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind1.stderr index 5f306cc8ab1f9..8e63d78d759d3 100644 --- a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind1.stderr +++ b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind1.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/fail/function_calls/exported_symbol_bad_unwind1.rs:LL:CC: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr index aef45042e8bd5..b2a501db7763c 100644 --- a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr +++ b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr @@ -1,7 +1,9 @@ + thread 'main' panicked at tests/fail/function_calls/exported_symbol_bad_unwind2.rs:LL:CC: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect + thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC: panic in a function that cannot unwind stack backtrace: diff --git a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr index aef45042e8bd5..b2a501db7763c 100644 --- a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr +++ b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr @@ -1,7 +1,9 @@ + thread 'main' panicked at tests/fail/function_calls/exported_symbol_bad_unwind2.rs:LL:CC: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect + thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC: panic in a function that cannot unwind stack backtrace: diff --git a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.extern_block.stderr b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.extern_block.stderr index a81e8226e5ac4..767fd929fd44a 100644 --- a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.extern_block.stderr +++ b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.extern_block.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/fail/function_calls/exported_symbol_bad_unwind2.rs:LL:CC: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_on_unwind.stderr b/src/tools/miri/tests/fail/function_calls/return_pointer_on_unwind.stderr index db876cb5ce6db..e2a3d1600ea75 100644 --- a/src/tools/miri/tests/fail/function_calls/return_pointer_on_unwind.stderr +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_on_unwind.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/fail/function_calls/return_pointer_on_unwind.rs:LL:CC: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr b/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr index ffc3a3eae9605..2c9bea1724d63 100644 --- a/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr +++ b/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC: aborted execution: attempted to instantiate uninhabited type `!` note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr b/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr index 49cfc473bdff9..0634298a38f36 100644 --- a/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr +++ b/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC: aborted execution: attempted to zero-initialize type `fn()`, which is invalid note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/fail/panic/bad_unwind.stderr b/src/tools/miri/tests/fail/panic/bad_unwind.stderr index c152d1a96058d..6ba39e8f7e232 100644 --- a/src/tools/miri/tests/fail/panic/bad_unwind.stderr +++ b/src/tools/miri/tests/fail/panic/bad_unwind.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/fail/panic/bad_unwind.rs:LL:CC: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/fail/panic/double_panic.stderr b/src/tools/miri/tests/fail/panic/double_panic.stderr index 3e00821796eff..16e933be43480 100644 --- a/src/tools/miri/tests/fail/panic/double_panic.stderr +++ b/src/tools/miri/tests/fail/panic/double_panic.stderr @@ -1,10 +1,13 @@ + thread 'main' panicked at tests/fail/panic/double_panic.rs:LL:CC: first note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect + thread 'main' panicked at tests/fail/panic/double_panic.rs:LL:CC: second stack backtrace: + thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC: panic in a destructor during cleanup thread caused non-unwinding panic. aborting. diff --git a/src/tools/miri/tests/fail/panic/panic_abort1.stderr b/src/tools/miri/tests/fail/panic/panic_abort1.stderr index c5f04d581ca36..ca32722942fa8 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort1.stderr +++ b/src/tools/miri/tests/fail/panic/panic_abort1.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/fail/panic/panic_abort1.rs:LL:CC: panicking from libstd note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/fail/panic/panic_abort2.stderr b/src/tools/miri/tests/fail/panic/panic_abort2.stderr index 535cddfd4d41d..8d113d8058891 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort2.stderr +++ b/src/tools/miri/tests/fail/panic/panic_abort2.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/fail/panic/panic_abort2.rs:LL:CC: 42-panicking from libstd note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/fail/panic/panic_abort3.stderr b/src/tools/miri/tests/fail/panic/panic_abort3.stderr index e74cf342e3f4e..2ce753ba68989 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort3.stderr +++ b/src/tools/miri/tests/fail/panic/panic_abort3.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/fail/panic/panic_abort3.rs:LL:CC: panicking from libcore note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/fail/panic/panic_abort4.stderr b/src/tools/miri/tests/fail/panic/panic_abort4.stderr index 3983d169bdd8d..c9c5ae107b79d 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort4.stderr +++ b/src/tools/miri/tests/fail/panic/panic_abort4.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/fail/panic/panic_abort4.rs:LL:CC: 42-panicking from libcore note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/fail/panic/tls_macro_const_drop_panic.stderr b/src/tools/miri/tests/fail/panic/tls_macro_const_drop_panic.stderr index d93062b4bdce7..aadb9976609c3 100644 --- a/src/tools/miri/tests/fail/panic/tls_macro_const_drop_panic.stderr +++ b/src/tools/miri/tests/fail/panic/tls_macro_const_drop_panic.stderr @@ -1,3 +1,4 @@ + thread $NAME panicked at tests/fail/panic/tls_macro_const_drop_panic.rs:LL:CC: ow fatal runtime error: thread local panicked on drop diff --git a/src/tools/miri/tests/fail/panic/tls_macro_drop_panic.stderr b/src/tools/miri/tests/fail/panic/tls_macro_drop_panic.stderr index c0a2a30dbe139..546ee7e1ed214 100644 --- a/src/tools/miri/tests/fail/panic/tls_macro_drop_panic.stderr +++ b/src/tools/miri/tests/fail/panic/tls_macro_drop_panic.stderr @@ -1,3 +1,4 @@ + thread $NAME panicked at tests/fail/panic/tls_macro_drop_panic.rs:LL:CC: ow fatal runtime error: thread local panicked on drop diff --git a/src/tools/miri/tests/fail/terminate-terminator.stderr b/src/tools/miri/tests/fail/terminate-terminator.stderr index e1c0fabd03d38..f2548bf5cdb27 100644 --- a/src/tools/miri/tests/fail/terminate-terminator.stderr +++ b/src/tools/miri/tests/fail/terminate-terminator.stderr @@ -1,9 +1,11 @@ warning: You have explicitly enabled MIR optimizations, overriding Miri's default which is to completely disable them. Any optimizations may hide UB that Miri would otherwise detect, and it is not necessarily possible to predict what kind of UB will be missed. If you are enabling optimizations to make Miri run faster, we advise using cfg(miri) to shrink your workload instead. The performance benefit of enabling MIR optimizations is usually marginal at best. + thread 'main' panicked at tests/fail/terminate-terminator.rs:LL:CC: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect + thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC: panic in a function that cannot unwind stack backtrace: diff --git a/src/tools/miri/tests/fail/unwind-action-terminate.stderr b/src/tools/miri/tests/fail/unwind-action-terminate.stderr index 818371220514f..7b9a4383fc4c5 100644 --- a/src/tools/miri/tests/fail/unwind-action-terminate.stderr +++ b/src/tools/miri/tests/fail/unwind-action-terminate.stderr @@ -1,7 +1,9 @@ + thread 'main' panicked at tests/fail/unwind-action-terminate.rs:LL:CC: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect + thread 'main' panicked at RUSTLIB/core/src/panicking.rs:LL:CC: panic in a function that cannot unwind stack backtrace: diff --git a/src/tools/miri/tests/panic/alloc_error_handler_hook.stderr b/src/tools/miri/tests/panic/alloc_error_handler_hook.stderr index 363298e49d99b..2be0696832130 100644 --- a/src/tools/miri/tests/panic/alloc_error_handler_hook.stderr +++ b/src/tools/miri/tests/panic/alloc_error_handler_hook.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/panic/alloc_error_handler_hook.rs:LL:CC: alloc error hook called note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/panic/alloc_error_handler_panic.stderr b/src/tools/miri/tests/panic/alloc_error_handler_panic.stderr index 2cdff03f10f09..ddee4fd6ce37c 100644 --- a/src/tools/miri/tests/panic/alloc_error_handler_panic.stderr +++ b/src/tools/miri/tests/panic/alloc_error_handler_panic.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at RUSTLIB/std/src/alloc.rs:LL:CC: memory allocation of 4 bytes failed note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/panic/div-by-zero-2.stderr b/src/tools/miri/tests/panic/div-by-zero-2.stderr index e47a754d38dde..4d4b0062d5e17 100644 --- a/src/tools/miri/tests/panic/div-by-zero-2.stderr +++ b/src/tools/miri/tests/panic/div-by-zero-2.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/panic/div-by-zero-2.rs:LL:CC: attempt to divide by zero note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/panic/function_calls/exported_symbol_good_unwind.stderr b/src/tools/miri/tests/panic/function_calls/exported_symbol_good_unwind.stderr index ec75b6201c280..8bcd635e8bed4 100644 --- a/src/tools/miri/tests/panic/function_calls/exported_symbol_good_unwind.stderr +++ b/src/tools/miri/tests/panic/function_calls/exported_symbol_good_unwind.stderr @@ -1,8 +1,11 @@ + thread 'main' panicked at tests/panic/function_calls/exported_symbol_good_unwind.rs:LL:CC: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect + thread 'main' panicked at tests/panic/function_calls/exported_symbol_good_unwind.rs:LL:CC: explicit panic + thread 'main' panicked at tests/panic/function_calls/exported_symbol_good_unwind.rs:LL:CC: explicit panic diff --git a/src/tools/miri/tests/panic/mir-validation.stderr b/src/tools/miri/tests/panic/mir-validation.stderr index 534e2d5881ffc..dc70d129da3c3 100644 --- a/src/tools/miri/tests/panic/mir-validation.stderr +++ b/src/tools/miri/tests/panic/mir-validation.stderr @@ -1,3 +1,4 @@ + thread 'rustc' panicked at compiler/rustc_mir_transform/src/validate.rs:LL:CC: broken MIR in Item(DefId) (after phase change to runtime-optimized) at bb0[1]: place (*(_2.0: *mut i32)) has deref as a later projection (it is only permitted as the first projection) diff --git a/src/tools/miri/tests/panic/oob_subslice.stderr b/src/tools/miri/tests/panic/oob_subslice.stderr index d608cec20a487..c0dabaff77216 100644 --- a/src/tools/miri/tests/panic/oob_subslice.stderr +++ b/src/tools/miri/tests/panic/oob_subslice.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/panic/oob_subslice.rs:LL:CC: range end index 5 out of range for slice of length 4 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/panic/overflowing-lsh-neg.stderr b/src/tools/miri/tests/panic/overflowing-lsh-neg.stderr index 29150052b30d7..d674e2beb8db6 100644 --- a/src/tools/miri/tests/panic/overflowing-lsh-neg.stderr +++ b/src/tools/miri/tests/panic/overflowing-lsh-neg.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/panic/overflowing-lsh-neg.rs:LL:CC: attempt to shift left with overflow note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/panic/overflowing-rsh-1.stderr b/src/tools/miri/tests/panic/overflowing-rsh-1.stderr index 9a71a797dae8b..bb94f2e12c4e7 100644 --- a/src/tools/miri/tests/panic/overflowing-rsh-1.stderr +++ b/src/tools/miri/tests/panic/overflowing-rsh-1.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/panic/overflowing-rsh-1.rs:LL:CC: attempt to shift right with overflow note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/panic/overflowing-rsh-2.stderr b/src/tools/miri/tests/panic/overflowing-rsh-2.stderr index b671c53c611db..0a29a57f3e134 100644 --- a/src/tools/miri/tests/panic/overflowing-rsh-2.stderr +++ b/src/tools/miri/tests/panic/overflowing-rsh-2.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/panic/overflowing-rsh-2.rs:LL:CC: attempt to shift right with overflow note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/panic/panic1.stderr b/src/tools/miri/tests/panic/panic1.stderr index 7e011bfd53b14..130bc7737a49c 100644 --- a/src/tools/miri/tests/panic/panic1.stderr +++ b/src/tools/miri/tests/panic/panic1.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/panic/panic1.rs:LL:CC: panicking from libstd stack backtrace: diff --git a/src/tools/miri/tests/panic/panic2.stderr b/src/tools/miri/tests/panic/panic2.stderr index 5640bd0b8d6a1..157ffdb6b5ded 100644 --- a/src/tools/miri/tests/panic/panic2.stderr +++ b/src/tools/miri/tests/panic/panic2.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/panic/panic2.rs:LL:CC: 42-panicking from libstd note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/panic/panic3.stderr b/src/tools/miri/tests/panic/panic3.stderr index 0114320503b1d..529ef70870b1f 100644 --- a/src/tools/miri/tests/panic/panic3.stderr +++ b/src/tools/miri/tests/panic/panic3.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/panic/panic3.rs:LL:CC: panicking from libcore note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/panic/panic4.stderr b/src/tools/miri/tests/panic/panic4.stderr index f13b355ea45ab..ecd07dd7dedf8 100644 --- a/src/tools/miri/tests/panic/panic4.stderr +++ b/src/tools/miri/tests/panic/panic4.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/panic/panic4.rs:LL:CC: 42-panicking from libcore note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/panic/transmute_fat2.stderr b/src/tools/miri/tests/panic/transmute_fat2.stderr index a9bc0eb9d01c8..71e2d7a82085c 100644 --- a/src/tools/miri/tests/panic/transmute_fat2.stderr +++ b/src/tools/miri/tests/panic/transmute_fat2.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/panic/transmute_fat2.rs:LL:CC: index out of bounds: the len is 0 but the index is 0 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/panic/unsupported_foreign_function.stderr b/src/tools/miri/tests/panic/unsupported_foreign_function.stderr index 278af9612d655..0f6eacb9bb2f2 100644 --- a/src/tools/miri/tests/panic/unsupported_foreign_function.stderr +++ b/src/tools/miri/tests/panic/unsupported_foreign_function.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/panic/unsupported_foreign_function.rs:LL:CC: unsupported Miri functionality: can't call foreign function `foo` on $OS note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/panic/unsupported_syscall.stderr b/src/tools/miri/tests/panic/unsupported_syscall.stderr index e9b2b5b665227..91defac82f364 100644 --- a/src/tools/miri/tests/panic/unsupported_syscall.stderr +++ b/src/tools/miri/tests/panic/unsupported_syscall.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at tests/panic/unsupported_syscall.rs:LL:CC: unsupported Miri functionality: can't execute syscall with ID 0 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/src/tools/miri/tests/pass/panic/catch_panic.stderr b/src/tools/miri/tests/pass/panic/catch_panic.stderr index cb74312a83ae5..bc745fca578c2 100644 --- a/src/tools/miri/tests/pass/panic/catch_panic.stderr +++ b/src/tools/miri/tests/pass/panic/catch_panic.stderr @@ -1,35 +1,46 @@ + thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC: Hello from std::panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect Caught panic message (&str): Hello from std::panic + thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC: Hello from std::panic: 1 Caught panic message (String): Hello from std::panic: 1 + thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC: Hello from std::panic_any: 2 Caught panic message (String): Hello from std::panic_any: 2 + thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC: Box Failed to get caught panic message. + thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC: Hello from core::panic Caught panic message (&str): Hello from core::panic + thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC: Hello from core::panic: 5 Caught panic message (String): Hello from core::panic: 5 + thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC: index out of bounds: the len is 3 but the index is 4 Caught panic message (String): index out of bounds: the len is 3 but the index is 4 + thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC: attempt to divide by zero Caught panic message (&str): attempt to divide by zero + thread 'main' panicked at RUSTLIB/core/src/ptr/const_ptr.rs:LL:CC: align_offset: align is not a power-of-two Caught panic message (&str): align_offset: align is not a power-of-two + thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC: assertion failed: false Caught panic message (&str): assertion failed: false + thread 'main' panicked at tests/pass/panic/catch_panic.rs:LL:CC: assertion failed: false Caught panic message (&str): assertion failed: false diff --git a/src/tools/miri/tests/pass/panic/concurrent-panic.stderr b/src/tools/miri/tests/pass/panic/concurrent-panic.stderr index 9c87489e8db37..4a3ac16debca9 100644 --- a/src/tools/miri/tests/pass/panic/concurrent-panic.stderr +++ b/src/tools/miri/tests/pass/panic/concurrent-panic.stderr @@ -1,5 +1,6 @@ Thread 1 starting, will block on mutex Thread 1 reported it has started + thread '' panicked at tests/pass/panic/concurrent-panic.rs:LL:CC: panic in thread 2 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace @@ -7,6 +8,7 @@ note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` Thread 2 blocking on thread 1 Thread 2 reported it has started Unlocking mutex + thread '' panicked at tests/pass/panic/concurrent-panic.rs:LL:CC: panic in thread 1 Thread 1 has exited diff --git a/src/tools/miri/tests/pass/panic/nested_panic_caught.stderr b/src/tools/miri/tests/pass/panic/nested_panic_caught.stderr index e066f7dfce167..8aff8f6ec5504 100644 --- a/src/tools/miri/tests/pass/panic/nested_panic_caught.stderr +++ b/src/tools/miri/tests/pass/panic/nested_panic_caught.stderr @@ -1,7 +1,9 @@ + thread 'main' panicked at tests/pass/panic/nested_panic_caught.rs:LL:CC: once note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect + thread 'main' panicked at tests/pass/panic/nested_panic_caught.rs:LL:CC: twice stack backtrace: diff --git a/src/tools/miri/tests/pass/panic/thread_panic.stderr b/src/tools/miri/tests/pass/panic/thread_panic.stderr index 9464e76b6c9c0..3bb2991805c9d 100644 --- a/src/tools/miri/tests/pass/panic/thread_panic.stderr +++ b/src/tools/miri/tests/pass/panic/thread_panic.stderr @@ -1,6 +1,8 @@ + thread '' panicked at tests/pass/panic/thread_panic.rs:LL:CC: Hello! note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace note: in Miri, you may have to set `MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect + thread 'childthread' panicked at tests/pass/panic/thread_panic.rs:LL:CC: Hello, world! diff --git a/tests/run-make/libtest-json/output-default.json b/tests/run-make/libtest-json/output-default.json index a2293a032d012..a6a8a9f3b4774 100644 --- a/tests/run-make/libtest-json/output-default.json +++ b/tests/run-make/libtest-json/output-default.json @@ -2,7 +2,7 @@ { "type": "test", "event": "started", "name": "a" } { "type": "test", "name": "a", "event": "ok" } { "type": "test", "event": "started", "name": "b" } -{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'b' panicked at f.rs:9:5:\nassertion failed: false\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } +{ "type": "test", "name": "b", "event": "failed", "stdout": "\nthread 'b' panicked at f.rs:9:5:\nassertion failed: false\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } { "type": "test", "event": "started", "name": "c" } { "type": "test", "name": "c", "event": "ok" } { "type": "test", "event": "started", "name": "d" } diff --git a/tests/run-make/libtest-json/output-stdout-success.json b/tests/run-make/libtest-json/output-stdout-success.json index cf92f01f63aca..a6c36e746b38e 100644 --- a/tests/run-make/libtest-json/output-stdout-success.json +++ b/tests/run-make/libtest-json/output-stdout-success.json @@ -2,9 +2,9 @@ { "type": "test", "event": "started", "name": "a" } { "type": "test", "name": "a", "event": "ok", "stdout": "print from successful test\n" } { "type": "test", "event": "started", "name": "b" } -{ "type": "test", "name": "b", "event": "failed", "stdout": "thread 'b' panicked at f.rs:9:5:\nassertion failed: false\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } +{ "type": "test", "name": "b", "event": "failed", "stdout": "\nthread 'b' panicked at f.rs:9:5:\nassertion failed: false\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n" } { "type": "test", "event": "started", "name": "c" } -{ "type": "test", "name": "c", "event": "ok", "stdout": "thread 'c' panicked at f.rs:15:5:\nassertion failed: false\n" } +{ "type": "test", "name": "c", "event": "ok", "stdout": "\nthread 'c' panicked at f.rs:15:5:\nassertion failed: false\n" } { "type": "test", "event": "started", "name": "d" } { "type": "test", "name": "d", "event": "ignored", "message": "msg" } { "type": "suite", "event": "failed", "passed": 2, "failed": 1, "ignored": 1, "measured": 0, "filtered_out": 0, "exec_time": "$EXEC_TIME" } diff --git a/tests/run-make/libtest-junit/output-default.xml b/tests/run-make/libtest-junit/output-default.xml index 58a9a28744f6a..aa1b8c855aad4 100644 --- a/tests/run-make/libtest-junit/output-default.xml +++ b/tests/run-make/libtest-junit/output-default.xml @@ -1 +1 @@ - + diff --git a/tests/run-make/libtest-junit/output-stdout-success.xml b/tests/run-make/libtest-junit/output-stdout-success.xml index 723816a4acdaa..2592ec7efb168 100644 --- a/tests/run-make/libtest-junit/output-stdout-success.xml +++ b/tests/run-make/libtest-junit/output-stdout-success.xml @@ -1 +1 @@ - + diff --git a/tests/rustdoc-ui/doctest/failed-doctest-output.stdout b/tests/rustdoc-ui/doctest/failed-doctest-output.stdout index 7b0cf9a432d4c..a333f341ce539 100644 --- a/tests/rustdoc-ui/doctest/failed-doctest-output.stdout +++ b/tests/rustdoc-ui/doctest/failed-doctest-output.stdout @@ -26,6 +26,7 @@ stdout 2 stderr: stderr 1 stderr 2 + thread 'main' panicked at $DIR/failed-doctest-output.rs:7:1: oh no note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/rustdoc-ui/ice-bug-report-url.stderr b/tests/rustdoc-ui/ice-bug-report-url.stderr index 66622a7654c9d..14a961c2ce012 100644 --- a/tests/rustdoc-ui/ice-bug-report-url.stderr +++ b/tests/rustdoc-ui/ice-bug-report-url.stderr @@ -5,6 +5,7 @@ LL | fn wrong() | ^ expected one of `->`, `where`, or `{` + aborting due to `-Z treat-err-as-bug=1` stack backtrace: diff --git a/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.stdout b/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.stdout index 2102e2c389184..87d1e772b808a 100644 --- a/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.stdout +++ b/tests/rustdoc-ui/remap-path-prefix-failed-doctest-output.stdout @@ -8,6 +8,7 @@ failures: Test executable failed (exit status: 101). stderr: + thread 'main' panicked at remapped_path/remap-path-prefix-failed-doctest-output.rs:3:1: oh no note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/backtrace/synchronized-panic-handler.run.stderr b/tests/ui/backtrace/synchronized-panic-handler.run.stderr index 8a06d00ea5998..7a60ef2da60fb 100644 --- a/tests/ui/backtrace/synchronized-panic-handler.run.stderr +++ b/tests/ui/backtrace/synchronized-panic-handler.run.stderr @@ -1,5 +1,7 @@ + thread '' panicked at $DIR/synchronized-panic-handler.rs:11:5: oops oh no woe is me note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + thread '' panicked at $DIR/synchronized-panic-handler.rs:11:5: oops oh no woe is me diff --git a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr index 01529599d37d0..c851a8380f2c4 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr @@ -1,6 +1,7 @@ error: internal compiler error: compiler/rustc_const_eval/src/interpret/operator.rs:LL:CC: unsized type for `NullaryOp::SizeOf` --> $SRC_DIR/core/src/mem/mod.rs:LL:COL + Box query stack during panic: #0 [eval_to_allocation_raw] const-evaluating + checking `::{constant#0}` diff --git a/tests/ui/consts/const-eval/const-eval-query-stack.stderr b/tests/ui/consts/const-eval/const-eval-query-stack.stderr index 0a28c5b80bf77..5a71c770fdc7a 100644 --- a/tests/ui/consts/const-eval/const-eval-query-stack.stderr +++ b/tests/ui/consts/const-eval/const-eval-query-stack.stderr @@ -4,6 +4,7 @@ error: internal compiler error[E0080]: evaluation of constant value failed LL | const X: i32 = 1 / 0; | ^^^^^ attempt to divide `1_i32` by zero + note: please make sure that you have updated to the latest nightly query stack during panic: diff --git a/tests/ui/extern/extern-types-field-offset.run.stderr b/tests/ui/extern/extern-types-field-offset.run.stderr index f14073989800b..9405fad1848c6 100644 --- a/tests/ui/extern/extern-types-field-offset.run.stderr +++ b/tests/ui/extern/extern-types-field-offset.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at core/src/panicking.rs:$LINE:$COL: attempted to compute the size or alignment of extern type `Opaque` note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/extern/extern-types-size_of_val.align.run.stderr b/tests/ui/extern/extern-types-size_of_val.align.run.stderr index faad1aa13faf6..c4960663e04b3 100644 --- a/tests/ui/extern/extern-types-size_of_val.align.run.stderr +++ b/tests/ui/extern/extern-types-size_of_val.align.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at core/src/panicking.rs:$LINE:$COL: attempted to compute the size or alignment of extern type `A` note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/extern/extern-types-size_of_val.size.run.stderr b/tests/ui/extern/extern-types-size_of_val.size.run.stderr index faad1aa13faf6..c4960663e04b3 100644 --- a/tests/ui/extern/extern-types-size_of_val.size.run.stderr +++ b/tests/ui/extern/extern-types-size_of_val.size.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at core/src/panicking.rs:$LINE:$COL: attempted to compute the size or alignment of extern type `A` note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/hygiene/panic-location.run.stderr b/tests/ui/hygiene/panic-location.run.stderr index bfed4cd665030..fffdb185a0bf3 100644 --- a/tests/ui/hygiene/panic-location.run.stderr +++ b/tests/ui/hygiene/panic-location.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at alloc/src/raw_vec.rs:LL:CC: capacity overflow note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr b/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr index a0024c0920ff7..71d792b7f7712 100644 --- a/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr +++ b/tests/ui/intrinsics/const-eval-select-backtrace-std.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at $DIR/const-eval-select-backtrace-std.rs:6:8: byte index 1 is out of bounds of `` note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/intrinsics/const-eval-select-backtrace.run.stderr b/tests/ui/intrinsics/const-eval-select-backtrace.run.stderr index 8f38d54146b88..4f11f5966ed19 100644 --- a/tests/ui/intrinsics/const-eval-select-backtrace.run.stderr +++ b/tests/ui/intrinsics/const-eval-select-backtrace.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at $DIR/const-eval-select-backtrace.rs:15:5: Aaah! note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/intrinsics/not-overridden.stderr b/tests/ui/intrinsics/not-overridden.stderr index 9b8849cea1ced..b5273a4fa47fc 100644 --- a/tests/ui/intrinsics/not-overridden.stderr +++ b/tests/ui/intrinsics/not-overridden.stderr @@ -4,6 +4,7 @@ error: must be overridden by codegen backend, but isn't LL | unsafe { const_deallocate(std::ptr::null_mut(), 0, 0) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + query stack during panic: end of query stack error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-87707.run.stderr b/tests/ui/issues/issue-87707.run.stderr index 255a77a6ab12c..eb1d65a081fe4 100644 --- a/tests/ui/issues/issue-87707.run.stderr +++ b/tests/ui/issues/issue-87707.run.stderr @@ -1,5 +1,7 @@ + thread 'main' panicked at $DIR/issue-87707.rs:14:24: Here Once instance is poisoned. note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + thread 'main' panicked at $DIR/issue-87707.rs:16:7: Once instance has previously been poisoned diff --git a/tests/ui/layout/valid_range_oob.stderr b/tests/ui/layout/valid_range_oob.stderr index d56804a35a7f4..9c360b2cd6e7e 100644 --- a/tests/ui/layout/valid_range_oob.stderr +++ b/tests/ui/layout/valid_range_oob.stderr @@ -1,3 +1,4 @@ + 257 > 255 error: the compiler unexpectedly panicked. this is a bug. diff --git a/tests/ui/macros/assert-long-condition.run.stderr b/tests/ui/macros/assert-long-condition.run.stderr index 5c0ff357cb7a7..c2c5fe5d7d5a4 100644 --- a/tests/ui/macros/assert-long-condition.run.stderr +++ b/tests/ui/macros/assert-long-condition.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at $DIR/assert-long-condition.rs:7:5: assertion failed: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 == 0 diff --git a/tests/ui/mir/lint/storage-live.stderr b/tests/ui/mir/lint/storage-live.stderr index 7d4c3f0832a97..c701231951223 100644 --- a/tests/ui/mir/lint/storage-live.stderr +++ b/tests/ui/mir/lint/storage-live.stderr @@ -11,6 +11,7 @@ note: delayed at compiler/rustc_mir_transform/src/lint.rs:LL:CC - disabled backt LL | StorageLive(a); | ^^^^^^^^^^^^^^ + aborting due to `-Z treat-err-as-bug=1` error: the compiler unexpectedly panicked. this is a bug. diff --git a/tests/ui/panics/default-backtrace-ice.stderr b/tests/ui/panics/default-backtrace-ice.stderr index 23b863568bc74..66092a1e92376 100644 --- a/tests/ui/panics/default-backtrace-ice.stderr +++ b/tests/ui/panics/default-backtrace-ice.stderr @@ -5,6 +5,7 @@ LL | fn main() { missing_ident; } | ^^^^^^^^^^^^^ not found in this scope + aborting due to `-Z treat-err-as-bug=1` stack backtrace: (end_short_backtrace) diff --git a/tests/ui/panics/fmt-only-once.run.stderr b/tests/ui/panics/fmt-only-once.run.stderr index a991706d34e1a..faa3cc91151df 100644 --- a/tests/ui/panics/fmt-only-once.run.stderr +++ b/tests/ui/panics/fmt-only-once.run.stderr @@ -1,4 +1,5 @@ fmt + thread 'main' panicked at $DIR/fmt-only-once.rs:20:5: PrintOnFmt note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/panics/issue-47429-short-backtraces.legacy.run.stderr b/tests/ui/panics/issue-47429-short-backtraces.legacy.run.stderr index dce91ce59e3a1..5a93dba51dfb2 100644 --- a/tests/ui/panics/issue-47429-short-backtraces.legacy.run.stderr +++ b/tests/ui/panics/issue-47429-short-backtraces.legacy.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at $DIR/issue-47429-short-backtraces.rs:23:5: explicit panic stack backtrace: diff --git a/tests/ui/panics/issue-47429-short-backtraces.v0.run.stderr b/tests/ui/panics/issue-47429-short-backtraces.v0.run.stderr index f458c7acb39fd..1d54e312b8cef 100644 --- a/tests/ui/panics/issue-47429-short-backtraces.v0.run.stderr +++ b/tests/ui/panics/issue-47429-short-backtraces.v0.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at $DIR/issue-47429-short-backtraces.rs:23:5: explicit panic stack backtrace: diff --git a/tests/ui/panics/location-detail-panic-no-column.run.stderr b/tests/ui/panics/location-detail-panic-no-column.run.stderr index 6d8d02a3a55fe..f63c09652b8f3 100644 --- a/tests/ui/panics/location-detail-panic-no-column.run.stderr +++ b/tests/ui/panics/location-detail-panic-no-column.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at $DIR/location-detail-panic-no-column.rs:7:0: column-redacted note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/panics/location-detail-panic-no-file.run.stderr b/tests/ui/panics/location-detail-panic-no-file.run.stderr index 492ad37f5c7c3..3d1c6defa316c 100644 --- a/tests/ui/panics/location-detail-panic-no-file.run.stderr +++ b/tests/ui/panics/location-detail-panic-no-file.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at :7:5: file-redacted note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/panics/location-detail-panic-no-line.run.stderr b/tests/ui/panics/location-detail-panic-no-line.run.stderr index fdbc43c4311d3..9809ab5e2b4df 100644 --- a/tests/ui/panics/location-detail-panic-no-line.run.stderr +++ b/tests/ui/panics/location-detail-panic-no-line.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at $DIR/location-detail-panic-no-line.rs:0:5: line-redacted note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/panics/location-detail-panic-no-location-info.run.stderr b/tests/ui/panics/location-detail-panic-no-location-info.run.stderr index 1e9002df95585..f68a0d663c0f5 100644 --- a/tests/ui/panics/location-detail-panic-no-location-info.run.stderr +++ b/tests/ui/panics/location-detail-panic-no-location-info.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at :0:0: no location info note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/panics/location-detail-unwrap-no-file.run.stderr b/tests/ui/panics/location-detail-unwrap-no-file.run.stderr index 52019f6223329..af4a4997faeaa 100644 --- a/tests/ui/panics/location-detail-unwrap-no-file.run.stderr +++ b/tests/ui/panics/location-detail-unwrap-no-file.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at :8:9: called `Option::unwrap()` on a `None` value note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/panics/panic-in-cleanup.run.stderr b/tests/ui/panics/panic-in-cleanup.run.stderr index 3417d4bf1a300..2e52c76a5e2ed 100644 --- a/tests/ui/panics/panic-in-cleanup.run.stderr +++ b/tests/ui/panics/panic-in-cleanup.run.stderr @@ -1,9 +1,12 @@ + thread 'main' panicked at $DIR/panic-in-cleanup.rs:22:5: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + thread 'main' panicked at $DIR/panic-in-cleanup.rs:16:9: BOOM stack backtrace: + thread 'main' panicked at core/src/panicking.rs:$LINE:$COL: panic in a destructor during cleanup thread caused non-unwinding panic. aborting. diff --git a/tests/ui/panics/panic-in-ffi.run.stderr b/tests/ui/panics/panic-in-ffi.run.stderr index fc70847ad9a3a..cb9f3019ee633 100644 --- a/tests/ui/panics/panic-in-ffi.run.stderr +++ b/tests/ui/panics/panic-in-ffi.run.stderr @@ -1,6 +1,8 @@ + thread 'main' panicked at $DIR/panic-in-ffi.rs:12:5: Test note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + thread 'main' panicked at core/src/panicking.rs:$LINE:$COL: panic in a function that cannot unwind stack backtrace: diff --git a/tests/ui/panics/runtime-switch.legacy.run.stderr b/tests/ui/panics/runtime-switch.legacy.run.stderr index bd05b6cc00fb1..1cae27b1e2d6c 100644 --- a/tests/ui/panics/runtime-switch.legacy.run.stderr +++ b/tests/ui/panics/runtime-switch.legacy.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at $DIR/runtime-switch.rs:26:5: explicit panic stack backtrace: diff --git a/tests/ui/panics/runtime-switch.v0.run.stderr b/tests/ui/panics/runtime-switch.v0.run.stderr index 2078c356d5cd7..1958ee4433bf5 100644 --- a/tests/ui/panics/runtime-switch.v0.run.stderr +++ b/tests/ui/panics/runtime-switch.v0.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at $DIR/runtime-switch.rs:26:5: explicit panic stack backtrace: diff --git a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr index 2b648a0cad2ea..35b8ea70e6726 100644 --- a/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr +++ b/tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:56:5: debug!!! stack backtrace: diff --git a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr index 5b37268409679..6abdaadc017a0 100644 --- a/tests/ui/panics/short-ice-remove-middle-frames.run.stderr +++ b/tests/ui/panics/short-ice-remove-middle-frames.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:52:5: debug!!! stack backtrace: diff --git a/tests/ui/proc-macro/load-panic-backtrace.stderr b/tests/ui/proc-macro/load-panic-backtrace.stderr index 18f5135867262..5003f9cefc432 100644 --- a/tests/ui/proc-macro/load-panic-backtrace.stderr +++ b/tests/ui/proc-macro/load-panic-backtrace.stderr @@ -1,3 +1,4 @@ + at $DIR/auxiliary/test-macros.rs:43:5: panic-derive error: proc-macro derive panicked diff --git a/tests/ui/process/multi-panic.rs b/tests/ui/process/multi-panic.rs index 02b699036541d..ad47925a14987 100644 --- a/tests/ui/process/multi-panic.rs +++ b/tests/ui/process/multi-panic.rs @@ -6,12 +6,17 @@ fn check_for_no_backtrace(test: std::process::Output) { assert!(!test.status.success()); let err = String::from_utf8_lossy(&test.stderr); - let mut it = err.lines(); + let mut it = err.lines().filter(|l| !l.is_empty()); assert_eq!(it.next().map(|l| l.starts_with("thread '' panicked")), Some(true)); assert_eq!(it.next().is_some(), true); - assert_eq!(it.next(), Some("note: run with `RUST_BACKTRACE=1` \ - environment variable to display a backtrace")); + assert_eq!( + it.next(), + Some( + "note: run with `RUST_BACKTRACE=1` \ + environment variable to display a backtrace" + ) + ); assert_eq!(it.next().map(|l| l.starts_with("thread 'main' panicked at")), Some(true)); assert_eq!(it.next().is_some(), true); assert_eq!(it.next(), None); @@ -22,19 +27,22 @@ fn main() { if args.len() > 1 && args[1] == "run_test" { let _ = std::thread::spawn(|| { panic!(); - }).join(); + }) + .join(); panic!(); } else { - let test = std::process::Command::new(&args[0]).arg("run_test") - .env_remove("RUST_BACKTRACE") - .output() - .unwrap(); + let test = std::process::Command::new(&args[0]) + .arg("run_test") + .env_remove("RUST_BACKTRACE") + .output() + .unwrap(); check_for_no_backtrace(test); - let test = std::process::Command::new(&args[0]).arg("run_test") - .env("RUST_BACKTRACE","0") - .output() - .unwrap(); + let test = std::process::Command::new(&args[0]) + .arg("run_test") + .env("RUST_BACKTRACE", "0") + .output() + .unwrap(); check_for_no_backtrace(test); } } diff --git a/tests/ui/process/println-with-broken-pipe.run.stderr b/tests/ui/process/println-with-broken-pipe.run.stderr index f9d138a042414..2dde13873d7aa 100644 --- a/tests/ui/process/println-with-broken-pipe.run.stderr +++ b/tests/ui/process/println-with-broken-pipe.run.stderr @@ -1,3 +1,4 @@ + thread 'main' panicked at std/src/io/stdio.rs:LL:CC: failed printing to stdout: Broken pipe (os error 32) note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/resolve/multiple_definitions_attribute_merging.stderr b/tests/ui/resolve/multiple_definitions_attribute_merging.stderr index 98cad18d442c6..804fa079bb99e 100644 --- a/tests/ui/resolve/multiple_definitions_attribute_merging.stderr +++ b/tests/ui/resolve/multiple_definitions_attribute_merging.stderr @@ -16,7 +16,8 @@ LL | #[repr(C)] LL | struct Dealigned(u8, T); | ^ | - = Box + = +Box query stack during panic: #0 [mir_built] building MIR for `::eq` #1 [check_unsafety] unsafety-checking `::eq` diff --git a/tests/ui/resolve/proc_macro_generated_packed.stderr b/tests/ui/resolve/proc_macro_generated_packed.stderr index 4e716704610b1..a5a02c9c393ae 100644 --- a/tests/ui/resolve/proc_macro_generated_packed.stderr +++ b/tests/ui/resolve/proc_macro_generated_packed.stderr @@ -7,7 +7,8 @@ LL | #[derive(PartialEq)] LL | struct Dealigned(u8, T); | ^ | - = Box + = +Box query stack during panic: #0 [mir_built] building MIR for `::eq` #1 [check_unsafety] unsafety-checking `::eq` diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr index 823ab69df9cb5..f91b67202d7c0 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr @@ -1,3 +1,4 @@ + error: the compiler unexpectedly panicked. this is a bug. query stack during panic: @@ -5,6 +6,7 @@ query stack during panic: #1 [check_mod_type_wf] checking that types are well-formed in top-level module end of query stack + error: the compiler unexpectedly panicked. this is a bug. query stack during panic: diff --git a/tests/ui/test-attrs/terse.run.stdout b/tests/ui/test-attrs/terse.run.stdout index 2b361361ae888..ac1ac28c98d54 100644 --- a/tests/ui/test-attrs/terse.run.stdout +++ b/tests/ui/test-attrs/terse.run.stdout @@ -9,15 +9,18 @@ foo2 --- FAILED failures: ---- abc stdout ---- + thread 'abc' panicked at $DIR/terse.rs:12:5: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ---- foo stdout ---- + thread 'foo' panicked at $DIR/terse.rs:17:5: explicit panic ---- foo2 stdout ---- + thread 'foo2' panicked at $DIR/terse.rs:22:5: explicit panic diff --git a/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr b/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr index 16001b3eecd4d..256811711703b 100644 --- a/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr +++ b/tests/ui/test-attrs/test-panic-abort-nocapture.run.stderr @@ -1,8 +1,10 @@ + thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:34:5: assertion `left == right` failed left: 2 right: 4 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + thread 'main' panicked at $DIR/test-panic-abort-nocapture.rs:28:5: assertion `left == right` failed left: 2 diff --git a/tests/ui/test-attrs/test-panic-abort.run.stdout b/tests/ui/test-attrs/test-panic-abort.run.stdout index f5d14e77da963..844808e86370d 100644 --- a/tests/ui/test-attrs/test-panic-abort.run.stdout +++ b/tests/ui/test-attrs/test-panic-abort.run.stdout @@ -17,6 +17,7 @@ hello, world testing123 ---- it_fails stderr ---- testing321 + thread 'main' panicked at $DIR/test-panic-abort.rs:39:5: assertion `left == right` failed left: 2 diff --git a/tests/ui/test-attrs/test-thread-capture.run.stdout b/tests/ui/test-attrs/test-thread-capture.run.stdout index 31261aaa23065..f9b9757f861aa 100644 --- a/tests/ui/test-attrs/test-thread-capture.run.stdout +++ b/tests/ui/test-attrs/test-thread-capture.run.stdout @@ -10,6 +10,7 @@ fee fie foe fum + thread 'thready_fail' panicked at $DIR/test-thread-capture.rs:32:5: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/test-attrs/test-thread-nocapture.run.stderr b/tests/ui/test-attrs/test-thread-nocapture.run.stderr index 9266fe84197ba..59560015fca66 100644 --- a/tests/ui/test-attrs/test-thread-nocapture.run.stderr +++ b/tests/ui/test-attrs/test-thread-nocapture.run.stderr @@ -1,3 +1,4 @@ + thread 'thready_fail' panicked at $DIR/test-thread-nocapture.rs:32:5: explicit panic note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/track-diagnostics/track.stderr b/tests/ui/track-diagnostics/track.stderr index 436f9ecf93dec..d2908bb91776f 100644 --- a/tests/ui/track-diagnostics/track.stderr +++ b/tests/ui/track-diagnostics/track.stderr @@ -24,6 +24,7 @@ LL | break rust = note: rustc $VERSION running on $TARGET = note: compiler flags: ... -Z ui-testing ... -Z track-diagnostics + thread 'rustc' panicked at compiler/rustc_hir_typeck/src/lib.rs:LL:CC: Box note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace diff --git a/tests/ui/treat-err-as-bug/err.stderr b/tests/ui/treat-err-as-bug/err.stderr index eb7b50b421033..df5fed3fb8e94 100644 --- a/tests/ui/treat-err-as-bug/err.stderr +++ b/tests/ui/treat-err-as-bug/err.stderr @@ -4,6 +4,7 @@ error: internal compiler error[E0080]: could not evaluate static initializer LL | pub static C: u32 = 0 - 1; | ^^^^^ attempt to compute `0_u32 - 1_u32`, which would overflow + error: the compiler unexpectedly panicked. this is a bug. query stack during panic: diff --git a/tests/ui/treat-err-as-bug/span_delayed_bug.stderr b/tests/ui/treat-err-as-bug/span_delayed_bug.stderr index f0e8cd0ddb961..aec1b89c7666e 100644 --- a/tests/ui/treat-err-as-bug/span_delayed_bug.stderr +++ b/tests/ui/treat-err-as-bug/span_delayed_bug.stderr @@ -4,6 +4,7 @@ error: internal compiler error: delayed bug triggered by #[rustc_error(delayed_b LL | fn main() {} | ^^^^^^^^^ + error: the compiler unexpectedly panicked. this is a bug. query stack during panic: From 3b8089a32055fe9b716db3fcd9d61ccc5bfed97b Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 22 Sep 2024 13:10:12 -0400 Subject: [PATCH 5/9] Introduce structurally_normalize_const, use it in hir_typeck --- compiler/rustc_hir/src/hir.rs | 13 +++- compiler/rustc_hir_typeck/src/expr.rs | 66 ++++++++++--------- .../rustc_hir_typeck/src/fn_ctxt/_impl.rs | 27 ++++++++ .../src/fn_ctxt/suggestions.rs | 5 +- compiler/rustc_hir_typeck/src/intrinsicck.rs | 4 +- compiler/rustc_hir_typeck/src/pat.rs | 2 +- .../src/traits/structural_normalize.rs | 40 +++++++++++ .../generic_const_exprs/different-fn.stderr | 4 +- 8 files changed, 122 insertions(+), 39 deletions(-) diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index f92c6650355c5..00a6c3a029115 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1668,10 +1668,17 @@ pub enum ArrayLen<'hir> { } impl ArrayLen<'_> { - pub fn hir_id(&self) -> HirId { + pub fn span(self) -> Span { + match self { + ArrayLen::Infer(arg) => arg.span, + ArrayLen::Body(body) => body.span(), + } + } + + pub fn hir_id(self) -> HirId { match self { - ArrayLen::Infer(InferArg { hir_id, .. }) | ArrayLen::Body(ConstArg { hir_id, .. }) => { - *hir_id + ArrayLen::Infer(InferArg { hir_id, .. }) | ArrayLen::Body(&ConstArg { hir_id, .. }) => { + hir_id } } } diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 821a90d7a8c44..9341a449732a1 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -1491,8 +1491,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { expr: &'tcx hir::Expr<'tcx>, ) -> Ty<'tcx> { let tcx = self.tcx; - let count = self.lower_array_length(count); - if let Some(count) = count.try_eval_target_usize(tcx, self.param_env) { + let count_span = count.span(); + let count = self.try_structurally_resolve_const(count_span, self.lower_array_length(count)); + + if let Some(count) = count.try_to_target_usize(tcx) { self.suggest_array_len(expr, count); } @@ -1520,19 +1522,24 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { return Ty::new_error(tcx, guar); } - self.check_repeat_element_needs_copy_bound(element, count, element_ty); + // If the length is 0, we don't create any elements, so we don't copy any. + // If the length is 1, we don't copy that one element, we move it. Only check + // for `Copy` if the length is larger, or unevaluated. + // FIXME(min_const_generic_exprs): We could perhaps defer this check so that + // we don't require `::CONST` doesn't unnecessarily require `Copy`. + if count.try_to_target_usize(tcx).is_none_or(|x| x > 1) { + self.enforce_repeat_element_needs_copy_bound(element, element_ty); + } let ty = Ty::new_array_with_const_len(tcx, t, count); - self.register_wf_obligation(ty.into(), expr.span, ObligationCauseCode::WellFormed(None)); - ty } - fn check_repeat_element_needs_copy_bound( + /// Requires that `element_ty` is `Copy` (unless it's a const expression itself). + fn enforce_repeat_element_needs_copy_bound( &self, element: &hir::Expr<'_>, - count: ty::Const<'tcx>, element_ty: Ty<'tcx>, ) { let tcx = self.tcx; @@ -1565,27 +1572,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { _ => traits::IsConstable::No, }; - // If the length is 0, we don't create any elements, so we don't copy any. If the length is 1, we - // don't copy that one element, we move it. Only check for Copy if the length is larger. - if count.try_eval_target_usize(tcx, self.param_env).is_none_or(|len| len > 1) { - let lang_item = self.tcx.require_lang_item(LangItem::Copy, None); - let code = traits::ObligationCauseCode::RepeatElementCopy { - is_constable, - elt_type: element_ty, - elt_span: element.span, - elt_stmt_span: self - .tcx - .hir() - .parent_iter(element.hir_id) - .find_map(|(_, node)| match node { - hir::Node::Item(it) => Some(it.span), - hir::Node::Stmt(stmt) => Some(stmt.span), - _ => None, - }) - .expect("array repeat expressions must be inside an item or statement"), - }; - self.require_type_meets(element_ty, element.span, code, lang_item); - } + let lang_item = self.tcx.require_lang_item(LangItem::Copy, None); + let code = traits::ObligationCauseCode::RepeatElementCopy { + is_constable, + elt_type: element_ty, + elt_span: element.span, + elt_stmt_span: self + .tcx + .hir() + .parent_iter(element.hir_id) + .find_map(|(_, node)| match node { + hir::Node::Item(it) => Some(it.span), + hir::Node::Stmt(stmt) => Some(stmt.span), + _ => None, + }) + .expect("array repeat expressions must be inside an item or statement"), + }; + self.require_type_meets(element_ty, element.span, code, lang_item); } fn check_expr_tuple( @@ -2800,9 +2803,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { len: ty::Const<'tcx>, ) { err.span_label(field.span, "unknown field"); - if let (Some(len), Ok(user_index)) = - (len.try_eval_target_usize(self.tcx, self.param_env), field.as_str().parse::()) - { + if let (Some(len), Ok(user_index)) = ( + self.try_structurally_resolve_const(base.span, len).try_to_target_usize(self.tcx), + field.as_str().parse::(), + ) { let help = "instead of using tuple indexing, use array indexing"; let applicability = if len < user_index { Applicability::MachineApplicable diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs index 61898b06476fd..b019c75cd2edb 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs @@ -1477,6 +1477,33 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } + #[instrument(level = "debug", skip(self, sp), ret)] + pub fn try_structurally_resolve_const(&self, sp: Span, ct: ty::Const<'tcx>) -> ty::Const<'tcx> { + // FIXME(min_const_generic_exprs): We could process obligations here if `ct` is a var. + + if self.next_trait_solver() + && let ty::ConstKind::Unevaluated(..) = ct.kind() + { + // We need to use a separate variable here as otherwise the temporary for + // `self.fulfillment_cx.borrow_mut()` is alive in the `Err` branch, resulting + // in a reentrant borrow, causing an ICE. + let result = self + .at(&self.misc(sp), self.param_env) + .structurally_normalize_const(ct, &mut **self.fulfillment_cx.borrow_mut()); + match result { + Ok(normalized_ct) => normalized_ct, + Err(errors) => { + let guar = self.err_ctxt().report_fulfillment_errors(errors); + return ty::Const::new_error(self.tcx, guar); + } + } + } else if self.tcx.features().generic_const_exprs { + ct.normalize(self.tcx, self.param_env) + } else { + ct + } + } + /// Resolves `ty` by a single level if `ty` is a type variable. /// /// When the new solver is enabled, this will also attempt to normalize diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index b71e34864fd98..35ed63bf23233 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -1502,7 +1502,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Create an dummy type `&[_]` so that both &[] and `&Vec` can coerce to it. let dummy_ty = if let ty::Array(elem_ty, size) = peeled.kind() && let ty::Infer(_) = elem_ty.kind() - && size.try_eval_target_usize(self.tcx, self.param_env) == Some(0) + && self + .try_structurally_resolve_const(provided_expr.span, *size) + .try_to_target_usize(self.tcx) + == Some(0) { let slice = Ty::new_slice(self.tcx, *elem_ty); Ty::new_imm_ref(self.tcx, self.tcx.lifetimes.re_static, slice) diff --git a/compiler/rustc_hir_typeck/src/intrinsicck.rs b/compiler/rustc_hir_typeck/src/intrinsicck.rs index 81d940a3f9b47..a4121adf628af 100644 --- a/compiler/rustc_hir_typeck/src/intrinsicck.rs +++ b/compiler/rustc_hir_typeck/src/intrinsicck.rs @@ -101,7 +101,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } Ok(SizeSkeleton::Generic(size)) => { - if let Some(size) = size.try_eval_target_usize(tcx, self.param_env) { + if let Some(size) = + self.try_structurally_resolve_const(span, size).try_to_target_usize(tcx) + { format!("{size} bytes") } else { format!("generic size {size}") diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index 7dd6deb4fe6fd..f911137c94074 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -2412,7 +2412,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { len: ty::Const<'tcx>, min_len: u64, ) -> (Option>, Ty<'tcx>) { - let len = len.try_eval_target_usize(self.tcx, self.param_env); + let len = self.try_structurally_resolve_const(span, len).try_to_target_usize(self.tcx); let guar = if let Some(len) = len { // Now we know the length... diff --git a/compiler/rustc_trait_selection/src/traits/structural_normalize.rs b/compiler/rustc_trait_selection/src/traits/structural_normalize.rs index 9d657ade86bfe..3814f8112e92e 100644 --- a/compiler/rustc_trait_selection/src/traits/structural_normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/structural_normalize.rs @@ -46,4 +46,44 @@ impl<'tcx> At<'_, 'tcx> { Ok(self.normalize(ty).into_value_registering_obligations(self.infcx, fulfill_cx)) } } + + fn structurally_normalize_const( + &self, + ct: ty::Const<'tcx>, + fulfill_cx: &mut dyn TraitEngine<'tcx, E>, + ) -> Result, Vec> { + assert!(!ct.is_ct_infer(), "should have resolved vars before calling"); + + if self.infcx.next_trait_solver() { + let ty::ConstKind::Unevaluated(..) = ct.kind() else { + return Ok(ct); + }; + + let new_infer_ct = self.infcx.next_const_var(self.cause.span); + + // We simply emit an `alias-eq` goal here, since that will take care of + // normalizing the LHS of the projection until it is a rigid projection + // (or a not-yet-defined opaque in scope). + let obligation = Obligation::new( + self.infcx.tcx, + self.cause.clone(), + self.param_env, + ty::PredicateKind::AliasRelate( + ct.into(), + new_infer_ct.into(), + ty::AliasRelationDirection::Equate, + ), + ); + + fulfill_cx.register_predicate_obligation(self.infcx, obligation); + let errors = fulfill_cx.select_where_possible(self.infcx); + if !errors.is_empty() { + return Err(errors); + } + + Ok(self.infcx.resolve_vars_if_possible(new_infer_ct)) + } else { + Ok(self.normalize(ct).into_value_registering_obligations(self.infcx, fulfill_cx)) + } + } } diff --git a/tests/ui/const-generics/generic_const_exprs/different-fn.stderr b/tests/ui/const-generics/generic_const_exprs/different-fn.stderr index 52917df0da157..ac80463480db1 100644 --- a/tests/ui/const-generics/generic_const_exprs/different-fn.stderr +++ b/tests/ui/const-generics/generic_const_exprs/different-fn.stderr @@ -2,10 +2,10 @@ error[E0308]: mismatched types --> $DIR/different-fn.rs:10:5 | LL | [0; size_of::>()] - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `size_of::()`, found `size_of::>()` + | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `size_of::()`, found `0` | = note: expected constant `size_of::()` - found constant `size_of::>()` + found constant `0` error: unconstrained generic constant --> $DIR/different-fn.rs:10:9 From 2daf076fd8345ea2db1a81f56e8182e5f4e94ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Bj=C3=B8rnager=20Jensen?= Date: Sun, 22 Sep 2024 19:54:35 +0200 Subject: [PATCH 6/9] Mark 'make_ascii_uppercase' and 'make_ascii_lowercase' in 'u8' as const; Rename 'const_char_make_ascii' feature gate to 'const_make_ascii'; --- library/core/src/char/methods.rs | 4 ++-- library/core/src/num/mod.rs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index 9d9a3b5132cf9..2a0acfeacdf75 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -1277,7 +1277,7 @@ impl char { /// /// [`to_ascii_uppercase()`]: #method.to_ascii_uppercase #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] - #[rustc_const_unstable(feature = "const_char_make_ascii", issue = "130698")] + #[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")] #[inline] pub const fn make_ascii_uppercase(&mut self) { *self = self.to_ascii_uppercase(); @@ -1303,7 +1303,7 @@ impl char { /// /// [`to_ascii_lowercase()`]: #method.to_ascii_lowercase #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] - #[rustc_const_unstable(feature = "const_char_make_ascii", issue = "130698")] + #[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")] #[inline] pub const fn make_ascii_lowercase(&mut self) { *self = self.to_ascii_lowercase(); diff --git a/library/core/src/num/mod.rs b/library/core/src/num/mod.rs index dca644ebef4ad..1f6e43bdba3e6 100644 --- a/library/core/src/num/mod.rs +++ b/library/core/src/num/mod.rs @@ -614,8 +614,9 @@ impl u8 { /// /// [`to_ascii_uppercase`]: Self::to_ascii_uppercase #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] + #[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")] #[inline] - pub fn make_ascii_uppercase(&mut self) { + pub const fn make_ascii_uppercase(&mut self) { *self = self.to_ascii_uppercase(); } @@ -639,8 +640,9 @@ impl u8 { /// /// [`to_ascii_lowercase`]: Self::to_ascii_lowercase #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")] + #[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")] #[inline] - pub fn make_ascii_lowercase(&mut self) { + pub const fn make_ascii_lowercase(&mut self) { *self = self.to_ascii_lowercase(); } From 8f579497f7578de85dd33d585c1818e1a6d3176a Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 22 Sep 2024 13:52:20 -0400 Subject: [PATCH 7/9] Don't call const normalize in error reporting --- .../traits/fulfillment_errors.rs | 39 +++++++------- tests/ui/binop/binary-op-suggest-deref.stderr | 4 +- tests/ui/binop/binop-mul-i32-f32.stderr | 4 +- tests/ui/binop/shift-various-bad-types.stderr | 48 ++++++++--------- .../occurs-check/unused-substs-1.stderr | 2 +- .../const-eval/const-eval-overflow-3b.stderr | 4 +- .../const-eval/const-eval-overflow-4b.stderr | 4 +- tests/ui/impl-trait/equality.stderr | 4 +- tests/ui/issues/issue-11771.stderr | 32 ++++++------ tests/ui/issues/issue-24352.stderr | 4 +- tests/ui/issues/issue-50582.stderr | 16 +++--- .../invalid-iterator-chain-fixable.stderr | 6 +-- ...valid-iterator-chain-with-int-infer.stderr | 2 +- .../iterators/invalid-iterator-chain.stderr | 10 ++-- .../trailing-where-clause.stderr | 2 +- tests/ui/mismatched_types/binops.stderr | 52 +++++++++---------- tests/ui/never_type/issue-13352.stderr | 4 +- .../not-suggest-float-literal.stderr | 48 ++++++++--------- .../suggest-float-literal.stderr | 32 ++++++------ tests/ui/on-unimplemented/sum.stderr | 4 +- tests/ui/span/multiline-span-simple.stderr | 4 +- ...-trait-object-literal-bound-regions.stderr | 2 +- .../imm-ref-trait-object-literal.stderr | 2 +- tests/ui/suggestions/into-str.stderr | 2 +- .../question-mark-result-err-mismatch.stderr | 2 +- .../invalid-suggest-deref-issue-127590.stderr | 4 +- tests/ui/type/type-check-defaults.stderr | 4 +- tests/ui/typeck/issue-81293.stderr | 4 +- tests/ui/typeck/issue-90101.stderr | 2 +- tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr | 8 +-- 30 files changed, 177 insertions(+), 178 deletions(-) diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs index 1f11ee3f93991..98d73d7fa10f0 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs @@ -17,7 +17,7 @@ use rustc_middle::traits::select::OverflowError; use rustc_middle::traits::SignatureMismatchData; use rustc_middle::ty::abstract_const::NotConstEvaluatable; use rustc_middle::ty::error::{ExpectedFound, TypeError}; -use rustc_middle::ty::fold::{BottomUpFolder, TypeFolder, TypeSuperFoldable}; +use rustc_middle::ty::fold::{TypeFolder, TypeSuperFoldable}; use rustc_middle::ty::print::{ with_forced_trimmed_paths, FmtPrinter, Print, PrintTraitPredicateExt as _, PrintTraitRefExt as _, @@ -1794,22 +1794,18 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { return false; } - let cand = self.resolve_vars_if_possible(impl_trait_ref).fold_with( - &mut BottomUpFolder { - tcx: self.tcx, - ty_op: |ty| ty, - lt_op: |lt| lt, - ct_op: |ct| ct.normalize(self.tcx, ty::ParamEnv::empty()), - }, - ); - if cand.references_error() { + let impl_trait_ref = self.resolve_vars_if_possible(impl_trait_ref); + if impl_trait_ref.references_error() { return false; } err.highlighted_help(vec![ - StringPart::normal(format!("the trait `{}` ", cand.print_trait_sugared())), + StringPart::normal(format!( + "the trait `{}` ", + impl_trait_ref.print_trait_sugared() + )), StringPart::highlighted("is"), StringPart::normal(" implemented for `"), - StringPart::highlighted(cand.self_ty().to_string()), + StringPart::highlighted(impl_trait_ref.self_ty().to_string()), StringPart::normal("`"), ]); @@ -1921,15 +1917,18 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { let mut impl_candidates: Vec<_> = impl_candidates .iter() .cloned() + .filter(|cand| !cand.trait_ref.references_error()) .map(|mut cand| { - // Fold the consts so that they shows up as, e.g., `10` - // instead of `core::::array::{impl#30}::{constant#0}`. - cand.trait_ref = cand.trait_ref.fold_with(&mut BottomUpFolder { - tcx: self.tcx, - ty_op: |ty| ty, - lt_op: |lt| lt, - ct_op: |ct| ct.normalize(self.tcx, ty::ParamEnv::empty()), - }); + // Normalize the trait ref in its *own* param-env so + // that consts are folded and any trivial projections + // are normalized. + cand.trait_ref = self + .tcx + .try_normalize_erasing_regions( + self.tcx.param_env(cand.impl_def_id), + cand.trait_ref, + ) + .unwrap_or(cand.trait_ref); cand }) .collect(); diff --git a/tests/ui/binop/binary-op-suggest-deref.stderr b/tests/ui/binop/binary-op-suggest-deref.stderr index ec17074e3050f..01852fbc63308 100644 --- a/tests/ui/binop/binary-op-suggest-deref.stderr +++ b/tests/ui/binop/binary-op-suggest-deref.stderr @@ -303,8 +303,8 @@ LL | let _ = FOO & (*"Sized".to_string().into_boxed_str()); | = help: the trait `BitAnd` is not implemented for `i32` = help: the following other types implement trait `BitAnd`: - `&'a i32` implements `BitAnd` - `&i32` implements `BitAnd<&i32>` + `&i32` implements `BitAnd` + `&i32` implements `BitAnd` `i32` implements `BitAnd<&i32>` `i32` implements `BitAnd` diff --git a/tests/ui/binop/binop-mul-i32-f32.stderr b/tests/ui/binop/binop-mul-i32-f32.stderr index 33d8fba172ce2..dfb96a078cc6c 100644 --- a/tests/ui/binop/binop-mul-i32-f32.stderr +++ b/tests/ui/binop/binop-mul-i32-f32.stderr @@ -6,8 +6,8 @@ LL | x * y | = help: the trait `Mul` is not implemented for `i32` = help: the following other types implement trait `Mul`: - `&'a i32` implements `Mul` - `&i32` implements `Mul<&i32>` + `&i32` implements `Mul` + `&i32` implements `Mul` `i32` implements `Mul<&i32>` `i32` implements `Mul` diff --git a/tests/ui/binop/shift-various-bad-types.stderr b/tests/ui/binop/shift-various-bad-types.stderr index 7313cb3fb84f3..d7c9eb5f9df32 100644 --- a/tests/ui/binop/shift-various-bad-types.stderr +++ b/tests/ui/binop/shift-various-bad-types.stderr @@ -6,14 +6,14 @@ LL | 22 >> p.char; | = help: the trait `Shr` is not implemented for `{integer}` = help: the following other types implement trait `Shr`: - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` + `&i128` implements `Shr<&i16>` + `&i128` implements `Shr<&i32>` + `&i128` implements `Shr<&i64>` + `&i128` implements `Shr<&i8>` + `&i128` implements `Shr<&isize>` + `&i128` implements `Shr<&u128>` + `&i128` implements `Shr<&u16>` + `&i128` implements `Shr<&u32>` and 568 others error[E0277]: no implementation for `{integer} >> &str` @@ -24,14 +24,14 @@ LL | 22 >> p.str; | = help: the trait `Shr<&str>` is not implemented for `{integer}` = help: the following other types implement trait `Shr`: - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` + `&i128` implements `Shr<&i16>` + `&i128` implements `Shr<&i32>` + `&i128` implements `Shr<&i64>` + `&i128` implements `Shr<&i8>` + `&i128` implements `Shr<&isize>` + `&i128` implements `Shr<&u128>` + `&i128` implements `Shr<&u16>` + `&i128` implements `Shr<&u32>` and 568 others error[E0277]: no implementation for `{integer} >> &Panolpy` @@ -42,14 +42,14 @@ LL | 22 >> p; | = help: the trait `Shr<&Panolpy>` is not implemented for `{integer}` = help: the following other types implement trait `Shr`: - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` - `&'a i128` implements `Shr` + `&i128` implements `Shr<&i16>` + `&i128` implements `Shr<&i32>` + `&i128` implements `Shr<&i64>` + `&i128` implements `Shr<&i8>` + `&i128` implements `Shr<&isize>` + `&i128` implements `Shr<&u128>` + `&i128` implements `Shr<&u16>` + `&i128` implements `Shr<&u32>` and 568 others error[E0308]: mismatched types diff --git a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr index 8c66c4fefb7ed..0184a05932707 100644 --- a/tests/ui/const-generics/occurs-check/unused-substs-1.stderr +++ b/tests/ui/const-generics/occurs-check/unused-substs-1.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `A<_>: Bar<_>` is not satisfied LL | let _ = A; | ^ the trait `Bar<_>` is not implemented for `A<_>` | - = help: the trait `Bar<_>` is implemented for `A<7>` + = help: the trait `Bar<_>` is implemented for `A<{ 6 + 1 }>` note: required by a bound in `A` --> $DIR/unused-substs-1.rs:9:11 | diff --git a/tests/ui/consts/const-eval/const-eval-overflow-3b.stderr b/tests/ui/consts/const-eval/const-eval-overflow-3b.stderr index 0d9b718cd067f..f6eda69e12791 100644 --- a/tests/ui/consts/const-eval/const-eval-overflow-3b.stderr +++ b/tests/ui/consts/const-eval/const-eval-overflow-3b.stderr @@ -12,8 +12,8 @@ LL | = [0; (i8::MAX + 1u8) as usize]; | = help: the trait `Add` is not implemented for `i8` = help: the following other types implement trait `Add`: - `&'a i8` implements `Add` - `&i8` implements `Add<&i8>` + `&i8` implements `Add` + `&i8` implements `Add` `i8` implements `Add<&i8>` `i8` implements `Add` diff --git a/tests/ui/consts/const-eval/const-eval-overflow-4b.stderr b/tests/ui/consts/const-eval/const-eval-overflow-4b.stderr index 32fe30dc88247..399f21a989429 100644 --- a/tests/ui/consts/const-eval/const-eval-overflow-4b.stderr +++ b/tests/ui/consts/const-eval/const-eval-overflow-4b.stderr @@ -12,8 +12,8 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize] | = help: the trait `Add` is not implemented for `i8` = help: the following other types implement trait `Add`: - `&'a i8` implements `Add` - `&i8` implements `Add<&i8>` + `&i8` implements `Add` + `&i8` implements `Add` `i8` implements `Add<&i8>` `i8` implements `Add` diff --git a/tests/ui/impl-trait/equality.stderr b/tests/ui/impl-trait/equality.stderr index 12d886a002454..fd6f4b34241aa 100644 --- a/tests/ui/impl-trait/equality.stderr +++ b/tests/ui/impl-trait/equality.stderr @@ -30,8 +30,8 @@ LL | n + sum_to(n - 1) | = help: the trait `Add` is not implemented for `u32` = help: the following other types implement trait `Add`: - `&'a u32` implements `Add` - `&u32` implements `Add<&u32>` + `&u32` implements `Add` + `&u32` implements `Add` `u32` implements `Add<&u32>` `u32` implements `Add` diff --git a/tests/ui/issues/issue-11771.stderr b/tests/ui/issues/issue-11771.stderr index 8205ee0c38d53..5603dc18b635f 100644 --- a/tests/ui/issues/issue-11771.stderr +++ b/tests/ui/issues/issue-11771.stderr @@ -6,14 +6,14 @@ LL | 1 + | = help: the trait `Add<()>` is not implemented for `{integer}` = help: the following other types implement trait `Add`: - `&'a f128` implements `Add` - `&'a f16` implements `Add` - `&'a f32` implements `Add` - `&'a f64` implements `Add` - `&'a i128` implements `Add` - `&'a i16` implements `Add` - `&'a i32` implements `Add` - `&'a i64` implements `Add` + `&f128` implements `Add` + `&f128` implements `Add` + `&f16` implements `Add` + `&f16` implements `Add` + `&f32` implements `Add` + `&f32` implements `Add` + `&f64` implements `Add` + `&f64` implements `Add` and 56 others error[E0277]: cannot add `()` to `{integer}` @@ -24,14 +24,14 @@ LL | 1 + | = help: the trait `Add<()>` is not implemented for `{integer}` = help: the following other types implement trait `Add`: - `&'a f128` implements `Add` - `&'a f16` implements `Add` - `&'a f32` implements `Add` - `&'a f64` implements `Add` - `&'a i128` implements `Add` - `&'a i16` implements `Add` - `&'a i32` implements `Add` - `&'a i64` implements `Add` + `&f128` implements `Add` + `&f128` implements `Add` + `&f16` implements `Add` + `&f16` implements `Add` + `&f32` implements `Add` + `&f32` implements `Add` + `&f64` implements `Add` + `&f64` implements `Add` and 56 others error: aborting due to 2 previous errors diff --git a/tests/ui/issues/issue-24352.stderr b/tests/ui/issues/issue-24352.stderr index 2e7dc254d914d..3e0f812b5c757 100644 --- a/tests/ui/issues/issue-24352.stderr +++ b/tests/ui/issues/issue-24352.stderr @@ -6,8 +6,8 @@ LL | 1.0f64 - 1 | = help: the trait `Sub<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Sub`: - `&'a f64` implements `Sub` - `&f64` implements `Sub<&f64>` + `&f64` implements `Sub` + `&f64` implements `Sub` `f64` implements `Sub<&f64>` `f64` implements `Sub` help: consider using a floating-point literal by writing it with `.0` diff --git a/tests/ui/issues/issue-50582.stderr b/tests/ui/issues/issue-50582.stderr index 7203fdeb0bbca..af7a36f62fb88 100644 --- a/tests/ui/issues/issue-50582.stderr +++ b/tests/ui/issues/issue-50582.stderr @@ -16,14 +16,14 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new(); | = help: the trait `Add<()>` is not implemented for `{integer}` = help: the following other types implement trait `Add`: - `&'a f128` implements `Add` - `&'a f16` implements `Add` - `&'a f32` implements `Add` - `&'a f64` implements `Add` - `&'a i128` implements `Add` - `&'a i16` implements `Add` - `&'a i32` implements `Add` - `&'a i64` implements `Add` + `&f128` implements `Add` + `&f128` implements `Add` + `&f16` implements `Add` + `&f16` implements `Add` + `&f32` implements `Add` + `&f32` implements `Add` + `&f64` implements `Add` + `&f64` implements `Add` and 56 others error: aborting due to 2 previous errors diff --git a/tests/ui/iterators/invalid-iterator-chain-fixable.stderr b/tests/ui/iterators/invalid-iterator-chain-fixable.stderr index a7685e4938d88..3d3bbab881926 100644 --- a/tests/ui/iterators/invalid-iterator-chain-fixable.stderr +++ b/tests/ui/iterators/invalid-iterator-chain-fixable.stderr @@ -33,7 +33,7 @@ LL | println!("{}", scores.sum::()); | = help: the trait `Sum<()>` is not implemented for `i32` = help: the following other types implement trait `Sum`: - `i32` implements `Sum<&'a i32>` + `i32` implements `Sum<&i32>` `i32` implements `Sum` note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain-fixable.rs:14:10 @@ -66,7 +66,7 @@ LL | .sum::(), | = help: the trait `Sum<()>` is not implemented for `i32` = help: the following other types implement trait `Sum`: - `i32` implements `Sum<&'a i32>` + `i32` implements `Sum<&i32>` `i32` implements `Sum` note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain-fixable.rs:23:14 @@ -99,7 +99,7 @@ LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::()); | = help: the trait `Sum<()>` is not implemented for `i32` = help: the following other types implement trait `Sum`: - `i32` implements `Sum<&'a i32>` + `i32` implements `Sum<&i32>` `i32` implements `Sum` note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain-fixable.rs:27:38 diff --git a/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr b/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr index 189f089ba51a7..1f1f7c99e5610 100644 --- a/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr +++ b/tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr @@ -8,7 +8,7 @@ LL | let x = Some(()).iter().map(|()| 1).sum::(); | = help: the trait `Sum<{integer}>` is not implemented for `f32` = help: the following other types implement trait `Sum`: - `f32` implements `Sum<&'a f32>` + `f32` implements `Sum<&f32>` `f32` implements `Sum` note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain-with-int-infer.rs:2:29 diff --git a/tests/ui/iterators/invalid-iterator-chain.stderr b/tests/ui/iterators/invalid-iterator-chain.stderr index f72a9f702dcec..bc35fcd489df5 100644 --- a/tests/ui/iterators/invalid-iterator-chain.stderr +++ b/tests/ui/iterators/invalid-iterator-chain.stderr @@ -33,7 +33,7 @@ LL | println!("{}", scores.sum::()); | = help: the trait `Sum<()>` is not implemented for `i32` = help: the following other types implement trait `Sum`: - `i32` implements `Sum<&'a i32>` + `i32` implements `Sum<&i32>` `i32` implements `Sum` note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain.rs:12:10 @@ -65,7 +65,7 @@ LL | .sum::(), | = help: the trait `Sum<()>` is not implemented for `i32` = help: the following other types implement trait `Sum`: - `i32` implements `Sum<&'a i32>` + `i32` implements `Sum<&i32>` `i32` implements `Sum` note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain.rs:25:14 @@ -104,7 +104,7 @@ LL | .sum::(), | = help: the trait `Sum` is not implemented for `i32` = help: the following other types implement trait `Sum`: - `i32` implements `Sum<&'a i32>` + `i32` implements `Sum<&i32>` `i32` implements `Sum` note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain.rs:33:14 @@ -134,7 +134,7 @@ LL | println!("{}", vec![0, 1].iter().map(|x| { x; }).sum::()); | = help: the trait `Sum<()>` is not implemented for `i32` = help: the following other types implement trait `Sum`: - `i32` implements `Sum<&'a i32>` + `i32` implements `Sum<&i32>` `i32` implements `Sum` note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain.rs:38:38 @@ -162,7 +162,7 @@ LL | println!("{}", vec![(), ()].iter().sum::()); | = help: the trait `Sum<&()>` is not implemented for `i32` = help: the following other types implement trait `Sum`: - `i32` implements `Sum<&'a i32>` + `i32` implements `Sum<&i32>` `i32` implements `Sum` note: the method call chain might not have had the expected associated types --> $DIR/invalid-iterator-chain.rs:39:33 diff --git a/tests/ui/lazy-type-alias/trailing-where-clause.stderr b/tests/ui/lazy-type-alias/trailing-where-clause.stderr index 9fabbe91d25a4..93cd3145928b7 100644 --- a/tests/ui/lazy-type-alias/trailing-where-clause.stderr +++ b/tests/ui/lazy-type-alias/trailing-where-clause.stderr @@ -9,7 +9,7 @@ LL | let _: Alias<()>; `String` implements `From<&mut str>` `String` implements `From<&str>` `String` implements `From>` - `String` implements `From>` + `String` implements `From>` `String` implements `From` note: required by a bound in `Alias` --> $DIR/trailing-where-clause.rs:8:13 diff --git a/tests/ui/mismatched_types/binops.stderr b/tests/ui/mismatched_types/binops.stderr index 92f21a67c3707..c0cac5375230a 100644 --- a/tests/ui/mismatched_types/binops.stderr +++ b/tests/ui/mismatched_types/binops.stderr @@ -6,14 +6,14 @@ LL | 1 + Some(1); | = help: the trait `Add>` is not implemented for `{integer}` = help: the following other types implement trait `Add`: - `&'a f128` implements `Add` - `&'a f16` implements `Add` - `&'a f32` implements `Add` - `&'a f64` implements `Add` - `&'a i128` implements `Add` - `&'a i16` implements `Add` - `&'a i32` implements `Add` - `&'a i64` implements `Add` + `&f128` implements `Add` + `&f128` implements `Add` + `&f16` implements `Add` + `&f16` implements `Add` + `&f32` implements `Add` + `&f32` implements `Add` + `&f64` implements `Add` + `&f64` implements `Add` and 56 others error[E0277]: cannot subtract `Option<{integer}>` from `usize` @@ -24,8 +24,8 @@ LL | 2 as usize - Some(1); | = help: the trait `Sub>` is not implemented for `usize` = help: the following other types implement trait `Sub`: - `&'a usize` implements `Sub` - `&usize` implements `Sub<&usize>` + `&usize` implements `Sub` + `&usize` implements `Sub` `usize` implements `Sub<&usize>` `usize` implements `Sub` @@ -37,14 +37,14 @@ LL | 3 * (); | = help: the trait `Mul<()>` is not implemented for `{integer}` = help: the following other types implement trait `Mul`: - `&'a f128` implements `Mul` - `&'a f16` implements `Mul` - `&'a f32` implements `Mul` - `&'a f64` implements `Mul` - `&'a i128` implements `Mul` - `&'a i16` implements `Mul` - `&'a i32` implements `Mul` - `&'a i64` implements `Mul` + `&f128` implements `Mul` + `&f128` implements `Mul` + `&f16` implements `Mul` + `&f16` implements `Mul` + `&f32` implements `Mul` + `&f32` implements `Mul` + `&f64` implements `Mul` + `&f64` implements `Mul` and 57 others error[E0277]: cannot divide `{integer}` by `&str` @@ -55,14 +55,14 @@ LL | 4 / ""; | = help: the trait `Div<&str>` is not implemented for `{integer}` = help: the following other types implement trait `Div`: - `&'a f128` implements `Div` - `&'a f16` implements `Div` - `&'a f32` implements `Div` - `&'a f64` implements `Div` - `&'a i128` implements `Div` - `&'a i16` implements `Div` - `&'a i32` implements `Div` - `&'a i64` implements `Div` + `&f128` implements `Div` + `&f128` implements `Div` + `&f16` implements `Div` + `&f16` implements `Div` + `&f32` implements `Div` + `&f32` implements `Div` + `&f64` implements `Div` + `&f64` implements `Div` and 62 others error[E0277]: can't compare `{integer}` with `String` diff --git a/tests/ui/never_type/issue-13352.stderr b/tests/ui/never_type/issue-13352.stderr index 7134e4d40a6a7..6818fa860051d 100644 --- a/tests/ui/never_type/issue-13352.stderr +++ b/tests/ui/never_type/issue-13352.stderr @@ -6,8 +6,8 @@ LL | 2_usize + (loop {}); | = help: the trait `Add<()>` is not implemented for `usize` = help: the following other types implement trait `Add`: - `&'a usize` implements `Add` - `&usize` implements `Add<&usize>` + `&usize` implements `Add` + `&usize` implements `Add` `usize` implements `Add<&usize>` `usize` implements `Add` diff --git a/tests/ui/numbers-arithmetic/not-suggest-float-literal.stderr b/tests/ui/numbers-arithmetic/not-suggest-float-literal.stderr index a910666bd56ce..ec560fc5ed5c5 100644 --- a/tests/ui/numbers-arithmetic/not-suggest-float-literal.stderr +++ b/tests/ui/numbers-arithmetic/not-suggest-float-literal.stderr @@ -6,8 +6,8 @@ LL | x + 100.0 | = help: the trait `Add<{float}>` is not implemented for `u8` = help: the following other types implement trait `Add`: - `&'a u8` implements `Add` - `&u8` implements `Add<&u8>` + `&u8` implements `Add` + `&u8` implements `Add` `u8` implements `Add<&u8>` `u8` implements `Add` @@ -19,8 +19,8 @@ LL | x + "foo" | = help: the trait `Add<&str>` is not implemented for `f64` = help: the following other types implement trait `Add`: - `&'a f64` implements `Add` - `&f64` implements `Add<&f64>` + `&f64` implements `Add` + `&f64` implements `Add` `f64` implements `Add<&f64>` `f64` implements `Add` @@ -32,8 +32,8 @@ LL | x + y | = help: the trait `Add<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Add`: - `&'a f64` implements `Add` - `&f64` implements `Add<&f64>` + `&f64` implements `Add` + `&f64` implements `Add` `f64` implements `Add<&f64>` `f64` implements `Add` @@ -45,8 +45,8 @@ LL | x - 100.0 | = help: the trait `Sub<{float}>` is not implemented for `u8` = help: the following other types implement trait `Sub`: - `&'a u8` implements `Sub` - `&u8` implements `Sub<&u8>` + `&u8` implements `Sub` + `&u8` implements `Sub` `u8` implements `Sub<&u8>` `u8` implements `Sub` @@ -58,8 +58,8 @@ LL | x - "foo" | = help: the trait `Sub<&str>` is not implemented for `f64` = help: the following other types implement trait `Sub`: - `&'a f64` implements `Sub` - `&f64` implements `Sub<&f64>` + `&f64` implements `Sub` + `&f64` implements `Sub` `f64` implements `Sub<&f64>` `f64` implements `Sub` @@ -71,8 +71,8 @@ LL | x - y | = help: the trait `Sub<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Sub`: - `&'a f64` implements `Sub` - `&f64` implements `Sub<&f64>` + `&f64` implements `Sub` + `&f64` implements `Sub` `f64` implements `Sub<&f64>` `f64` implements `Sub` @@ -84,8 +84,8 @@ LL | x * 100.0 | = help: the trait `Mul<{float}>` is not implemented for `u8` = help: the following other types implement trait `Mul`: - `&'a u8` implements `Mul` - `&u8` implements `Mul<&u8>` + `&u8` implements `Mul` + `&u8` implements `Mul` `u8` implements `Mul<&u8>` `u8` implements `Mul` @@ -97,8 +97,8 @@ LL | x * "foo" | = help: the trait `Mul<&str>` is not implemented for `f64` = help: the following other types implement trait `Mul`: - `&'a f64` implements `Mul` - `&f64` implements `Mul<&f64>` + `&f64` implements `Mul` + `&f64` implements `Mul` `f64` implements `Mul<&f64>` `f64` implements `Mul` @@ -110,8 +110,8 @@ LL | x * y | = help: the trait `Mul<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Mul`: - `&'a f64` implements `Mul` - `&f64` implements `Mul<&f64>` + `&f64` implements `Mul` + `&f64` implements `Mul` `f64` implements `Mul<&f64>` `f64` implements `Mul` @@ -123,8 +123,8 @@ LL | x / 100.0 | = help: the trait `Div<{float}>` is not implemented for `u8` = help: the following other types implement trait `Div`: - `&'a u8` implements `Div` - `&u8` implements `Div<&u8>` + `&u8` implements `Div` + `&u8` implements `Div` `u8` implements `Div<&u8>` `u8` implements `Div>` `u8` implements `Div` @@ -137,8 +137,8 @@ LL | x / "foo" | = help: the trait `Div<&str>` is not implemented for `f64` = help: the following other types implement trait `Div`: - `&'a f64` implements `Div` - `&f64` implements `Div<&f64>` + `&f64` implements `Div` + `&f64` implements `Div` `f64` implements `Div<&f64>` `f64` implements `Div` @@ -150,8 +150,8 @@ LL | x / y | = help: the trait `Div<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Div`: - `&'a f64` implements `Div` - `&f64` implements `Div<&f64>` + `&f64` implements `Div` + `&f64` implements `Div` `f64` implements `Div<&f64>` `f64` implements `Div` diff --git a/tests/ui/numbers-arithmetic/suggest-float-literal.stderr b/tests/ui/numbers-arithmetic/suggest-float-literal.stderr index 8585ac485dbb2..d8bff8614a4e5 100644 --- a/tests/ui/numbers-arithmetic/suggest-float-literal.stderr +++ b/tests/ui/numbers-arithmetic/suggest-float-literal.stderr @@ -6,8 +6,8 @@ LL | x + 100 | = help: the trait `Add<{integer}>` is not implemented for `f32` = help: the following other types implement trait `Add`: - `&'a f32` implements `Add` - `&f32` implements `Add<&f32>` + `&f32` implements `Add` + `&f32` implements `Add` `f32` implements `Add<&f32>` `f32` implements `Add` help: consider using a floating-point literal by writing it with `.0` @@ -23,8 +23,8 @@ LL | x + 100 | = help: the trait `Add<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Add`: - `&'a f64` implements `Add` - `&f64` implements `Add<&f64>` + `&f64` implements `Add` + `&f64` implements `Add` `f64` implements `Add<&f64>` `f64` implements `Add` help: consider using a floating-point literal by writing it with `.0` @@ -40,8 +40,8 @@ LL | x - 100 | = help: the trait `Sub<{integer}>` is not implemented for `f32` = help: the following other types implement trait `Sub`: - `&'a f32` implements `Sub` - `&f32` implements `Sub<&f32>` + `&f32` implements `Sub` + `&f32` implements `Sub` `f32` implements `Sub<&f32>` `f32` implements `Sub` help: consider using a floating-point literal by writing it with `.0` @@ -57,8 +57,8 @@ LL | x - 100 | = help: the trait `Sub<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Sub`: - `&'a f64` implements `Sub` - `&f64` implements `Sub<&f64>` + `&f64` implements `Sub` + `&f64` implements `Sub` `f64` implements `Sub<&f64>` `f64` implements `Sub` help: consider using a floating-point literal by writing it with `.0` @@ -74,8 +74,8 @@ LL | x * 100 | = help: the trait `Mul<{integer}>` is not implemented for `f32` = help: the following other types implement trait `Mul`: - `&'a f32` implements `Mul` - `&f32` implements `Mul<&f32>` + `&f32` implements `Mul` + `&f32` implements `Mul` `f32` implements `Mul<&f32>` `f32` implements `Mul` help: consider using a floating-point literal by writing it with `.0` @@ -91,8 +91,8 @@ LL | x * 100 | = help: the trait `Mul<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Mul`: - `&'a f64` implements `Mul` - `&f64` implements `Mul<&f64>` + `&f64` implements `Mul` + `&f64` implements `Mul` `f64` implements `Mul<&f64>` `f64` implements `Mul` help: consider using a floating-point literal by writing it with `.0` @@ -108,8 +108,8 @@ LL | x / 100 | = help: the trait `Div<{integer}>` is not implemented for `f32` = help: the following other types implement trait `Div`: - `&'a f32` implements `Div` - `&f32` implements `Div<&f32>` + `&f32` implements `Div` + `&f32` implements `Div` `f32` implements `Div<&f32>` `f32` implements `Div` help: consider using a floating-point literal by writing it with `.0` @@ -125,8 +125,8 @@ LL | x / 100 | = help: the trait `Div<{integer}>` is not implemented for `f64` = help: the following other types implement trait `Div`: - `&'a f64` implements `Div` - `&f64` implements `Div<&f64>` + `&f64` implements `Div` + `&f64` implements `Div` `f64` implements `Div<&f64>` `f64` implements `Div` help: consider using a floating-point literal by writing it with `.0` diff --git a/tests/ui/on-unimplemented/sum.stderr b/tests/ui/on-unimplemented/sum.stderr index f8e266a872782..d89cc2f7bf3b9 100644 --- a/tests/ui/on-unimplemented/sum.stderr +++ b/tests/ui/on-unimplemented/sum.stderr @@ -8,7 +8,7 @@ LL | vec![(), ()].iter().sum::(); | = help: the trait `Sum<&()>` is not implemented for `i32` = help: the following other types implement trait `Sum`: - `i32` implements `Sum<&'a i32>` + `i32` implements `Sum<&i32>` `i32` implements `Sum` note: the method call chain might not have had the expected associated types --> $DIR/sum.rs:4:18 @@ -30,7 +30,7 @@ LL | vec![(), ()].iter().product::(); | = help: the trait `Product<&()>` is not implemented for `i32` = help: the following other types implement trait `Product`: - `i32` implements `Product<&'a i32>` + `i32` implements `Product<&i32>` `i32` implements `Product` note: the method call chain might not have had the expected associated types --> $DIR/sum.rs:7:18 diff --git a/tests/ui/span/multiline-span-simple.stderr b/tests/ui/span/multiline-span-simple.stderr index 2454769863b9c..d815f141fa090 100644 --- a/tests/ui/span/multiline-span-simple.stderr +++ b/tests/ui/span/multiline-span-simple.stderr @@ -6,8 +6,8 @@ LL | foo(1 as u32 + | = help: the trait `Add<()>` is not implemented for `u32` = help: the following other types implement trait `Add`: - `&'a u32` implements `Add` - `&u32` implements `Add<&u32>` + `&u32` implements `Add` + `&u32` implements `Add` `u32` implements `Add<&u32>` `u32` implements `Add` diff --git a/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr b/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr index 2733bbff36b54..530d868163b8d 100644 --- a/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr +++ b/tests/ui/suggestions/imm-ref-trait-object-literal-bound-regions.stderr @@ -6,7 +6,7 @@ LL | foo::(s); | | | required by a bound introduced by this call | - = help: the trait `Trait` is implemented for `&'a mut S` + = help: the trait `Trait` is implemented for `&mut S` = note: `for<'b> Trait` is implemented for `&'b mut S`, but not for `&'b S` note: required by a bound in `foo` --> $DIR/imm-ref-trait-object-literal-bound-regions.rs:11:20 diff --git a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr index e01102e3864ea..79fa468dc4947 100644 --- a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr +++ b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr @@ -6,7 +6,7 @@ LL | foo(&s); | | | required by a bound introduced by this call | - = help: the trait `Trait` is implemented for `&'a mut S` + = help: the trait `Trait` is implemented for `&mut S` note: required by a bound in `foo` --> $DIR/imm-ref-trait-object-literal.rs:7:11 | diff --git a/tests/ui/suggestions/into-str.stderr b/tests/ui/suggestions/into-str.stderr index 6c1e1ec428fe7..ac6e531fee2b7 100644 --- a/tests/ui/suggestions/into-str.stderr +++ b/tests/ui/suggestions/into-str.stderr @@ -12,7 +12,7 @@ LL | foo(String::new()); `String` implements `From<&mut str>` `String` implements `From<&str>` `String` implements `From>` - `String` implements `From>` + `String` implements `From>` `String` implements `From` = note: required for `String` to implement `Into<&str>` note: required by a bound in `foo` diff --git a/tests/ui/traits/question-mark-result-err-mismatch.stderr b/tests/ui/traits/question-mark-result-err-mismatch.stderr index 66276bcbe3bb0..0e0ae6d59901f 100644 --- a/tests/ui/traits/question-mark-result-err-mismatch.stderr +++ b/tests/ui/traits/question-mark-result-err-mismatch.stderr @@ -35,7 +35,7 @@ LL | .map_err(|_| ())?; `String` implements `From<&mut str>` `String` implements `From<&str>` `String` implements `From>` - `String` implements `From>` + `String` implements `From>` `String` implements `From` = note: required for `Result<(), String>` to implement `FromResidual>` diff --git a/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr b/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr index a3ed51ace0880..85d6cdf779b44 100644 --- a/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr +++ b/tests/ui/traits/suggest-dereferences/invalid-suggest-deref-issue-127590.stderr @@ -23,7 +23,7 @@ LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&std::slice::Iter<'_, {integer}>` is not an iterator | = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>`, which is required by `Zip, &std::slice::Iter<'_, {integer}>>: IntoIterator` - = help: the trait `Iterator` is implemented for `std::slice::Iter<'a, T>` + = help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` = note: required for `Zip, &std::slice::Iter<'_, {integer}>>` to implement `Iterator` = note: required for `Zip, &std::slice::Iter<'_, {integer}>>` to implement `IntoIterator` @@ -52,7 +52,7 @@ LL | for (src, dest) in std::iter::zip(fields.iter(), &variant.iter().clone( | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&std::slice::Iter<'_, {integer}>` is not an iterator | = help: the trait `Iterator` is not implemented for `&std::slice::Iter<'_, {integer}>`, which is required by `Zip, &std::slice::Iter<'_, {integer}>>: IntoIterator` - = help: the trait `Iterator` is implemented for `std::slice::Iter<'a, T>` + = help: the trait `Iterator` is implemented for `std::slice::Iter<'_, T>` = note: required for `Zip, &std::slice::Iter<'_, {integer}>>` to implement `Iterator` = note: required for `Zip, &std::slice::Iter<'_, {integer}>>` to implement `IntoIterator` diff --git a/tests/ui/type/type-check-defaults.stderr b/tests/ui/type/type-check-defaults.stderr index 499e8142cc8f4..9c48250612971 100644 --- a/tests/ui/type/type-check-defaults.stderr +++ b/tests/ui/type/type-check-defaults.stderr @@ -66,8 +66,8 @@ LL | trait ProjectionPred> where T::Item : Add {} | = help: the trait `Add` is not implemented for `i32` = help: the following other types implement trait `Add`: - `&'a i32` implements `Add` - `&i32` implements `Add<&i32>` + `&i32` implements `Add` + `&i32` implements `Add` `i32` implements `Add<&i32>` `i32` implements `Add` diff --git a/tests/ui/typeck/issue-81293.stderr b/tests/ui/typeck/issue-81293.stderr index 3c48db335b5f0..82661fc717233 100644 --- a/tests/ui/typeck/issue-81293.stderr +++ b/tests/ui/typeck/issue-81293.stderr @@ -21,8 +21,8 @@ LL | a = c + b * 5; | = help: the trait `Add` is not implemented for `usize` = help: the following other types implement trait `Add`: - `&'a usize` implements `Add` - `&usize` implements `Add<&usize>` + `&usize` implements `Add` + `&usize` implements `Add` `usize` implements `Add<&usize>` `usize` implements `Add` diff --git a/tests/ui/typeck/issue-90101.stderr b/tests/ui/typeck/issue-90101.stderr index d6832d1b34ffc..796e904a43829 100644 --- a/tests/ui/typeck/issue-90101.stderr +++ b/tests/ui/typeck/issue-90101.stderr @@ -9,7 +9,7 @@ LL | func(Path::new("hello").to_path_buf().to_string_lossy(), "world") = help: the following other types implement trait `From`: `PathBuf` implements `From<&T>` `PathBuf` implements `From>` - `PathBuf` implements `From>` + `PathBuf` implements `From>` `PathBuf` implements `From` `PathBuf` implements `From` = note: required for `Cow<'_, str>` to implement `Into` diff --git a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr index a0430240dc43b..f8be11a24e3da 100644 --- a/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/tests/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -6,8 +6,8 @@ LL | >::add(1, 2); | = help: the trait `Add` is not implemented for `i32` = help: the following other types implement trait `Add`: - `&'a i32` implements `Add` - `&i32` implements `Add<&i32>` + `&i32` implements `Add` + `&i32` implements `Add` `i32` implements `Add<&i32>` `i32` implements `Add` @@ -63,8 +63,8 @@ LL | >::add(1, 2); | = help: the trait `Add` is not implemented for `i32` = help: the following other types implement trait `Add`: - `&'a i32` implements `Add` - `&i32` implements `Add<&i32>` + `&i32` implements `Add` + `&i32` implements `Add` `i32` implements `Add<&i32>` `i32` implements `Add` From 01d19d7be9b1fdcaa93eef4317c46f7330093061 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 22 Sep 2024 13:52:58 -0400 Subject: [PATCH 8/9] Don't call try_eval_target_usize in error reporting --- .../src/error_reporting/traits/suggestions.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs index e2796c764129e..89b37fd641515 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs @@ -4621,7 +4621,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { format!("&{}{ty}", mutability.prefix_str()) } } - ty::Array(ty, len) if let Some(len) = len.try_eval_target_usize(tcx, param_env) => { + ty::Array(ty, len) if let Some(len) = len.try_to_target_usize(tcx) => { if len == 0 { "[]".to_string() } else if self.type_is_copy_modulo_regions(param_env, ty) || len == 1 { From 2273aeed9decabdbbb0713a8b0749de0e9cd4ea7 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 22 Sep 2024 14:11:44 -0400 Subject: [PATCH 9/9] Replace calls to Const::eval in mir build --- compiler/rustc_mir_build/src/build/expr/as_rvalue.rs | 2 +- .../rustc_mir_build/src/build/matches/match_pair.rs | 7 ++++++- compiler/rustc_mir_build/src/thir/pattern/mod.rs | 4 +++- compiler/rustc_pattern_analysis/src/rustc.rs | 11 +++++++---- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs index 0c9571da3cf7f..5cf5d7d275403 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs @@ -57,7 +57,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { this.in_scope(region_scope, lint_level, |this| this.as_rvalue(block, scope, value)) } ExprKind::Repeat { value, count } => { - if Some(0) == count.try_eval_target_usize(this.tcx, this.param_env) { + if Some(0) == count.try_to_target_usize(this.tcx) { this.build_zero_repeat(block, value, scope, source_info) } else { let value_operand = unpack!( diff --git a/compiler/rustc_mir_build/src/build/matches/match_pair.rs b/compiler/rustc_mir_build/src/build/matches/match_pair.rs index ab2bfcbca3aa6..54937af0ff291 100644 --- a/compiler/rustc_mir_build/src/build/matches/match_pair.rs +++ b/compiler/rustc_mir_build/src/build/matches/match_pair.rs @@ -42,7 +42,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { let tcx = self.tcx; let (min_length, exact_size) = if let Some(place_resolved) = place.try_to_place(self) { match place_resolved.ty(&self.local_decls, tcx).ty.kind() { - ty::Array(_, length) => (length.eval_target_usize(tcx, self.param_env), true), + ty::Array(_, length) => ( + length + .try_to_target_usize(tcx) + .expect("expected len of array pat to be definite"), + true, + ), _ => ((prefix.len() + suffix.len()).try_into().unwrap(), false), } } else { diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs index d78e1f5da09f0..04e921ecc2e05 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs @@ -441,7 +441,9 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { ty::Slice(..) => PatKind::Slice { prefix, slice, suffix }, // Fixed-length array, `[T; len]`. ty::Array(_, len) => { - let len = len.eval_target_usize(self.tcx, self.param_env); + let len = len + .try_to_target_usize(self.tcx) + .expect("expected len of array pat to be definite"); assert!(len >= prefix.len() as u64 + suffix.len() as u64); PatKind::Array { prefix, slice, suffix } } diff --git a/compiler/rustc_pattern_analysis/src/rustc.rs b/compiler/rustc_pattern_analysis/src/rustc.rs index 6c09f97bfe731..78195a3177d43 100644 --- a/compiler/rustc_pattern_analysis/src/rustc.rs +++ b/compiler/rustc_pattern_analysis/src/rustc.rs @@ -352,7 +352,7 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> { ty::Array(sub_ty, len) => { // We treat arrays of a constant but unknown length like slices. ConstructorSet::Slice { - array_len: len.try_eval_target_usize(cx.tcx, cx.param_env).map(|l| l as usize), + array_len: len.try_to_target_usize(cx.tcx).map(|l| l as usize), subtype_is_empty: cx.is_uninhabited(*sub_ty), } } @@ -685,9 +685,12 @@ impl<'p, 'tcx: 'p> RustcPatCtxt<'p, 'tcx> { } PatKind::Array { prefix, slice, suffix } | PatKind::Slice { prefix, slice, suffix } => { let array_len = match ty.kind() { - ty::Array(_, length) => { - Some(length.eval_target_usize(cx.tcx, cx.param_env) as usize) - } + ty::Array(_, length) => Some( + length + .try_to_target_usize(cx.tcx) + .expect("expected len of array pat to be definite") + as usize, + ), ty::Slice(_) => None, _ => span_bug!(pat.span, "bad ty {} for slice pattern", ty.inner()), };