From 9381d9c13ecb586de9eacb53087fc7446c4c150d Mon Sep 17 00:00:00 2001 From: Dylan DPC Date: Tue, 5 Apr 2022 23:23:12 +0200 Subject: [PATCH 1/7] Revert "Remove hack, fix fmt and tests" This reverts commit e1ef833bca8fe21cb2cbc42795cda4b589ec6f25. --- .../src/traits/error_reporting/mod.rs | 9 ++-- .../defaults/rp_impl_trait_fail.stderr | 6 +-- .../kindck/kindck-impl-type-params.nll.stderr | 2 - .../suggest-deferences/root-obligation.fixed | 1 + .../suggest-deferences/root-obligation.rs | 1 + .../nested-tait-inference2.stderr | 2 +- .../self-referential-2.stderr | 14 +++---- .../self-referential-4.stderr | 42 +++++++------------ .../self-referential.stderr | 42 +++++++------------ 9 files changed, 47 insertions(+), 72 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 27748eef8f20b..2a390afa21d74 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1762,7 +1762,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { trait_ref: ty::PolyTraitRef<'tcx>, err: &mut Diagnostic, ) -> bool { - let report = |mut candidates: Vec>, err: &mut Diagnostic| { + let report = |mut candidates: Vec>, err: &mut Diagnostic| { candidates.sort(); candidates.dedup(); let len = candidates.len(); @@ -1784,8 +1784,11 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { } let trait_ref = TraitRef::identity(self.tcx, candidates[0].def_id); // Check if the trait is the same in all cases. If so, we'll only show the type. - let mut traits: Vec<_> = - candidates.iter().map(|c| c.print_only_trait_path().to_string()).collect(); + // FIXME: there *has* to be a better way! + let mut traits: Vec<_> = candidates + .iter() + .map(|c| format!("{}", c).split(" as ").last().unwrap().to_string()) + .collect(); traits.sort(); traits.dedup(); diff --git a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr index 48c61c22e7a32..1fb6b38e4a68f 100644 --- a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr +++ b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr @@ -40,7 +40,7 @@ LL | | 1_u32 LL | | } | |_^ the trait `Traitor` is not implemented for `u32` | - = help: the following other types implement trait `Traitor`: + = help: the following implementations were found: > > @@ -65,9 +65,9 @@ LL | | 1_u64 LL | | } | |_^ the trait `Traitor<1_u8, 1_u8>` is not implemented for `u64` | - = help: the following other types implement trait `Traitor`: - > + = help: the following implementations were found: > + > error: aborting due to 6 previous errors diff --git a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr index 94f802620a302..7129bad8a978a 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr @@ -72,7 +72,6 @@ error[E0277]: the trait bound `String: Copy` is not satisfied LL | let a = t as Box>; | ^ the trait `Copy` is not implemented for `String` | - = help: the trait `Gettable` is implemented for `S` note: required because of the requirements on the impl of `Gettable` for `S` --> $DIR/kindck-impl-type-params.rs:14:32 | @@ -86,7 +85,6 @@ error[E0277]: the trait bound `Foo: Copy` is not satisfied LL | let a: Box> = t; | ^ the trait `Copy` is not implemented for `Foo` | - = help: the trait `Gettable` is implemented for `S` note: required because of the requirements on the impl of `Gettable` for `S` --> $DIR/kindck-impl-type-params.rs:14:32 | diff --git a/src/test/ui/traits/suggest-deferences/root-obligation.fixed b/src/test/ui/traits/suggest-deferences/root-obligation.fixed index 7a8433f90572e..9fd1924067827 100644 --- a/src/test/ui/traits/suggest-deferences/root-obligation.fixed +++ b/src/test/ui/traits/suggest-deferences/root-obligation.fixed @@ -11,3 +11,4 @@ fn get_vowel_count(string: &str) -> usize { fn main() { let _ = get_vowel_count("asdf"); } + diff --git a/src/test/ui/traits/suggest-deferences/root-obligation.rs b/src/test/ui/traits/suggest-deferences/root-obligation.rs index 51bac2107e3b4..4dd0291b62970 100644 --- a/src/test/ui/traits/suggest-deferences/root-obligation.rs +++ b/src/test/ui/traits/suggest-deferences/root-obligation.rs @@ -11,3 +11,4 @@ fn get_vowel_count(string: &str) -> usize { fn main() { let _ = get_vowel_count("asdf"); } + diff --git a/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr index 264e8024fac3a..9a3fd2f4005f3 100644 --- a/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr +++ b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr @@ -19,7 +19,7 @@ LL | | () LL | | } | |_^ the trait `Foo` is not implemented for `()` | - = help: the following other types implement trait `Foo`: + = help: the following implementations were found: <() as Foo<()>> <() as Foo> diff --git a/src/test/ui/type-alias-impl-trait/self-referential-2.stderr b/src/test/ui/type-alias-impl-trait/self-referential-2.stderr index 348696f25e3b5..b93ded6a7d3e1 100644 --- a/src/test/ui/type-alias-impl-trait/self-referential-2.stderr +++ b/src/test/ui/type-alias-impl-trait/self-referential-2.stderr @@ -5,15 +5,11 @@ LL | 42_i32 | ^^^^^^ no implementation for `i32 == Foo` | = help: the trait `PartialEq` is not implemented for `i32` - = help: the following other types implement trait `PartialEq`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize + = help: the following implementations were found: + + + + and 6 others error: aborting due to previous error diff --git a/src/test/ui/type-alias-impl-trait/self-referential-4.stderr b/src/test/ui/type-alias-impl-trait/self-referential-4.stderr index 838264794194c..23ca689019634 100644 --- a/src/test/ui/type-alias-impl-trait/self-referential-4.stderr +++ b/src/test/ui/type-alias-impl-trait/self-referential-4.stderr @@ -5,15 +5,11 @@ LL | i | ^ no implementation for `&i32 == Bar<'b, 'static>` | = help: the trait `PartialEq>` is not implemented for `&i32` - = help: the following other types implement trait `PartialEq`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize + = help: the following implementations were found: + + + + and 6 others error[E0277]: can't compare `&i32` with `Foo<'static, 'b>` @@ -23,15 +19,11 @@ LL | i | ^ no implementation for `&i32 == Foo<'static, 'b>` | = help: the trait `PartialEq>` is not implemented for `&i32` - = help: the following other types implement trait `PartialEq`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize + = help: the following implementations were found: + + + + and 6 others error[E0277]: can't compare `&i32` with `Moo<'static, 'a>` @@ -41,15 +33,11 @@ LL | i | ^ no implementation for `&i32 == Moo<'static, 'a>` | = help: the trait `PartialEq>` is not implemented for `&i32` - = help: the following other types implement trait `PartialEq`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize + = help: the following implementations were found: + + + + and 6 others error: aborting due to 3 previous errors diff --git a/src/test/ui/type-alias-impl-trait/self-referential.stderr b/src/test/ui/type-alias-impl-trait/self-referential.stderr index 2ebb15b880308..4384bc9b98a7c 100644 --- a/src/test/ui/type-alias-impl-trait/self-referential.stderr +++ b/src/test/ui/type-alias-impl-trait/self-referential.stderr @@ -5,15 +5,11 @@ LL | i | ^ no implementation for `&i32 == Bar<'b, 'a>` | = help: the trait `PartialEq>` is not implemented for `&i32` - = help: the following other types implement trait `PartialEq`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize + = help: the following implementations were found: + + + + and 6 others error[E0277]: can't compare `&i32` with `(i32, &i32)` @@ -23,15 +19,11 @@ LL | (42, i) | ^ no implementation for `&i32 == (i32, &i32)` | = help: the trait `PartialEq<(i32, &i32)>` is not implemented for `&i32` - = help: the following other types implement trait `PartialEq`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize + = help: the following implementations were found: + + + + and 6 others error[E0277]: can't compare `&i32` with `(i32, Moo<'b, 'a>::{opaque#0})` @@ -41,15 +33,11 @@ LL | (42, i) | ^ no implementation for `&i32 == (i32, Moo<'b, 'a>::{opaque#0})` | = help: the trait `PartialEq<(i32, Moo<'b, 'a>::{opaque#0})>` is not implemented for `&i32` - = help: the following other types implement trait `PartialEq`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize + = help: the following implementations were found: + + + + and 6 others error: aborting due to 3 previous errors From 8562752ecc1ee68e0025eb27af14d2e63b35696c Mon Sep 17 00:00:00 2001 From: Dylan DPC Date: Tue, 5 Apr 2022 23:23:26 +0200 Subject: [PATCH 2/7] Revert "Highlight `is` in the message for emphasis" This reverts commit a6301cab5e3512bf28c69e60e28e8253911702c9. --- .../src/traits/error_reporting/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 2a390afa21d74..7dc5d6eb6e5f6 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1772,11 +1772,12 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { if candidates.len() == 1 { err.highlighted_help(vec![ ( - format!("the trait `{}` ", candidates[0].print_only_trait_path()), + format!( + "the trait `{}` is implemented for `", + candidates[0].print_only_trait_path() + ), Style::NoStyle, ), - ("is".to_string(), Style::Highlight), - (" implemented for `".to_string(), Style::NoStyle), (candidates[0].self_ty().to_string(), Style::Highlight), ("`".to_string(), Style::NoStyle), ]); From 1fdedfcb4d3cda121baa88092d2dc9ca9fab52cf Mon Sep 17 00:00:00 2001 From: Dylan DPC Date: Tue, 5 Apr 2022 23:23:30 +0200 Subject: [PATCH 3/7] Revert "Refer to the TraitRef::identity in the message to be clearer" This reverts commit 3109c931b495f72fb9758bef15d38aeedc354ca1. --- .../src/traits/error_reporting/mod.rs | 4 ++-- src/test/ui/binop/binop-mul-i32-f32.stderr | 2 +- .../ui/binop/shift-various-bad-types.stderr | 6 ++--- .../defaults/rp_impl_trait_fail.stderr | 4 ++-- .../ui/const-generics/exhaustive-value.stderr | 2 +- .../const-eval/const-eval-overflow-3b.stderr | 2 +- .../const-eval/const-eval-overflow-4b.stderr | 2 +- .../ui/consts/too_generic_eval_ice.stderr | 2 +- ...e-21659-show-relevant-trait-impls-1.stderr | 2 +- ...e-21659-show-relevant-trait-impls-2.stderr | 2 +- .../issue-39802-show-5-trait-impls.stderr | 6 ++--- ...de-confusable-in-float-literal-expt.stderr | 2 +- src/test/ui/impl-trait/equality.stderr | 2 +- src/test/ui/issues/issue-11771.stderr | 4 ++-- src/test/ui/issues/issue-24352.stderr | 2 +- src/test/ui/issues/issue-50582.stderr | 2 +- .../ui/lexer/lex-bad-char-literals-6.stderr | 4 ++-- src/test/ui/mismatched_types/binops.stderr | 12 +++++----- src/test/ui/never_type/issue-13352.stderr | 2 +- .../not-suggest-float-literal.stderr | 24 +++++++++---------- .../suggest-float-literal.stderr | 16 ++++++------- .../ui/on-unimplemented/multiple-impls.stderr | 12 +++++----- .../ui/on-unimplemented/slice-index.stderr | 2 +- src/test/ui/span/multiline-span-simple.stderr | 2 +- src/test/ui/suggestions/into-str.stderr | 2 +- .../issue-71394-no-from-impl.stderr | 2 +- .../repeated-supertrait-ambig.stderr | 6 ++--- .../ui/try-trait/bad-interconversion.stderr | 2 +- .../nested-tait-inference2.stderr | 2 +- src/test/ui/type/type-check-defaults.stderr | 2 +- src/test/ui/typeck/issue-81293.stderr | 2 +- src/test/ui/typeck/issue-90101.stderr | 2 +- .../ui/ufcs/ufcs-qpath-self-mismatch.stderr | 2 +- 33 files changed, 71 insertions(+), 71 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 7dc5d6eb6e5f6..7f76f636efa19 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1769,12 +1769,13 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { if candidates.len() == 0 { return false; } + let trait_ref = candidates[0]; if candidates.len() == 1 { err.highlighted_help(vec![ ( format!( "the trait `{}` is implemented for `", - candidates[0].print_only_trait_path() + trait_ref.print_only_trait_path() ), Style::NoStyle, ), @@ -1783,7 +1784,6 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { ]); return true; } - let trait_ref = TraitRef::identity(self.tcx, candidates[0].def_id); // Check if the trait is the same in all cases. If so, we'll only show the type. // FIXME: there *has* to be a better way! let mut traits: Vec<_> = candidates diff --git a/src/test/ui/binop/binop-mul-i32-f32.stderr b/src/test/ui/binop/binop-mul-i32-f32.stderr index 21c490965b147..453333fb56a87 100644 --- a/src/test/ui/binop/binop-mul-i32-f32.stderr +++ b/src/test/ui/binop/binop-mul-i32-f32.stderr @@ -5,7 +5,7 @@ LL | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul` is not implemented for `i32` - = help: the following other types implement trait `Mul`: + = help: the following other types implement trait `Mul`: <&'a f32 as Mul> <&'a f64 as Mul> <&'a i128 as Mul> diff --git a/src/test/ui/binop/shift-various-bad-types.stderr b/src/test/ui/binop/shift-various-bad-types.stderr index 38db66f86b461..bb0bb63b22df5 100644 --- a/src/test/ui/binop/shift-various-bad-types.stderr +++ b/src/test/ui/binop/shift-various-bad-types.stderr @@ -5,7 +5,7 @@ LL | 22 >> p.char; | ^^ no implementation for `{integer} >> char` | = help: the trait `Shr` is not implemented for `{integer}` - = help: the following other types implement trait `Shr`: + = help: the following other types implement trait `Shr`: <&'a i128 as Shr> <&'a i128 as Shr> <&'a i128 as Shr> @@ -23,7 +23,7 @@ LL | 22 >> p.str; | ^^ no implementation for `{integer} >> &str` | = help: the trait `Shr<&str>` is not implemented for `{integer}` - = help: the following other types implement trait `Shr`: + = help: the following other types implement trait `Shr`: <&'a i128 as Shr> <&'a i128 as Shr> <&'a i128 as Shr> @@ -41,7 +41,7 @@ LL | 22 >> p; | ^^ no implementation for `{integer} >> &Panolpy` | = help: the trait `Shr<&Panolpy>` is not implemented for `{integer}` - = help: the following other types implement trait `Shr`: + = help: the following other types implement trait `Shr`: <&'a i128 as Shr> <&'a i128 as Shr> <&'a i128 as Shr> diff --git a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr index 1fb6b38e4a68f..4c9ab6901b1f5 100644 --- a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr +++ b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr @@ -25,7 +25,7 @@ error[E0277]: the trait bound `u32: Traitor` is not satisfied LL | fn uwu() -> impl Traitor { | ^^^^^^^^^^^^^^^ the trait `Traitor` is not implemented for `u32` | - = help: the following other types implement trait `Traitor`: + = help: the following other types implement trait `Traitor`: > > @@ -50,7 +50,7 @@ error[E0277]: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied LL | fn owo() -> impl Traitor { | ^^^^^^^^^^^^ the trait `Traitor<1_u8, 1_u8>` is not implemented for `u64` | - = help: the following other types implement trait `Traitor`: + = help: the following other types implement trait `Traitor`: > > diff --git a/src/test/ui/const-generics/exhaustive-value.stderr b/src/test/ui/const-generics/exhaustive-value.stderr index 9c1b086f4da9a..5613ed27cb234 100644 --- a/src/test/ui/const-generics/exhaustive-value.stderr +++ b/src/test/ui/const-generics/exhaustive-value.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `(): Foo` is not satisfied LL | <() as Foo>::test() | ^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()` | - = help: the following other types implement trait `Foo`: + = help: the following other types implement trait `Foo<0_u8>`: <() as Foo<0_u8>> <() as Foo<100_u8>> <() as Foo<101_u8>> diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr index 0e6be6d01ed69..5fde557a32ad7 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr @@ -11,7 +11,7 @@ LL | = [0; (i8::MAX + 1u8) as usize]; | ^ no implementation for `i8 + u8` | = help: the trait `Add` is not implemented for `i8` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr index 4fa017e04e97b..3c192eef14f11 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr @@ -11,7 +11,7 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize] | ^ no implementation for `i8 + u8` | = help: the trait `Add` is not implemented for `i8` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> diff --git a/src/test/ui/consts/too_generic_eval_ice.stderr b/src/test/ui/consts/too_generic_eval_ice.stderr index 8de61fcfb7330..5544350c34cba 100644 --- a/src/test/ui/consts/too_generic_eval_ice.stderr +++ b/src/test/ui/consts/too_generic_eval_ice.stderr @@ -21,7 +21,7 @@ LL | [5; Self::HOST_SIZE] == [6; 0] | ^^ no implementation for `[{integer}; _] == [{integer}; 0]` | = help: the trait `PartialEq<[{integer}; 0]>` is not implemented for `[{integer}; _]` - = help: the following other types implement trait `PartialEq`: + = help: the following other types implement trait `PartialEq<[B; N]>`: <&[B] as PartialEq<[A; N]>> <&[T] as PartialEq>> <&mut [B] as PartialEq<[A; N]>> diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr index 26764bc0ee5cc..1c83f75ffb937 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `Bar: Foo` is not satisfied LL | f1.foo(1usize); | ^^^ the trait `Foo` is not implemented for `Bar` | - = help: the following other types implement trait `Foo`: + = help: the following other types implement trait `Foo`: > > diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr index bb175367e1f9e..85f3eba927d06 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `Bar: Foo` is not satisfied LL | f1.foo(1usize); | ^^^ the trait `Foo` is not implemented for `Bar` | - = help: the following other types implement trait `Foo`: + = help: the following other types implement trait `Foo`: > > > diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr index d27b05fe7f7df..e1d80313bc46b 100644 --- a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr +++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr @@ -6,7 +6,7 @@ LL | Foo::::bar(&1i8); | | | required by a bound introduced by this call | - = help: the following other types implement trait `Foo`: + = help: the following other types implement trait `Foo`: > > > @@ -25,7 +25,7 @@ LL | Foo::::bar(&1u8); | | | required by a bound introduced by this call | - = help: the following other types implement trait `Foo`: + = help: the following other types implement trait `Foo`: > > > @@ -44,7 +44,7 @@ LL | Foo::::bar(&true); | | | required by a bound introduced by this call | - = help: the following other types implement trait `Foo`: + = help: the following other types implement trait `Foo`: > > > diff --git a/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr b/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr index 26986684f0c0a..15af2c26e8fca 100644 --- a/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr +++ b/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr @@ -22,7 +22,7 @@ LL | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e−11; // m³⋅kg⁻¹ | ^ no implementation for `{float} - {integer}` | = help: the trait `Sub<{integer}>` is not implemented for `{float}` - = help: the following other types implement trait `Sub`: + = help: the following other types implement trait `Sub`: <&'a f32 as Sub> <&'a f64 as Sub> <&'a i128 as Sub> diff --git a/src/test/ui/impl-trait/equality.stderr b/src/test/ui/impl-trait/equality.stderr index f14b447b07730..48cfcb4ad3e0a 100644 --- a/src/test/ui/impl-trait/equality.stderr +++ b/src/test/ui/impl-trait/equality.stderr @@ -24,7 +24,7 @@ LL | n + sum_to(n - 1) | ^ no implementation for `u32 + impl Foo` | = help: the trait `Add` is not implemented for `u32` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> diff --git a/src/test/ui/issues/issue-11771.stderr b/src/test/ui/issues/issue-11771.stderr index 161fce4b0315c..ef15aa5840482 100644 --- a/src/test/ui/issues/issue-11771.stderr +++ b/src/test/ui/issues/issue-11771.stderr @@ -5,7 +5,7 @@ LL | 1 + | ^ no implementation for `{integer} + ()` | = help: the trait `Add<()>` is not implemented for `{integer}` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> @@ -23,7 +23,7 @@ LL | 1 + | ^ no implementation for `{integer} + ()` | = help: the trait `Add<()>` is not implemented for `{integer}` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> diff --git a/src/test/ui/issues/issue-24352.stderr b/src/test/ui/issues/issue-24352.stderr index 118f37f6971ef..1fa2d356c68ef 100644 --- a/src/test/ui/issues/issue-24352.stderr +++ b/src/test/ui/issues/issue-24352.stderr @@ -5,7 +5,7 @@ LL | 1.0f64 - 1 | ^ no implementation for `f64 - {integer}` | = help: the trait `Sub<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Sub`: + = help: the following other types implement trait `Sub`: <&'a f32 as Sub> <&'a f64 as Sub> <&'a i128 as Sub> diff --git a/src/test/ui/issues/issue-50582.stderr b/src/test/ui/issues/issue-50582.stderr index 3d527eb6b4e4a..d4e29030c1648 100644 --- a/src/test/ui/issues/issue-50582.stderr +++ b/src/test/ui/issues/issue-50582.stderr @@ -14,7 +14,7 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new(); | ^ no implementation for `{integer} + ()` | = help: the trait `Add<()>` is not implemented for `{integer}` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> diff --git a/src/test/ui/lexer/lex-bad-char-literals-6.stderr b/src/test/ui/lexer/lex-bad-char-literals-6.stderr index afef0cb603485..199958bc7e416 100644 --- a/src/test/ui/lexer/lex-bad-char-literals-6.stderr +++ b/src/test/ui/lexer/lex-bad-char-literals-6.stderr @@ -38,7 +38,7 @@ LL | if x == y {} | ^^ no implementation for `&str == char` | = help: the trait `PartialEq` is not implemented for `&str` - = help: the following other types implement trait `PartialEq`: + = help: the following other types implement trait `PartialEq>`: <&'a str as PartialEq> <&'a str as PartialEq> <&'b str as PartialEq>> @@ -64,7 +64,7 @@ LL | if x == z {} | ^^ no implementation for `&str == char` | = help: the trait `PartialEq` is not implemented for `&str` - = help: the following other types implement trait `PartialEq`: + = help: the following other types implement trait `PartialEq>`: <&'a str as PartialEq> <&'a str as PartialEq> <&'b str as PartialEq>> diff --git a/src/test/ui/mismatched_types/binops.stderr b/src/test/ui/mismatched_types/binops.stderr index 3de652d87ec54..16d1222899340 100644 --- a/src/test/ui/mismatched_types/binops.stderr +++ b/src/test/ui/mismatched_types/binops.stderr @@ -5,7 +5,7 @@ LL | 1 + Some(1); | ^ no implementation for `{integer} + Option<{integer}>` | = help: the trait `Add>` is not implemented for `{integer}` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> @@ -23,7 +23,7 @@ LL | 2 as usize - Some(1); | ^ no implementation for `usize - Option<{integer}>` | = help: the trait `Sub>` is not implemented for `usize` - = help: the following other types implement trait `Sub`: + = help: the following other types implement trait `Sub`: <&'a f32 as Sub> <&'a f64 as Sub> <&'a i128 as Sub> @@ -41,7 +41,7 @@ LL | 3 * (); | ^ no implementation for `{integer} * ()` | = help: the trait `Mul<()>` is not implemented for `{integer}` - = help: the following other types implement trait `Mul`: + = help: the following other types implement trait `Mul`: <&'a f32 as Mul> <&'a f64 as Mul> <&'a i128 as Mul> @@ -59,7 +59,7 @@ LL | 4 / ""; | ^ no implementation for `{integer} / &str` | = help: the trait `Div<&str>` is not implemented for `{integer}` - = help: the following other types implement trait `Div`: + = help: the following other types implement trait `Div`: <&'a f32 as Div> <&'a f64 as Div> <&'a i128 as Div> @@ -77,7 +77,7 @@ LL | 5 < String::new(); | ^ no implementation for `{integer} < String` and `{integer} > String` | = help: the trait `PartialOrd` is not implemented for `{integer}` - = help: the following other types implement trait `PartialOrd`: + = help: the following other types implement trait `PartialOrd`: f32 f64 i128 @@ -95,7 +95,7 @@ LL | 6 == Ok(1); | ^^ no implementation for `{integer} == Result<{integer}, _>` | = help: the trait `PartialEq>` is not implemented for `{integer}` - = help: the following other types implement trait `PartialEq`: + = help: the following other types implement trait `PartialEq`: f32 f64 i128 diff --git a/src/test/ui/never_type/issue-13352.stderr b/src/test/ui/never_type/issue-13352.stderr index fed780e68957f..449b0756012de 100644 --- a/src/test/ui/never_type/issue-13352.stderr +++ b/src/test/ui/never_type/issue-13352.stderr @@ -5,7 +5,7 @@ LL | 2_usize + (loop {}); | ^ no implementation for `usize + ()` | = help: the trait `Add<()>` is not implemented for `usize` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> diff --git a/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr b/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr index 6aa1ad8dd899f..72cc4f6ec6469 100644 --- a/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr +++ b/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr @@ -5,7 +5,7 @@ LL | x + 100.0 | ^ no implementation for `u8 + {float}` | = help: the trait `Add<{float}>` is not implemented for `u8` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> @@ -23,7 +23,7 @@ LL | x + "foo" | ^ no implementation for `f64 + &str` | = help: the trait `Add<&str>` is not implemented for `f64` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> @@ -41,7 +41,7 @@ LL | x + y | ^ no implementation for `f64 + {integer}` | = help: the trait `Add<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> @@ -59,7 +59,7 @@ LL | x - 100.0 | ^ no implementation for `u8 - {float}` | = help: the trait `Sub<{float}>` is not implemented for `u8` - = help: the following other types implement trait `Sub`: + = help: the following other types implement trait `Sub`: <&'a f32 as Sub> <&'a f64 as Sub> <&'a i128 as Sub> @@ -77,7 +77,7 @@ LL | x - "foo" | ^ no implementation for `f64 - &str` | = help: the trait `Sub<&str>` is not implemented for `f64` - = help: the following other types implement trait `Sub`: + = help: the following other types implement trait `Sub`: <&'a f32 as Sub> <&'a f64 as Sub> <&'a i128 as Sub> @@ -95,7 +95,7 @@ LL | x - y | ^ no implementation for `f64 - {integer}` | = help: the trait `Sub<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Sub`: + = help: the following other types implement trait `Sub`: <&'a f32 as Sub> <&'a f64 as Sub> <&'a i128 as Sub> @@ -113,7 +113,7 @@ LL | x * 100.0 | ^ no implementation for `u8 * {float}` | = help: the trait `Mul<{float}>` is not implemented for `u8` - = help: the following other types implement trait `Mul`: + = help: the following other types implement trait `Mul`: <&'a f32 as Mul> <&'a f64 as Mul> <&'a i128 as Mul> @@ -131,7 +131,7 @@ LL | x * "foo" | ^ no implementation for `f64 * &str` | = help: the trait `Mul<&str>` is not implemented for `f64` - = help: the following other types implement trait `Mul`: + = help: the following other types implement trait `Mul`: <&'a f32 as Mul> <&'a f64 as Mul> <&'a i128 as Mul> @@ -149,7 +149,7 @@ LL | x * y | ^ no implementation for `f64 * {integer}` | = help: the trait `Mul<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Mul`: + = help: the following other types implement trait `Mul`: <&'a f32 as Mul> <&'a f64 as Mul> <&'a i128 as Mul> @@ -167,7 +167,7 @@ LL | x / 100.0 | ^ no implementation for `u8 / {float}` | = help: the trait `Div<{float}>` is not implemented for `u8` - = help: the following other types implement trait `Div`: + = help: the following other types implement trait `Div`: <&'a f32 as Div> <&'a f64 as Div> <&'a i128 as Div> @@ -185,7 +185,7 @@ LL | x / "foo" | ^ no implementation for `f64 / &str` | = help: the trait `Div<&str>` is not implemented for `f64` - = help: the following other types implement trait `Div`: + = help: the following other types implement trait `Div`: <&'a f32 as Div> <&'a f64 as Div> <&'a i128 as Div> @@ -203,7 +203,7 @@ LL | x / y | ^ no implementation for `f64 / {integer}` | = help: the trait `Div<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Div`: + = help: the following other types implement trait `Div`: <&'a f32 as Div> <&'a f64 as Div> <&'a i128 as Div> diff --git a/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr b/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr index 988379e582a34..fd3996416b67a 100644 --- a/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr +++ b/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr @@ -5,7 +5,7 @@ LL | x + 100 | ^ no implementation for `f32 + {integer}` | = help: the trait `Add<{integer}>` is not implemented for `f32` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> @@ -27,7 +27,7 @@ LL | x + 100 | ^ no implementation for `f64 + {integer}` | = help: the trait `Add<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> @@ -49,7 +49,7 @@ LL | x - 100 | ^ no implementation for `f32 - {integer}` | = help: the trait `Sub<{integer}>` is not implemented for `f32` - = help: the following other types implement trait `Sub`: + = help: the following other types implement trait `Sub`: <&'a f32 as Sub> <&'a f64 as Sub> <&'a i128 as Sub> @@ -71,7 +71,7 @@ LL | x - 100 | ^ no implementation for `f64 - {integer}` | = help: the trait `Sub<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Sub`: + = help: the following other types implement trait `Sub`: <&'a f32 as Sub> <&'a f64 as Sub> <&'a i128 as Sub> @@ -93,7 +93,7 @@ LL | x * 100 | ^ no implementation for `f32 * {integer}` | = help: the trait `Mul<{integer}>` is not implemented for `f32` - = help: the following other types implement trait `Mul`: + = help: the following other types implement trait `Mul`: <&'a f32 as Mul> <&'a f64 as Mul> <&'a i128 as Mul> @@ -115,7 +115,7 @@ LL | x * 100 | ^ no implementation for `f64 * {integer}` | = help: the trait `Mul<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Mul`: + = help: the following other types implement trait `Mul`: <&'a f32 as Mul> <&'a f64 as Mul> <&'a i128 as Mul> @@ -137,7 +137,7 @@ LL | x / 100 | ^ no implementation for `f32 / {integer}` | = help: the trait `Div<{integer}>` is not implemented for `f32` - = help: the following other types implement trait `Div`: + = help: the following other types implement trait `Div`: <&'a f32 as Div> <&'a f64 as Div> <&'a i128 as Div> @@ -159,7 +159,7 @@ LL | x / 100 | ^ no implementation for `f64 / {integer}` | = help: the trait `Div<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Div`: + = help: the following other types implement trait `Div`: <&'a f32 as Div> <&'a f64 as Div> <&'a i128 as Div> diff --git a/src/test/ui/on-unimplemented/multiple-impls.stderr b/src/test/ui/on-unimplemented/multiple-impls.stderr index 06e1a222af881..ebe7f1f7a34a3 100644 --- a/src/test/ui/on-unimplemented/multiple-impls.stderr +++ b/src/test/ui/on-unimplemented/multiple-impls.stderr @@ -7,7 +7,7 @@ LL | Index::index(&[] as &[i32], 2u32); | required by a bound introduced by this call | = help: the trait `Index` is not implemented for `[i32]` - = help: the following other types implement trait `Index`: + = help: the following other types implement trait `Index>`: <[i32] as Index>> <[i32] as Index>> @@ -20,7 +20,7 @@ LL | Index::index(&[] as &[i32], Foo(2u32)); | required by a bound introduced by this call | = help: the trait `Index>` is not implemented for `[i32]` - = help: the following other types implement trait `Index`: + = help: the following other types implement trait `Index>`: <[i32] as Index>> <[i32] as Index>> @@ -33,7 +33,7 @@ LL | Index::index(&[] as &[i32], Bar(2u32)); | required by a bound introduced by this call | = help: the trait `Index>` is not implemented for `[i32]` - = help: the following other types implement trait `Index`: + = help: the following other types implement trait `Index>`: <[i32] as Index>> <[i32] as Index>> @@ -44,7 +44,7 @@ LL | Index::index(&[] as &[i32], 2u32); | ^^^^^^^^^^^^ trait message | = help: the trait `Index` is not implemented for `[i32]` - = help: the following other types implement trait `Index`: + = help: the following other types implement trait `Index>`: <[i32] as Index>> <[i32] as Index>> @@ -55,7 +55,7 @@ LL | Index::index(&[] as &[i32], Foo(2u32)); | ^^^^^^^^^^^^ on impl for Foo | = help: the trait `Index>` is not implemented for `[i32]` - = help: the following other types implement trait `Index`: + = help: the following other types implement trait `Index>`: <[i32] as Index>> <[i32] as Index>> @@ -66,7 +66,7 @@ LL | Index::index(&[] as &[i32], Bar(2u32)); | ^^^^^^^^^^^^ on impl for Bar | = help: the trait `Index>` is not implemented for `[i32]` - = help: the following other types implement trait `Index`: + = help: the following other types implement trait `Index>`: <[i32] as Index>> <[i32] as Index>> diff --git a/src/test/ui/on-unimplemented/slice-index.stderr b/src/test/ui/on-unimplemented/slice-index.stderr index ae7d2e1d82393..e90d08187ed90 100644 --- a/src/test/ui/on-unimplemented/slice-index.stderr +++ b/src/test/ui/on-unimplemented/slice-index.stderr @@ -15,7 +15,7 @@ LL | x[..1i32]; | ^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `SliceIndex<[i32]>` is not implemented for `RangeTo` - = help: the following other types implement trait `SliceIndex`: + = help: the following other types implement trait `SliceIndex`: as SliceIndex<[T]>> as SliceIndex> = note: required because of the requirements on the impl of `Index>` for `[i32]` diff --git a/src/test/ui/span/multiline-span-simple.stderr b/src/test/ui/span/multiline-span-simple.stderr index c0d9a8634e487..81dd7d03f919c 100644 --- a/src/test/ui/span/multiline-span-simple.stderr +++ b/src/test/ui/span/multiline-span-simple.stderr @@ -5,7 +5,7 @@ LL | foo(1 as u32 + | ^ no implementation for `u32 + ()` | = help: the trait `Add<()>` is not implemented for `u32` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> diff --git a/src/test/ui/suggestions/into-str.stderr b/src/test/ui/suggestions/into-str.stderr index 8ae5c84794734..b7b92e0353485 100644 --- a/src/test/ui/suggestions/into-str.stderr +++ b/src/test/ui/suggestions/into-str.stderr @@ -7,7 +7,7 @@ LL | foo(String::new()); | required by a bound introduced by this call | = note: to coerce a `String` into a `&str`, use `&*` as a prefix - = help: the following other types implement trait `From`: + = help: the following other types implement trait `From`: > > > diff --git a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr index 383f40d47fa44..0f3d0e59e19bc 100644 --- a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr +++ b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `&[i8]: From<&[u8]>` is not satisfied LL | let _: &[i8] = data.into(); | ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]` | - = help: the following other types implement trait `From`: + = help: the following other types implement trait `From>`: <[T; LANES] as From>> <[bool; LANES] as From>> = note: required because of the requirements on the impl of `Into<&[i8]>` for `&[u8]` diff --git a/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr b/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr index cab0ccdf710da..0220cf4127ebf 100644 --- a/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr +++ b/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfi LL | c.same_as(22) | ^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` | - = help: the following other types implement trait `CompareTo`: + = help: the following other types implement trait `CompareTo`: > > @@ -25,7 +25,7 @@ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfi LL | ::same_as(c, 22) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` | - = help: the following other types implement trait `CompareTo`: + = help: the following other types implement trait `CompareTo`: > > @@ -46,7 +46,7 @@ error[E0277]: the trait bound `i64: CompareTo` is not satisfied LL | assert_eq!(22_i64.same_as(22), true); | ^^^^^^^ the trait `CompareTo` is not implemented for `i64` | - = help: the following other types implement trait `CompareTo`: + = help: the following other types implement trait `CompareTo`: > > diff --git a/src/test/ui/try-trait/bad-interconversion.stderr b/src/test/ui/try-trait/bad-interconversion.stderr index 1a4105231dc75..1b46252ae89ec 100644 --- a/src/test/ui/try-trait/bad-interconversion.stderr +++ b/src/test/ui/try-trait/bad-interconversion.stderr @@ -7,7 +7,7 @@ LL | Ok(Err(123_i32)?) | ^ the trait `From` is not implemented for `u8` | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait - = help: the following other types implement trait `From`: + = help: the following other types implement trait `From`: > > > diff --git a/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr index 9a3fd2f4005f3..2fe115927c036 100644 --- a/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr +++ b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `(): Foo` is not satisfied LL | fn foo() -> impl Foo { | ^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()` | - = help: the following other types implement trait `Foo`: + = help: the following other types implement trait `Foo`: <() as Foo<()>> <() as Foo> diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index f292877f30ea2..15deade2cd8f1 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -65,7 +65,7 @@ LL | trait ProjectionPred> where T::Item : Add {} | ^^^^^^^ no implementation for `i32 + u8` | = help: the trait `Add` is not implemented for `i32` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> diff --git a/src/test/ui/typeck/issue-81293.stderr b/src/test/ui/typeck/issue-81293.stderr index 9658288ac8b28..00f490c465345 100644 --- a/src/test/ui/typeck/issue-81293.stderr +++ b/src/test/ui/typeck/issue-81293.stderr @@ -20,7 +20,7 @@ LL | a = c + b * 5; | ^ no implementation for `usize + u16` | = help: the trait `Add` is not implemented for `usize` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> diff --git a/src/test/ui/typeck/issue-90101.stderr b/src/test/ui/typeck/issue-90101.stderr index ab9a72edfe98d..b6d02285bd237 100644 --- a/src/test/ui/typeck/issue-90101.stderr +++ b/src/test/ui/typeck/issue-90101.stderr @@ -6,7 +6,7 @@ LL | func(Path::new("hello").to_path_buf().to_string_lossy(), "world") | | | required by a bound introduced by this call | - = help: the following other types implement trait `From`: + = help: the following other types implement trait `From>`: > >> >> diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr index 74766d9fdd1b1..09208527210f9 100644 --- a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -5,7 +5,7 @@ LL | >::add(1, 2); | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32` | = help: the trait `Add` is not implemented for `i32` - = help: the following other types implement trait `Add`: + = help: the following other types implement trait `Add`: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> From 5a93f3831263b383bd54363f8572c0cfb4699814 Mon Sep 17 00:00:00 2001 From: Dylan DPC Date: Tue, 5 Apr 2022 23:23:38 +0200 Subject: [PATCH 4/7] Revert "Dedup logic and improve output for other types that impl trait" This reverts commit ef91519b45d2bbf0ce8c0180118160562eaaa0ca. --- .../src/traits/error_reporting/mod.rs | 121 ++++++++--------- .../src/traits/error_reporting/suggestions.rs | 7 +- src/test/ui/binop/binop-mul-i32-f32.stderr | 10 +- src/test/ui/binop/issue-77910-1.stderr | 18 +-- .../ui/binop/shift-various-bad-types.stderr | 6 +- .../ui/chalkify/chalk_initial_program.stderr | 6 +- src/test/ui/chalkify/type_inference.stderr | 6 +- .../defaults/rp_impl_trait_fail.stderr | 6 +- .../ui/const-generics/exhaustive-value.stderr | 2 +- .../issues/issue-67185-2.stderr | 36 +++--- .../occurs-check/unused-substs-1.stderr | 2 +- .../const-eval/const-eval-overflow-3b.stderr | 10 +- .../const-eval/const-eval-overflow-4b.stderr | 10 +- .../ui/consts/too_generic_eval_ice.stderr | 2 +- ...e-21659-show-relevant-trait-impls-1.stderr | 2 +- ...e-21659-show-relevant-trait-impls-2.stderr | 2 +- .../issue-39802-show-5-trait-impls.stderr | 14 +- ...de-confusable-in-float-literal-expt.stderr | 2 +- .../bugs/issue-88460.stderr | 2 +- src/test/ui/impl-trait/equality.stderr | 10 +- src/test/ui/issues/issue-11771.stderr | 4 +- src/test/ui/issues/issue-24352.stderr | 10 +- src/test/ui/issues/issue-50582.stderr | 2 +- src/test/ui/issues/issue-59488.stderr | 18 +-- src/test/ui/kindck/kindck-copy.stderr | 36 +++--- .../ui/lexer/lex-bad-char-literals-6.stderr | 20 +-- src/test/ui/mismatched_types/binops.stderr | 52 ++++---- src/test/ui/never_type/issue-13352.stderr | 10 +- .../not-suggest-float-literal.stderr | 122 +++++++++--------- .../suggest-float-literal.stderr | 72 +++++------ .../ui/on-unimplemented/multiple-impls.stderr | 12 +- .../ui/on-unimplemented/slice-index.stderr | 2 +- .../termination-trait-test-wrong-type.stderr | 8 +- src/test/ui/span/multiline-span-simple.stderr | 10 +- src/test/ui/suggestions/into-str.stderr | 2 +- .../issue-71394-no-from-impl.stderr | 2 +- .../bound/assoc-fn-bound-root-obligation.rs | 2 +- .../assoc-fn-bound-root-obligation.stderr | 2 +- .../repeated-supertrait-ambig.stderr | 10 +- src/test/ui/traits/issue-79458.stderr | 8 +- src/test/ui/traits/map-types.stderr | 2 +- .../ui/try-trait/bad-interconversion.stderr | 6 +- .../nested-tait-inference2.stderr | 2 +- src/test/ui/type/type-check-defaults.stderr | 10 +- src/test/ui/typeck/issue-81293.stderr | 10 +- src/test/ui/typeck/issue-90101.stderr | 2 +- .../ui/ufcs/ufcs-qpath-self-mismatch.stderr | 10 +- 47 files changed, 357 insertions(+), 363 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 7f76f636efa19..56ac90b10df08 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -30,7 +30,7 @@ use rustc_middle::traits::select::OverflowError; use rustc_middle::ty::error::ExpectedFound; use rustc_middle::ty::fold::TypeFolder; use rustc_middle::ty::{ - self, SubtypePredicate, ToPolyTraitRef, ToPredicate, TraitRef, Ty, TyCtxt, TypeFoldable, + self, SubtypePredicate, ToPolyTraitRef, ToPredicate, Ty, TyCtxt, TypeFoldable, }; use rustc_span::symbol::{kw, sym}; use rustc_span::{ExpnKind, MultiSpan, Span, DUMMY_SP}; @@ -1762,60 +1762,6 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { trait_ref: ty::PolyTraitRef<'tcx>, err: &mut Diagnostic, ) -> bool { - let report = |mut candidates: Vec>, err: &mut Diagnostic| { - candidates.sort(); - candidates.dedup(); - let len = candidates.len(); - if candidates.len() == 0 { - return false; - } - let trait_ref = candidates[0]; - if candidates.len() == 1 { - err.highlighted_help(vec![ - ( - format!( - "the trait `{}` is implemented for `", - trait_ref.print_only_trait_path() - ), - Style::NoStyle, - ), - (candidates[0].self_ty().to_string(), Style::Highlight), - ("`".to_string(), Style::NoStyle), - ]); - return true; - } - // Check if the trait is the same in all cases. If so, we'll only show the type. - // FIXME: there *has* to be a better way! - let mut traits: Vec<_> = candidates - .iter() - .map(|c| format!("{}", c).split(" as ").last().unwrap().to_string()) - .collect(); - traits.sort(); - traits.dedup(); - - let mut candidates: Vec = candidates - .into_iter() - .map(|c| { - if traits.len() == 1 { - format!("\n {}", c.self_ty()) - } else { - format!("\n {}", c) - } - }) - .collect(); - - candidates.sort(); - candidates.dedup(); - let end = if candidates.len() <= 9 { candidates.len() } else { 8 }; - err.help(&format!( - "the following other types implement trait `{}`:{}{}", - trait_ref.print_only_trait_path(), - candidates[..end].join(""), - if len > 9 { format!("\nand {} others", len - 8) } else { String::new() } - )); - true - }; - let def_id = trait_ref.def_id(); if impl_candidates.is_empty() { if self.tcx.trait_is_auto(def_id) @@ -1825,7 +1771,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { // Mentioning implementers of `Copy`, `Debug` and friends is not useful. return false; } - let normalized_impl_candidates: Vec<_> = self + let mut normalized_impl_candidates: Vec<_> = self .tcx .all_impls(def_id) // Ignore automatically derived impls and `!Trait` impls. @@ -1836,10 +1782,45 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { .filter_map(|def_id| self.tcx.impl_trait_ref(def_id)) // Avoid mentioning type parameters. .filter(|trait_ref| !matches!(trait_ref.self_ty().kind(), ty::Param(_))) + .map(|trait_ref| format!("\n {}", trait_ref.self_ty())) .collect(); - return report(normalized_impl_candidates, err); + normalized_impl_candidates.sort(); + normalized_impl_candidates.dedup(); + let len = normalized_impl_candidates.len(); + if len == 0 { + return false; + } + if len == 1 { + err.highlighted_help(vec![ + ( + format!( + "the trait `{}` is implemented for `", + trait_ref.print_only_trait_path() + ), + Style::NoStyle, + ), + (normalized_impl_candidates[0].trim().to_string(), Style::Highlight), + ("`".to_string(), Style::NoStyle), + ]); + return true; + } + let end = if normalized_impl_candidates.len() <= 9 { + normalized_impl_candidates.len() + } else { + 8 + }; + err.help(&format!( + "the following other types implement trait `{}`:{}{}", + trait_ref.print_only_trait_path(), + normalized_impl_candidates[..end].join(""), + if len > 9 { format!("\nand {} others", len - 8) } else { String::new() } + )); + return true; } + let len = impl_candidates.len(); + let end = if impl_candidates.len() <= 9 { impl_candidates.len() } else { 8 }; + let normalize = |candidate| { self.tcx.infer_ctxt().enter(|ref infcx| { let normalized = infcx @@ -1847,8 +1828,8 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { .normalize(candidate) .ok(); match normalized { - Some(normalized) => normalized.value, - None => candidate, + Some(normalized) => format!("\n {}", normalized.value), + None => format!("\n {}", candidate), } }) }; @@ -1859,6 +1840,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { // // Prefer more similar candidates first, then sort lexicographically // by their normalized string representation. + let first_candidate = impl_candidates.get(0).map(|candidate| candidate.trait_ref); let mut normalized_impl_candidates_and_similarities = impl_candidates .into_iter() .map(|ImplCandidate { trait_ref, similarity }| { @@ -1874,7 +1856,26 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { .map(|(_, normalized)| normalized) .collect::>(); - report(normalized_impl_candidates, err) + if normalized_impl_candidates.len() == 1 { + err.highlighted_help(vec![ + ( + format!( + "the trait `{}` is implemented for `", + first_candidate.unwrap().print_only_trait_path() + ), + Style::NoStyle, + ), + (first_candidate.unwrap().self_ty().to_string(), Style::Highlight), + ("`".to_string(), Style::NoStyle), + ]); + } else { + err.help(&format!( + "the following implementations were found:{}{}", + normalized_impl_candidates[..end].join(""), + if len > 9 { format!("\nand {} others", len - 8) } else { String::new() } + )); + } + true } /// Gets the parent trait chain start diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index c5324bf85a71d..fa887536b0e2b 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -565,11 +565,8 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { } } else if real_trait_pred != trait_pred { // This branch addresses #87437. - let obligation = self.mk_trait_obligation_with_new_self_ty( - param_env, - real_trait_pred, - base_ty, - ); + let obligation = + self.mk_trait_obligation_with_new_self_ty(param_env, real_trait_pred, base_ty); if self.predicate_may_hold(&obligation) { err.span_suggestion_verbose( span.shrink_to_lo(), diff --git a/src/test/ui/binop/binop-mul-i32-f32.stderr b/src/test/ui/binop/binop-mul-i32-f32.stderr index 453333fb56a87..715e52b41e75c 100644 --- a/src/test/ui/binop/binop-mul-i32-f32.stderr +++ b/src/test/ui/binop/binop-mul-i32-f32.stderr @@ -5,15 +5,15 @@ LL | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul` is not implemented for `i32` - = help: the following other types implement trait `Mul`: + = help: the following implementations were found: + <&'a i32 as Mul> + <&i32 as Mul<&i32>> + > + <&'a f32 as Mul> <&'a f64 as Mul> <&'a i128 as Mul> <&'a i16 as Mul> - <&'a i32 as Mul> - <&'a i64 as Mul> - <&'a i8 as Mul> - <&'a isize as Mul> and 49 others error: aborting due to previous error diff --git a/src/test/ui/binop/issue-77910-1.stderr b/src/test/ui/binop/issue-77910-1.stderr index 95ee51a88261a..16b06a0198b27 100644 --- a/src/test/ui/binop/issue-77910-1.stderr +++ b/src/test/ui/binop/issue-77910-1.stderr @@ -16,15 +16,15 @@ LL | assert_eq!(foo, y); | ^^^^^^^^^^^^^^^^^^ `for<'r> fn(&'r i32) -> &'r i32 {foo}` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for `for<'r> fn(&'r i32) -> &'r i32 {foo}` - = help: the following other types implement trait `Debug`: - extern "C" fn() -> Ret - extern "C" fn(A) -> Ret - extern "C" fn(A, ...) -> Ret - extern "C" fn(A, B) -> Ret - extern "C" fn(A, B, ...) -> Ret - extern "C" fn(A, B, C) -> Ret - extern "C" fn(A, B, C, ...) -> Ret - extern "C" fn(A, B, C, D) -> Ret + = help: the following implementations were found: + Ret as Debug> + Ret as Debug> + Ret as Debug> + Ret as Debug> + Ret as Debug> + Ret as Debug> + Ret as Debug> + Ret as Debug> and 68 others = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/binop/shift-various-bad-types.stderr b/src/test/ui/binop/shift-various-bad-types.stderr index bb0bb63b22df5..8fdb377751c24 100644 --- a/src/test/ui/binop/shift-various-bad-types.stderr +++ b/src/test/ui/binop/shift-various-bad-types.stderr @@ -5,7 +5,7 @@ LL | 22 >> p.char; | ^^ no implementation for `{integer} >> char` | = help: the trait `Shr` is not implemented for `{integer}` - = help: the following other types implement trait `Shr`: + = help: the following implementations were found: <&'a i128 as Shr> <&'a i128 as Shr> <&'a i128 as Shr> @@ -23,7 +23,7 @@ LL | 22 >> p.str; | ^^ no implementation for `{integer} >> &str` | = help: the trait `Shr<&str>` is not implemented for `{integer}` - = help: the following other types implement trait `Shr`: + = help: the following implementations were found: <&'a i128 as Shr> <&'a i128 as Shr> <&'a i128 as Shr> @@ -41,7 +41,7 @@ LL | 22 >> p; | ^^ no implementation for `{integer} >> &Panolpy` | = help: the trait `Shr<&Panolpy>` is not implemented for `{integer}` - = help: the following other types implement trait `Shr`: + = help: the following implementations were found: <&'a i128 as Shr> <&'a i128 as Shr> <&'a i128 as Shr> diff --git a/src/test/ui/chalkify/chalk_initial_program.stderr b/src/test/ui/chalkify/chalk_initial_program.stderr index 343c0a31862b9..7b0b3f85b3915 100644 --- a/src/test/ui/chalkify/chalk_initial_program.stderr +++ b/src/test/ui/chalkify/chalk_initial_program.stderr @@ -4,9 +4,9 @@ error[E0277]: the trait bound `f32: Foo` is not satisfied LL | gimme::(); | ^^^ the trait `Foo` is not implemented for `f32` | - = help: the following other types implement trait `Foo`: - i32 - u32 + = help: the following implementations were found: + + note: required by a bound in `gimme` --> $DIR/chalk_initial_program.rs:9:13 | diff --git a/src/test/ui/chalkify/type_inference.stderr b/src/test/ui/chalkify/type_inference.stderr index 508a6dd1388cb..14d43c1474c57 100644 --- a/src/test/ui/chalkify/type_inference.stderr +++ b/src/test/ui/chalkify/type_inference.stderr @@ -6,9 +6,9 @@ LL | only_bar(x); | | | required by a bound introduced by this call | - = help: the following other types implement trait `Bar`: - i32 - u32 + = help: the following implementations were found: + + note: required by a bound in `only_bar` --> $DIR/type_inference.rs:12:16 | diff --git a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr index 4c9ab6901b1f5..9cadc4110e1e6 100644 --- a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr +++ b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr @@ -25,7 +25,7 @@ error[E0277]: the trait bound `u32: Traitor` is not satisfied LL | fn uwu() -> impl Traitor { | ^^^^^^^^^^^^^^^ the trait `Traitor` is not implemented for `u32` | - = help: the following other types implement trait `Traitor`: + = help: the following implementations were found: > > @@ -50,9 +50,9 @@ error[E0277]: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied LL | fn owo() -> impl Traitor { | ^^^^^^^^^^^^ the trait `Traitor<1_u8, 1_u8>` is not implemented for `u64` | - = help: the following other types implement trait `Traitor`: - > + = help: the following implementations were found: > + > error[E0277]: the trait bound `u64: Traitor<1_u8, 1_u8>` is not satisfied --> $DIR/rp_impl_trait_fail.rs:24:26 diff --git a/src/test/ui/const-generics/exhaustive-value.stderr b/src/test/ui/const-generics/exhaustive-value.stderr index 5613ed27cb234..fcbb41bb4fcc4 100644 --- a/src/test/ui/const-generics/exhaustive-value.stderr +++ b/src/test/ui/const-generics/exhaustive-value.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `(): Foo` is not satisfied LL | <() as Foo>::test() | ^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()` | - = help: the following other types implement trait `Foo<0_u8>`: + = help: the following implementations were found: <() as Foo<0_u8>> <() as Foo<100_u8>> <() as Foo<101_u8>> diff --git a/src/test/ui/const-generics/issues/issue-67185-2.stderr b/src/test/ui/const-generics/issues/issue-67185-2.stderr index c7be8e14a10d5..89aa3d395e25b 100644 --- a/src/test/ui/const-generics/issues/issue-67185-2.stderr +++ b/src/test/ui/const-generics/issues/issue-67185-2.stderr @@ -4,9 +4,9 @@ error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied LL | ::Quaks: Bar, | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `[u16; 3]` | - = help: the following other types implement trait `Bar`: - [[u16; 3]; 3] - [u16; 4] + = help: the following implementations were found: + <[[u16; 3]; 3] as Bar> + <[u16; 4] as Bar> = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -16,9 +16,9 @@ error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied LL | [::Quaks; 2]: Bar, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]` | - = help: the following other types implement trait `Bar`: - [[u16; 3]; 3] - [u16; 4] + = help: the following implementations were found: + <[[u16; 3]; 3] as Bar> + <[u16; 4] as Bar> = help: see issue #48214 = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable @@ -28,9 +28,9 @@ error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied LL | impl Foo for FooImpl {} | ^^^ the trait `Bar` is not implemented for `[u16; 3]` | - = help: the following other types implement trait `Bar`: - [[u16; 3]; 3] - [u16; 4] + = help: the following implementations were found: + <[[u16; 3]; 3] as Bar> + <[u16; 4] as Bar> note: required by a bound in `Foo` --> $DIR/issue-67185-2.rs:15:25 | @@ -46,9 +46,9 @@ error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied LL | impl Foo for FooImpl {} | ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]` | - = help: the following other types implement trait `Bar`: - [[u16; 3]; 3] - [u16; 4] + = help: the following implementations were found: + <[[u16; 3]; 3] as Bar> + <[u16; 4] as Bar> note: required by a bound in `Foo` --> $DIR/issue-67185-2.rs:14:30 | @@ -64,9 +64,9 @@ error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied LL | fn f(_: impl Foo) {} | ^^^ the trait `Bar` is not implemented for `[[u16; 3]; 2]` | - = help: the following other types implement trait `Bar`: - [[u16; 3]; 3] - [u16; 4] + = help: the following implementations were found: + <[[u16; 3]; 3] as Bar> + <[u16; 4] as Bar> note: required by a bound in `Foo` --> $DIR/issue-67185-2.rs:14:30 | @@ -82,9 +82,9 @@ error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied LL | fn f(_: impl Foo) {} | ^^^ the trait `Bar` is not implemented for `[u16; 3]` | - = help: the following other types implement trait `Bar`: - [[u16; 3]; 3] - [u16; 4] + = help: the following implementations were found: + <[[u16; 3]; 3] as Bar> + <[u16; 4] as Bar> note: required by a bound in `Foo` --> $DIR/issue-67185-2.rs:15:25 | diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr b/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr index 8431d989278ba..aedf44658db63 100644 --- a/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr +++ b/src/test/ui/const-generics/occurs-check/unused-substs-1.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `A<{_: usize}>: Bar<{_: usize}>` is not satisfied LL | let _ = A; | ^ the trait `Bar<{_: usize}>` is not implemented for `A<{_: usize}>` | - = help: the trait `Bar` is implemented for `A<7_usize>` + = 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/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr index 5fde557a32ad7..d2d68506d4e1c 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr @@ -11,15 +11,15 @@ LL | = [0; (i8::MAX + 1u8) as usize]; | ^ no implementation for `i8 + u8` | = help: the trait `Add` is not implemented for `i8` - = help: the following other types implement trait `Add`: + = help: the following implementations were found: + <&'a i8 as Add> + <&i8 as Add<&i8>> + > + <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr index 3c192eef14f11..818e3bc15b19d 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr @@ -11,15 +11,15 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize] | ^ no implementation for `i8 + u8` | = help: the trait `Add` is not implemented for `i8` - = help: the following other types implement trait `Add`: + = help: the following implementations were found: + <&'a i8 as Add> + <&i8 as Add<&i8>> + > + <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error[E0604]: only `u8` can be cast as `char`, not `i8` diff --git a/src/test/ui/consts/too_generic_eval_ice.stderr b/src/test/ui/consts/too_generic_eval_ice.stderr index 5544350c34cba..45459b931caac 100644 --- a/src/test/ui/consts/too_generic_eval_ice.stderr +++ b/src/test/ui/consts/too_generic_eval_ice.stderr @@ -21,7 +21,7 @@ LL | [5; Self::HOST_SIZE] == [6; 0] | ^^ no implementation for `[{integer}; _] == [{integer}; 0]` | = help: the trait `PartialEq<[{integer}; 0]>` is not implemented for `[{integer}; _]` - = help: the following other types implement trait `PartialEq<[B; N]>`: + = help: the following implementations were found: <&[B] as PartialEq<[A; N]>> <&[T] as PartialEq>> <&mut [B] as PartialEq<[A; N]>> diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr index 1c83f75ffb937..8aedb4229e6d3 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `Bar: Foo` is not satisfied LL | f1.foo(1usize); | ^^^ the trait `Foo` is not implemented for `Bar` | - = help: the following other types implement trait `Foo`: + = help: the following implementations were found: > > diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr index 85f3eba927d06..f25c7ce00e548 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `Bar: Foo` is not satisfied LL | f1.foo(1usize); | ^^^ the trait `Foo` is not implemented for `Bar` | - = help: the following other types implement trait `Foo`: + = help: the following implementations were found: > > > diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr index e1d80313bc46b..3aa863e900f4a 100644 --- a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr +++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr @@ -6,7 +6,7 @@ LL | Foo::::bar(&1i8); | | | required by a bound introduced by this call | - = help: the following other types implement trait `Foo`: + = help: the following implementations were found: > > > @@ -25,16 +25,16 @@ LL | Foo::::bar(&1u8); | | | required by a bound introduced by this call | - = help: the following other types implement trait `Foo`: + = help: the following implementations were found: + > + > + > + > > > > > > - > - > - > - > error[E0277]: the trait bound `bool: Foo` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:26:21 @@ -44,7 +44,7 @@ LL | Foo::::bar(&true); | | | required by a bound introduced by this call | - = help: the following other types implement trait `Foo`: + = help: the following implementations were found: > > > diff --git a/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr b/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr index 15af2c26e8fca..bd9d9e086e044 100644 --- a/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr +++ b/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr @@ -22,7 +22,7 @@ LL | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e−11; // m³⋅kg⁻¹ | ^ no implementation for `{float} - {integer}` | = help: the trait `Sub<{integer}>` is not implemented for `{float}` - = help: the following other types implement trait `Sub`: + = help: the following implementations were found: <&'a f32 as Sub> <&'a f64 as Sub> <&'a i128 as Sub> diff --git a/src/test/ui/generic-associated-types/bugs/issue-88460.stderr b/src/test/ui/generic-associated-types/bugs/issue-88460.stderr index 98c304cc90b53..ec8de15dc3957 100644 --- a/src/test/ui/generic-associated-types/bugs/issue-88460.stderr +++ b/src/test/ui/generic-associated-types/bugs/issue-88460.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `for<'a> <_ as Trait>::Assoc<'a>: Marker` is not s LL | test(Foo); | ^^^^ the trait `for<'a> Marker` is not implemented for `<_ as Trait>::Assoc<'a>` | - = help: the trait `Marker` is implemented for `()` + = help: the trait `for<'a> Marker` is implemented for `()` note: required by a bound in `test` --> $DIR/issue-88460.rs:17:27 | diff --git a/src/test/ui/impl-trait/equality.stderr b/src/test/ui/impl-trait/equality.stderr index 48cfcb4ad3e0a..9137183375aca 100644 --- a/src/test/ui/impl-trait/equality.stderr +++ b/src/test/ui/impl-trait/equality.stderr @@ -24,15 +24,15 @@ LL | n + sum_to(n - 1) | ^ no implementation for `u32 + impl Foo` | = help: the trait `Add` is not implemented for `u32` - = help: the following other types implement trait `Add`: + = help: the following implementations were found: + <&'a u32 as Add> + <&u32 as Add<&u32>> + > + <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error: aborting due to 2 previous errors; 1 warning emitted diff --git a/src/test/ui/issues/issue-11771.stderr b/src/test/ui/issues/issue-11771.stderr index ef15aa5840482..019677775987e 100644 --- a/src/test/ui/issues/issue-11771.stderr +++ b/src/test/ui/issues/issue-11771.stderr @@ -5,7 +5,7 @@ LL | 1 + | ^ no implementation for `{integer} + ()` | = help: the trait `Add<()>` is not implemented for `{integer}` - = help: the following other types implement trait `Add`: + = help: the following implementations were found: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> @@ -23,7 +23,7 @@ LL | 1 + | ^ no implementation for `{integer} + ()` | = help: the trait `Add<()>` is not implemented for `{integer}` - = help: the following other types implement trait `Add`: + = help: the following implementations were found: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> diff --git a/src/test/ui/issues/issue-24352.stderr b/src/test/ui/issues/issue-24352.stderr index 1fa2d356c68ef..364fbbc981e64 100644 --- a/src/test/ui/issues/issue-24352.stderr +++ b/src/test/ui/issues/issue-24352.stderr @@ -5,15 +5,15 @@ LL | 1.0f64 - 1 | ^ no implementation for `f64 - {integer}` | = help: the trait `Sub<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Sub`: - <&'a f32 as Sub> + = help: the following implementations were found: <&'a f64 as Sub> + <&f64 as Sub<&f64>> + > + + <&'a f32 as Sub> <&'a i128 as Sub> <&'a i16 as Sub> <&'a i32 as Sub> - <&'a i64 as Sub> - <&'a i8 as Sub> - <&'a isize as Sub> and 48 others help: consider using a floating-point literal by writing it with `.0` | diff --git a/src/test/ui/issues/issue-50582.stderr b/src/test/ui/issues/issue-50582.stderr index d4e29030c1648..a1e614807de4a 100644 --- a/src/test/ui/issues/issue-50582.stderr +++ b/src/test/ui/issues/issue-50582.stderr @@ -14,7 +14,7 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new(); | ^ no implementation for `{integer} + ()` | = help: the trait `Add<()>` is not implemented for `{integer}` - = help: the following other types implement trait `Add`: + = help: the following implementations were found: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> diff --git a/src/test/ui/issues/issue-59488.stderr b/src/test/ui/issues/issue-59488.stderr index 76a47c49bbafb..c61d44bf89526 100644 --- a/src/test/ui/issues/issue-59488.stderr +++ b/src/test/ui/issues/issue-59488.stderr @@ -94,15 +94,15 @@ LL | assert_eq!(Foo::Bar, i); | ^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for `fn(usize) -> Foo {Foo::Bar}` - = help: the following other types implement trait `Debug`: - extern "C" fn() -> Ret - extern "C" fn(A) -> Ret - extern "C" fn(A, ...) -> Ret - extern "C" fn(A, B) -> Ret - extern "C" fn(A, B, ...) -> Ret - extern "C" fn(A, B, C) -> Ret - extern "C" fn(A, B, C, ...) -> Ret - extern "C" fn(A, B, C, D) -> Ret + = help: the following implementations were found: + Ret as Debug> + Ret as Debug> + Ret as Debug> + Ret as Debug> + Ret as Debug> + Ret as Debug> + Ret as Debug> + Ret as Debug> and 68 others = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/kindck/kindck-copy.stderr b/src/test/ui/kindck/kindck-copy.stderr index 1c61c85368be9..29c9b872b5816 100644 --- a/src/test/ui/kindck/kindck-copy.stderr +++ b/src/test/ui/kindck/kindck-copy.stderr @@ -4,15 +4,15 @@ error[E0277]: the trait bound `&'static mut isize: Copy` is not satisfied LL | assert_copy::<&'static mut isize>(); | ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'static mut isize` | - = help: the following other types implement trait `Copy`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize + = help: the following implementations were found: + + + + + + + + and 6 others note: required by a bound in `assert_copy` --> $DIR/kindck-copy.rs:5:18 @@ -26,15 +26,15 @@ error[E0277]: the trait bound `&'a mut isize: Copy` is not satisfied LL | assert_copy::<&'a mut isize>(); | ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'a mut isize` | - = help: the following other types implement trait `Copy`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize + = help: the following implementations were found: + + + + + + + + and 6 others note: required by a bound in `assert_copy` --> $DIR/kindck-copy.rs:5:18 diff --git a/src/test/ui/lexer/lex-bad-char-literals-6.stderr b/src/test/ui/lexer/lex-bad-char-literals-6.stderr index 199958bc7e416..9df6c92d1e578 100644 --- a/src/test/ui/lexer/lex-bad-char-literals-6.stderr +++ b/src/test/ui/lexer/lex-bad-char-literals-6.stderr @@ -38,15 +38,15 @@ LL | if x == y {} | ^^ no implementation for `&str == char` | = help: the trait `PartialEq` is not implemented for `&str` - = help: the following other types implement trait `PartialEq>`: + = help: the following implementations were found: <&'a str as PartialEq> <&'a str as PartialEq> <&'b str as PartialEq>> - > - >> - > - >> + > + > + > + and 4 others error[E0308]: mismatched types @@ -64,15 +64,15 @@ LL | if x == z {} | ^^ no implementation for `&str == char` | = help: the trait `PartialEq` is not implemented for `&str` - = help: the following other types implement trait `PartialEq>`: + = help: the following implementations were found: <&'a str as PartialEq> <&'a str as PartialEq> <&'b str as PartialEq>> - > - >> - > - >> + > + > + > + and 4 others error: aborting due to 6 previous errors diff --git a/src/test/ui/mismatched_types/binops.stderr b/src/test/ui/mismatched_types/binops.stderr index 16d1222899340..843ae5044c37a 100644 --- a/src/test/ui/mismatched_types/binops.stderr +++ b/src/test/ui/mismatched_types/binops.stderr @@ -5,7 +5,7 @@ LL | 1 + Some(1); | ^ no implementation for `{integer} + Option<{integer}>` | = help: the trait `Add>` is not implemented for `{integer}` - = help: the following other types implement trait `Add`: + = help: the following implementations were found: <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> @@ -23,15 +23,15 @@ LL | 2 as usize - Some(1); | ^ no implementation for `usize - Option<{integer}>` | = help: the trait `Sub>` is not implemented for `usize` - = help: the following other types implement trait `Sub`: + = help: the following implementations were found: + <&'a usize as Sub> + <&usize as Sub<&usize>> + > + <&'a f32 as Sub> <&'a f64 as Sub> <&'a i128 as Sub> <&'a i16 as Sub> - <&'a i32 as Sub> - <&'a i64 as Sub> - <&'a i8 as Sub> - <&'a isize as Sub> and 48 others error[E0277]: cannot multiply `{integer}` by `()` @@ -41,7 +41,7 @@ LL | 3 * (); | ^ no implementation for `{integer} * ()` | = help: the trait `Mul<()>` is not implemented for `{integer}` - = help: the following other types implement trait `Mul`: + = help: the following implementations were found: <&'a f32 as Mul> <&'a f64 as Mul> <&'a i128 as Mul> @@ -59,7 +59,7 @@ LL | 4 / ""; | ^ no implementation for `{integer} / &str` | = help: the trait `Div<&str>` is not implemented for `{integer}` - = help: the following other types implement trait `Div`: + = help: the following implementations were found: <&'a f32 as Div> <&'a f64 as Div> <&'a i128 as Div> @@ -77,15 +77,15 @@ LL | 5 < String::new(); | ^ no implementation for `{integer} < String` and `{integer} > String` | = help: the trait `PartialOrd` is not implemented for `{integer}` - = help: the following other types implement trait `PartialOrd`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize + = help: the following implementations were found: + + + + + + + + and 6 others error[E0277]: can't compare `{integer}` with `Result<{integer}, _>` @@ -95,15 +95,15 @@ LL | 6 == Ok(1); | ^^ no implementation for `{integer} == Result<{integer}, _>` | = help: the trait `PartialEq>` is not implemented for `{integer}` - = help: the following other types implement trait `PartialEq`: - f32 - f64 - i128 - i16 - i32 - i64 - i8 - isize + = help: the following implementations were found: + + + + + + + + and 6 others error: aborting due to 6 previous errors diff --git a/src/test/ui/never_type/issue-13352.stderr b/src/test/ui/never_type/issue-13352.stderr index 449b0756012de..cfb5d28e7674b 100644 --- a/src/test/ui/never_type/issue-13352.stderr +++ b/src/test/ui/never_type/issue-13352.stderr @@ -5,15 +5,15 @@ LL | 2_usize + (loop {}); | ^ no implementation for `usize + ()` | = help: the trait `Add<()>` is not implemented for `usize` - = help: the following other types implement trait `Add`: + = help: the following implementations were found: + <&'a usize as Add> + <&usize as Add<&usize>> + > + <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error: aborting due to previous error diff --git a/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr b/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr index 72cc4f6ec6469..431cbf81b01bd 100644 --- a/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr +++ b/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr @@ -5,15 +5,15 @@ LL | x + 100.0 | ^ no implementation for `u8 + {float}` | = help: the trait `Add<{float}>` is not implemented for `u8` - = help: the following other types implement trait `Add`: + = help: the following implementations were found: + <&'a u8 as Add> + <&u8 as Add<&u8>> + > + <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error[E0277]: cannot add `&str` to `f64` @@ -23,15 +23,15 @@ LL | x + "foo" | ^ no implementation for `f64 + &str` | = help: the trait `Add<&str>` is not implemented for `f64` - = help: the following other types implement trait `Add`: - <&'a f32 as Add> + = help: the following implementations were found: <&'a f64 as Add> + <&f64 as Add<&f64>> + > + + <&'a f32 as Add> <&'a i128 as Add> <&'a i16 as Add> <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error[E0277]: cannot add `{integer}` to `f64` @@ -41,15 +41,15 @@ LL | x + y | ^ no implementation for `f64 + {integer}` | = help: the trait `Add<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Add`: - <&'a f32 as Add> + = help: the following implementations were found: <&'a f64 as Add> + <&f64 as Add<&f64>> + > + + <&'a f32 as Add> <&'a i128 as Add> <&'a i16 as Add> <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error[E0277]: cannot subtract `{float}` from `u8` @@ -59,15 +59,15 @@ LL | x - 100.0 | ^ no implementation for `u8 - {float}` | = help: the trait `Sub<{float}>` is not implemented for `u8` - = help: the following other types implement trait `Sub`: + = help: the following implementations were found: + <&'a u8 as Sub> + <&u8 as Sub<&u8>> + > + <&'a f32 as Sub> <&'a f64 as Sub> <&'a i128 as Sub> <&'a i16 as Sub> - <&'a i32 as Sub> - <&'a i64 as Sub> - <&'a i8 as Sub> - <&'a isize as Sub> and 48 others error[E0277]: cannot subtract `&str` from `f64` @@ -77,15 +77,15 @@ LL | x - "foo" | ^ no implementation for `f64 - &str` | = help: the trait `Sub<&str>` is not implemented for `f64` - = help: the following other types implement trait `Sub`: - <&'a f32 as Sub> + = help: the following implementations were found: <&'a f64 as Sub> + <&f64 as Sub<&f64>> + > + + <&'a f32 as Sub> <&'a i128 as Sub> <&'a i16 as Sub> <&'a i32 as Sub> - <&'a i64 as Sub> - <&'a i8 as Sub> - <&'a isize as Sub> and 48 others error[E0277]: cannot subtract `{integer}` from `f64` @@ -95,15 +95,15 @@ LL | x - y | ^ no implementation for `f64 - {integer}` | = help: the trait `Sub<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Sub`: - <&'a f32 as Sub> + = help: the following implementations were found: <&'a f64 as Sub> + <&f64 as Sub<&f64>> + > + + <&'a f32 as Sub> <&'a i128 as Sub> <&'a i16 as Sub> <&'a i32 as Sub> - <&'a i64 as Sub> - <&'a i8 as Sub> - <&'a isize as Sub> and 48 others error[E0277]: cannot multiply `u8` by `{float}` @@ -113,15 +113,15 @@ LL | x * 100.0 | ^ no implementation for `u8 * {float}` | = help: the trait `Mul<{float}>` is not implemented for `u8` - = help: the following other types implement trait `Mul`: + = help: the following implementations were found: + <&'a u8 as Mul> + <&u8 as Mul<&u8>> + > + <&'a f32 as Mul> <&'a f64 as Mul> <&'a i128 as Mul> <&'a i16 as Mul> - <&'a i32 as Mul> - <&'a i64 as Mul> - <&'a i8 as Mul> - <&'a isize as Mul> and 49 others error[E0277]: cannot multiply `f64` by `&str` @@ -131,15 +131,15 @@ LL | x * "foo" | ^ no implementation for `f64 * &str` | = help: the trait `Mul<&str>` is not implemented for `f64` - = help: the following other types implement trait `Mul`: - <&'a f32 as Mul> + = help: the following implementations were found: <&'a f64 as Mul> + <&f64 as Mul<&f64>> + > + + <&'a f32 as Mul> <&'a i128 as Mul> <&'a i16 as Mul> <&'a i32 as Mul> - <&'a i64 as Mul> - <&'a i8 as Mul> - <&'a isize as Mul> and 49 others error[E0277]: cannot multiply `f64` by `{integer}` @@ -149,15 +149,15 @@ LL | x * y | ^ no implementation for `f64 * {integer}` | = help: the trait `Mul<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Mul`: - <&'a f32 as Mul> + = help: the following implementations were found: <&'a f64 as Mul> + <&f64 as Mul<&f64>> + > + + <&'a f32 as Mul> <&'a i128 as Mul> <&'a i16 as Mul> <&'a i32 as Mul> - <&'a i64 as Mul> - <&'a i8 as Mul> - <&'a isize as Mul> and 49 others error[E0277]: cannot divide `u8` by `{float}` @@ -167,15 +167,15 @@ LL | x / 100.0 | ^ no implementation for `u8 / {float}` | = help: the trait `Div<{float}>` is not implemented for `u8` - = help: the following other types implement trait `Div`: + = help: the following implementations were found: + <&'a u8 as Div> + <&u8 as Div<&u8>> + > + > + <&'a f32 as Div> <&'a f64 as Div> <&'a i128 as Div> - <&'a i16 as Div> - <&'a i32 as Div> - <&'a i64 as Div> - <&'a i8 as Div> - <&'a isize as Div> and 54 others error[E0277]: cannot divide `f64` by `&str` @@ -185,15 +185,15 @@ LL | x / "foo" | ^ no implementation for `f64 / &str` | = help: the trait `Div<&str>` is not implemented for `f64` - = help: the following other types implement trait `Div`: - <&'a f32 as Div> + = help: the following implementations were found: <&'a f64 as Div> + <&f64 as Div<&f64>> + > + + <&'a f32 as Div> <&'a i128 as Div> <&'a i16 as Div> <&'a i32 as Div> - <&'a i64 as Div> - <&'a i8 as Div> - <&'a isize as Div> and 54 others error[E0277]: cannot divide `f64` by `{integer}` @@ -203,15 +203,15 @@ LL | x / y | ^ no implementation for `f64 / {integer}` | = help: the trait `Div<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Div`: - <&'a f32 as Div> + = help: the following implementations were found: <&'a f64 as Div> + <&f64 as Div<&f64>> + > + + <&'a f32 as Div> <&'a i128 as Div> <&'a i16 as Div> <&'a i32 as Div> - <&'a i64 as Div> - <&'a i8 as Div> - <&'a isize as Div> and 54 others error: aborting due to 12 previous errors diff --git a/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr b/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr index fd3996416b67a..543e3137fdd09 100644 --- a/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr +++ b/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr @@ -5,15 +5,15 @@ LL | x + 100 | ^ no implementation for `f32 + {integer}` | = help: the trait `Add<{integer}>` is not implemented for `f32` - = help: the following other types implement trait `Add`: + = help: the following implementations were found: <&'a f32 as Add> + <&f32 as Add<&f32>> + > + <&'a f64 as Add> <&'a i128 as Add> <&'a i16 as Add> <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others help: consider using a floating-point literal by writing it with `.0` | @@ -27,15 +27,15 @@ LL | x + 100 | ^ no implementation for `f64 + {integer}` | = help: the trait `Add<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Add`: - <&'a f32 as Add> + = help: the following implementations were found: <&'a f64 as Add> + <&f64 as Add<&f64>> + > + + <&'a f32 as Add> <&'a i128 as Add> <&'a i16 as Add> <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others help: consider using a floating-point literal by writing it with `.0` | @@ -49,15 +49,15 @@ LL | x - 100 | ^ no implementation for `f32 - {integer}` | = help: the trait `Sub<{integer}>` is not implemented for `f32` - = help: the following other types implement trait `Sub`: + = help: the following implementations were found: <&'a f32 as Sub> + <&f32 as Sub<&f32>> + > + <&'a f64 as Sub> <&'a i128 as Sub> <&'a i16 as Sub> <&'a i32 as Sub> - <&'a i64 as Sub> - <&'a i8 as Sub> - <&'a isize as Sub> and 48 others help: consider using a floating-point literal by writing it with `.0` | @@ -71,15 +71,15 @@ LL | x - 100 | ^ no implementation for `f64 - {integer}` | = help: the trait `Sub<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Sub`: - <&'a f32 as Sub> + = help: the following implementations were found: <&'a f64 as Sub> + <&f64 as Sub<&f64>> + > + + <&'a f32 as Sub> <&'a i128 as Sub> <&'a i16 as Sub> <&'a i32 as Sub> - <&'a i64 as Sub> - <&'a i8 as Sub> - <&'a isize as Sub> and 48 others help: consider using a floating-point literal by writing it with `.0` | @@ -93,15 +93,15 @@ LL | x * 100 | ^ no implementation for `f32 * {integer}` | = help: the trait `Mul<{integer}>` is not implemented for `f32` - = help: the following other types implement trait `Mul`: + = help: the following implementations were found: <&'a f32 as Mul> + <&f32 as Mul<&f32>> + > + <&'a f64 as Mul> <&'a i128 as Mul> <&'a i16 as Mul> <&'a i32 as Mul> - <&'a i64 as Mul> - <&'a i8 as Mul> - <&'a isize as Mul> and 49 others help: consider using a floating-point literal by writing it with `.0` | @@ -115,15 +115,15 @@ LL | x * 100 | ^ no implementation for `f64 * {integer}` | = help: the trait `Mul<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Mul`: - <&'a f32 as Mul> + = help: the following implementations were found: <&'a f64 as Mul> + <&f64 as Mul<&f64>> + > + + <&'a f32 as Mul> <&'a i128 as Mul> <&'a i16 as Mul> <&'a i32 as Mul> - <&'a i64 as Mul> - <&'a i8 as Mul> - <&'a isize as Mul> and 49 others help: consider using a floating-point literal by writing it with `.0` | @@ -137,15 +137,15 @@ LL | x / 100 | ^ no implementation for `f32 / {integer}` | = help: the trait `Div<{integer}>` is not implemented for `f32` - = help: the following other types implement trait `Div`: + = help: the following implementations were found: <&'a f32 as Div> + <&f32 as Div<&f32>> + > + <&'a f64 as Div> <&'a i128 as Div> <&'a i16 as Div> <&'a i32 as Div> - <&'a i64 as Div> - <&'a i8 as Div> - <&'a isize as Div> and 54 others help: consider using a floating-point literal by writing it with `.0` | @@ -159,15 +159,15 @@ LL | x / 100 | ^ no implementation for `f64 / {integer}` | = help: the trait `Div<{integer}>` is not implemented for `f64` - = help: the following other types implement trait `Div`: - <&'a f32 as Div> + = help: the following implementations were found: <&'a f64 as Div> + <&f64 as Div<&f64>> + > + + <&'a f32 as Div> <&'a i128 as Div> <&'a i16 as Div> <&'a i32 as Div> - <&'a i64 as Div> - <&'a i8 as Div> - <&'a isize as Div> and 54 others help: consider using a floating-point literal by writing it with `.0` | diff --git a/src/test/ui/on-unimplemented/multiple-impls.stderr b/src/test/ui/on-unimplemented/multiple-impls.stderr index ebe7f1f7a34a3..be29d31d97b8e 100644 --- a/src/test/ui/on-unimplemented/multiple-impls.stderr +++ b/src/test/ui/on-unimplemented/multiple-impls.stderr @@ -7,7 +7,7 @@ LL | Index::index(&[] as &[i32], 2u32); | required by a bound introduced by this call | = help: the trait `Index` is not implemented for `[i32]` - = help: the following other types implement trait `Index>`: + = help: the following implementations were found: <[i32] as Index>> <[i32] as Index>> @@ -20,7 +20,7 @@ LL | Index::index(&[] as &[i32], Foo(2u32)); | required by a bound introduced by this call | = help: the trait `Index>` is not implemented for `[i32]` - = help: the following other types implement trait `Index>`: + = help: the following implementations were found: <[i32] as Index>> <[i32] as Index>> @@ -33,7 +33,7 @@ LL | Index::index(&[] as &[i32], Bar(2u32)); | required by a bound introduced by this call | = help: the trait `Index>` is not implemented for `[i32]` - = help: the following other types implement trait `Index>`: + = help: the following implementations were found: <[i32] as Index>> <[i32] as Index>> @@ -44,7 +44,7 @@ LL | Index::index(&[] as &[i32], 2u32); | ^^^^^^^^^^^^ trait message | = help: the trait `Index` is not implemented for `[i32]` - = help: the following other types implement trait `Index>`: + = help: the following implementations were found: <[i32] as Index>> <[i32] as Index>> @@ -55,7 +55,7 @@ LL | Index::index(&[] as &[i32], Foo(2u32)); | ^^^^^^^^^^^^ on impl for Foo | = help: the trait `Index>` is not implemented for `[i32]` - = help: the following other types implement trait `Index>`: + = help: the following implementations were found: <[i32] as Index>> <[i32] as Index>> @@ -66,7 +66,7 @@ LL | Index::index(&[] as &[i32], Bar(2u32)); | ^^^^^^^^^^^^ on impl for Bar | = help: the trait `Index>` is not implemented for `[i32]` - = help: the following other types implement trait `Index>`: + = help: the following implementations were found: <[i32] as Index>> <[i32] as Index>> diff --git a/src/test/ui/on-unimplemented/slice-index.stderr b/src/test/ui/on-unimplemented/slice-index.stderr index e90d08187ed90..6dc27b5d4cc56 100644 --- a/src/test/ui/on-unimplemented/slice-index.stderr +++ b/src/test/ui/on-unimplemented/slice-index.stderr @@ -15,7 +15,7 @@ LL | x[..1i32]; | ^^^^^^^^^ slice indices are of type `usize` or ranges of `usize` | = help: the trait `SliceIndex<[i32]>` is not implemented for `RangeTo` - = help: the following other types implement trait `SliceIndex`: + = help: the following implementations were found: as SliceIndex<[T]>> as SliceIndex> = note: required because of the requirements on the impl of `Index>` for `[i32]` diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr index 96a899ecca581..d87eceb1c9a7b 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr @@ -9,10 +9,10 @@ LL | | } | |_^ `main` can only return types that implement `Termination` | = help: the trait `Termination` is not implemented for `Result` - = help: the following other types implement trait `Termination`: - Result - Result<(), E> - Result + = help: the following implementations were found: + as Termination> + as Termination> + as Termination> note: required by a bound in `assert_test_result` --> $SRC_DIR/test/src/lib.rs:LL:COL | diff --git a/src/test/ui/span/multiline-span-simple.stderr b/src/test/ui/span/multiline-span-simple.stderr index 81dd7d03f919c..dee457ebd7f3f 100644 --- a/src/test/ui/span/multiline-span-simple.stderr +++ b/src/test/ui/span/multiline-span-simple.stderr @@ -5,15 +5,15 @@ LL | foo(1 as u32 + | ^ no implementation for `u32 + ()` | = help: the trait `Add<()>` is not implemented for `u32` - = help: the following other types implement trait `Add`: + = help: the following implementations were found: + <&'a u32 as Add> + <&u32 as Add<&u32>> + > + <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error: aborting due to previous error diff --git a/src/test/ui/suggestions/into-str.stderr b/src/test/ui/suggestions/into-str.stderr index b7b92e0353485..88a0f8f065027 100644 --- a/src/test/ui/suggestions/into-str.stderr +++ b/src/test/ui/suggestions/into-str.stderr @@ -7,7 +7,7 @@ LL | foo(String::new()); | required by a bound introduced by this call | = note: to coerce a `String` into a `&str`, use `&*` as a prefix - = help: the following other types implement trait `From`: + = help: the following implementations were found: > > > diff --git a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr index 0f3d0e59e19bc..7972437771399 100644 --- a/src/test/ui/suggestions/issue-71394-no-from-impl.stderr +++ b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `&[i8]: From<&[u8]>` is not satisfied LL | let _: &[i8] = data.into(); | ^^^^ the trait `From<&[u8]>` is not implemented for `&[i8]` | - = help: the following other types implement trait `From>`: + = help: the following implementations were found: <[T; LANES] as From>> <[bool; LANES] as From>> = note: required because of the requirements on the impl of `Into<&[i8]>` for `&[u8]` diff --git a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs index 1d234518056fd..2720f94a3c191 100644 --- a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs +++ b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs @@ -4,7 +4,7 @@ fn strip_lf(s: &str) -> &str { //~| NOTE expected an `FnMut<(char,)>` closure, found `u8` //~| NOTE required by a bound introduced by this call //~| HELP the trait `FnMut<(char,)>` is not implemented for `u8` - //~| HELP the following other types implement trait `Pattern<'a>`: + //~| HELP the following other types implement trait `Pattern<'_>`: //~| NOTE required because of the requirements on the impl of `Pattern<'_>` for `u8` } diff --git a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr index 115539a6dc28d..37cba4189d725 100644 --- a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr +++ b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr @@ -7,7 +7,7 @@ LL | s.strip_suffix(b'\n').unwrap_or(s) | required by a bound introduced by this call | = help: the trait `FnMut<(char,)>` is not implemented for `u8` - = help: the following other types implement trait `Pattern<'a>`: + = help: the following other types implement trait `Pattern<'_>`: &'b String &'b [char; N] &'b [char] diff --git a/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr b/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr index 0220cf4127ebf..3645ad03cb9bb 100644 --- a/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr +++ b/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr @@ -4,9 +4,7 @@ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfi LL | c.same_as(22) | ^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` | - = help: the following other types implement trait `CompareTo`: - > - > + = help: the trait `CompareTo` is implemented for `i64` error[E0277]: the trait bound `C: CompareTo` is not satisfied --> $DIR/repeated-supertrait-ambig.rs:30:7 @@ -25,9 +23,7 @@ error[E0277]: the trait bound `dyn CompareToInts: CompareTo` is not satisfi LL | ::same_as(c, 22) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `CompareTo` is not implemented for `dyn CompareToInts` | - = help: the following other types implement trait `CompareTo`: - > - > + = help: the trait `CompareTo` is implemented for `i64` error[E0277]: the trait bound `C: CompareTo` is not satisfied --> $DIR/repeated-supertrait-ambig.rs:38:5 @@ -46,7 +42,7 @@ error[E0277]: the trait bound `i64: CompareTo` is not satisfied LL | assert_eq!(22_i64.same_as(22), true); | ^^^^^^^ the trait `CompareTo` is not implemented for `i64` | - = help: the following other types implement trait `CompareTo`: + = help: the following implementations were found: > > diff --git a/src/test/ui/traits/issue-79458.stderr b/src/test/ui/traits/issue-79458.stderr index cf2e4edf9f0a9..b970012837313 100644 --- a/src/test/ui/traits/issue-79458.stderr +++ b/src/test/ui/traits/issue-79458.stderr @@ -7,10 +7,10 @@ LL | struct Foo<'a, T> { LL | bar: &'a mut T | ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `&mut T` | - = help: the following other types implement trait `Clone`: - &T - *const T - *mut T + = help: the following implementations were found: + <&T as Clone> + <*const T as Clone> + <*mut T as Clone> = note: `Clone` is implemented for `&T`, but not for `&mut T` = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/traits/map-types.stderr b/src/test/ui/traits/map-types.stderr index a4686edb71757..37bc5c6badc41 100644 --- a/src/test/ui/traits/map-types.stderr +++ b/src/test/ui/traits/map-types.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `Box>: Map` is LL | let y: Box> = Box::new(x); | ^^^^^^^^^^^ the trait `Map` is not implemented for `Box>` | - = help: the trait `Map` is implemented for `HashMap` + = help: the trait `Map` is implemented for `HashMap` = note: required for the cast to the object type `dyn Map` error: aborting due to previous error diff --git a/src/test/ui/try-trait/bad-interconversion.stderr b/src/test/ui/try-trait/bad-interconversion.stderr index 1b46252ae89ec..6567eca38c81d 100644 --- a/src/test/ui/try-trait/bad-interconversion.stderr +++ b/src/test/ui/try-trait/bad-interconversion.stderr @@ -7,15 +7,15 @@ LL | Ok(Err(123_i32)?) | ^ the trait `From` is not implemented for `u8` | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait - = help: the following other types implement trait `From`: + = help: the following implementations were found: + > + > > > > > > > - > - > and 67 others = note: required because of the requirements on the impl of `FromResidual>` for `Result` diff --git a/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr index 2fe115927c036..1372a018667c2 100644 --- a/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr +++ b/src/test/ui/type-alias-impl-trait/nested-tait-inference2.stderr @@ -4,7 +4,7 @@ error[E0277]: the trait bound `(): Foo` is not satisfied LL | fn foo() -> impl Foo { | ^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `()` | - = help: the following other types implement trait `Foo`: + = help: the following implementations were found: <() as Foo<()>> <() as Foo> diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index 15deade2cd8f1..15bbfeb87c6f3 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -65,15 +65,15 @@ LL | trait ProjectionPred> where T::Item : Add {} | ^^^^^^^ no implementation for `i32 + u8` | = help: the trait `Add` is not implemented for `i32` - = help: the following other types implement trait `Add`: + = help: the following implementations were found: + <&'a i32 as Add> + <&i32 as Add<&i32>> + > + <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error: aborting due to 7 previous errors diff --git a/src/test/ui/typeck/issue-81293.stderr b/src/test/ui/typeck/issue-81293.stderr index 00f490c465345..9e2d8a6159c48 100644 --- a/src/test/ui/typeck/issue-81293.stderr +++ b/src/test/ui/typeck/issue-81293.stderr @@ -20,15 +20,15 @@ LL | a = c + b * 5; | ^ no implementation for `usize + u16` | = help: the trait `Add` is not implemented for `usize` - = help: the following other types implement trait `Add`: + = help: the following implementations were found: + <&'a usize as Add> + <&usize as Add<&usize>> + > + <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error: aborting due to 3 previous errors diff --git a/src/test/ui/typeck/issue-90101.stderr b/src/test/ui/typeck/issue-90101.stderr index b6d02285bd237..998b636887f23 100644 --- a/src/test/ui/typeck/issue-90101.stderr +++ b/src/test/ui/typeck/issue-90101.stderr @@ -6,7 +6,7 @@ LL | func(Path::new("hello").to_path_buf().to_string_lossy(), "world") | | | required by a bound introduced by this call | - = help: the following other types implement trait `From>`: + = help: the following implementations were found: > >> >> diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr index 09208527210f9..64da15c505536 100644 --- a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -5,15 +5,15 @@ LL | >::add(1, 2); | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32` | = help: the trait `Add` is not implemented for `i32` - = help: the following other types implement trait `Add`: + = help: the following implementations were found: + <&'a i32 as Add> + <&i32 as Add<&i32>> + > + <&'a f32 as Add> <&'a f64 as Add> <&'a i128 as Add> <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error[E0308]: mismatched types From 746c9b443bb27d32a6a7b168845a422690821fd1 Mon Sep 17 00:00:00 2001 From: Dylan DPC Date: Tue, 5 Apr 2022 23:23:41 +0200 Subject: [PATCH 5/7] Revert "Fix list length" This reverts commit e2bba0708a1e4b0c21f94de56c2bd5d66d3b825f. --- .../src/traits/error_reporting/mod.rs | 2 +- src/test/ui/binop/binop-mul-i32-f32.stderr | 4 -- src/test/ui/binop/issue-77910-1.stderr | 4 -- .../ui/binop/shift-various-bad-types.stderr | 12 ----- .../ui/const-generics/exhaustive-value.stderr | 4 -- .../const-eval/const-eval-overflow-3b.stderr | 4 -- .../const-eval/const-eval-overflow-4b.stderr | 4 -- .../ui/consts/too_generic_eval_ice.stderr | 4 -- ...e-21659-show-relevant-trait-impls-2.stderr | 2 - .../issue-39802-show-5-trait-impls.stderr | 12 ----- ...de-confusable-in-float-literal-expt.stderr | 4 -- src/test/ui/impl-trait/equality.stderr | 4 -- src/test/ui/issues/issue-11771.stderr | 8 ---- src/test/ui/issues/issue-24352.stderr | 4 -- src/test/ui/issues/issue-50582.stderr | 4 -- src/test/ui/issues/issue-59488.stderr | 4 -- src/test/ui/kindck/kindck-copy.stderr | 8 ---- .../ui/lexer/lex-bad-char-literals-6.stderr | 8 ---- src/test/ui/mismatched_types/binops.stderr | 24 ---------- src/test/ui/never_type/issue-13352.stderr | 4 -- .../not-suggest-float-literal.stderr | 48 ------------------- .../suggest-float-literal.stderr | 32 ------------- src/test/ui/span/multiline-span-simple.stderr | 4 -- src/test/ui/suggestions/into-str.stderr | 2 - .../ui/try-trait/bad-interconversion.stderr | 4 -- src/test/ui/type/type-check-defaults.stderr | 4 -- src/test/ui/typeck/issue-81293.stderr | 4 -- .../ui/ufcs/ufcs-qpath-self-mismatch.stderr | 4 -- 28 files changed, 1 insertion(+), 225 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 56ac90b10df08..db811bf9ccccf 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1819,7 +1819,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { } let len = impl_candidates.len(); - let end = if impl_candidates.len() <= 9 { impl_candidates.len() } else { 8 }; + let end = if impl_candidates.len() <= 5 { impl_candidates.len() } else { 4 }; let normalize = |candidate| { self.tcx.infer_ctxt().enter(|ref infcx| { diff --git a/src/test/ui/binop/binop-mul-i32-f32.stderr b/src/test/ui/binop/binop-mul-i32-f32.stderr index 715e52b41e75c..9fcf5d72625c5 100644 --- a/src/test/ui/binop/binop-mul-i32-f32.stderr +++ b/src/test/ui/binop/binop-mul-i32-f32.stderr @@ -10,10 +10,6 @@ LL | x * y <&i32 as Mul<&i32>> > - <&'a f32 as Mul> - <&'a f64 as Mul> - <&'a i128 as Mul> - <&'a i16 as Mul> and 49 others error: aborting due to previous error diff --git a/src/test/ui/binop/issue-77910-1.stderr b/src/test/ui/binop/issue-77910-1.stderr index 16b06a0198b27..9553fcc5bb204 100644 --- a/src/test/ui/binop/issue-77910-1.stderr +++ b/src/test/ui/binop/issue-77910-1.stderr @@ -21,10 +21,6 @@ LL | assert_eq!(foo, y); Ret as Debug> Ret as Debug> Ret as Debug> - Ret as Debug> - Ret as Debug> - Ret as Debug> - Ret as Debug> and 68 others = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/binop/shift-various-bad-types.stderr b/src/test/ui/binop/shift-various-bad-types.stderr index 8fdb377751c24..e134095e63879 100644 --- a/src/test/ui/binop/shift-various-bad-types.stderr +++ b/src/test/ui/binop/shift-various-bad-types.stderr @@ -10,10 +10,6 @@ LL | 22 >> p.char; <&'a i128 as Shr> <&'a i128 as Shr> <&'a i128 as Shr> - <&'a i128 as Shr> - <&'a i128 as Shr> - <&'a i128 as Shr> - <&'a i128 as Shr> and 568 others error[E0277]: no implementation for `{integer} >> &str` @@ -28,10 +24,6 @@ LL | 22 >> p.str; <&'a i128 as Shr> <&'a i128 as Shr> <&'a i128 as Shr> - <&'a i128 as Shr> - <&'a i128 as Shr> - <&'a i128 as Shr> - <&'a i128 as Shr> and 568 others error[E0277]: no implementation for `{integer} >> &Panolpy` @@ -46,10 +38,6 @@ LL | 22 >> p; <&'a i128 as Shr> <&'a i128 as Shr> <&'a i128 as Shr> - <&'a i128 as Shr> - <&'a i128 as Shr> - <&'a i128 as Shr> - <&'a i128 as Shr> and 568 others error[E0308]: mismatched types diff --git a/src/test/ui/const-generics/exhaustive-value.stderr b/src/test/ui/const-generics/exhaustive-value.stderr index fcbb41bb4fcc4..cb85b6cb93d91 100644 --- a/src/test/ui/const-generics/exhaustive-value.stderr +++ b/src/test/ui/const-generics/exhaustive-value.stderr @@ -9,10 +9,6 @@ LL | <() as Foo>::test() <() as Foo<100_u8>> <() as Foo<101_u8>> <() as Foo<102_u8>> - <() as Foo<103_u8>> - <() as Foo<104_u8>> - <() as Foo<105_u8>> - <() as Foo<106_u8>> and 248 others error: aborting due to previous error diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr index d2d68506d4e1c..aee7192b6eda1 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr @@ -16,10 +16,6 @@ LL | = [0; (i8::MAX + 1u8) as usize]; <&i8 as Add<&i8>> > - <&'a f32 as Add> - <&'a f64 as Add> - <&'a i128 as Add> - <&'a i16 as Add> and 48 others error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr index 818e3bc15b19d..059447f7cacb3 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr +++ b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr @@ -16,10 +16,6 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize] <&i8 as Add<&i8>> > - <&'a f32 as Add> - <&'a f64 as Add> - <&'a i128 as Add> - <&'a i16 as Add> and 48 others error[E0604]: only `u8` can be cast as `char`, not `i8` diff --git a/src/test/ui/consts/too_generic_eval_ice.stderr b/src/test/ui/consts/too_generic_eval_ice.stderr index 45459b931caac..677fa7d21aef0 100644 --- a/src/test/ui/consts/too_generic_eval_ice.stderr +++ b/src/test/ui/consts/too_generic_eval_ice.stderr @@ -26,10 +26,6 @@ LL | [5; Self::HOST_SIZE] == [6; 0] <&[T] as PartialEq>> <&mut [B] as PartialEq<[A; N]>> <&mut [T] as PartialEq>> - <[A; N] as PartialEq<&[B]>> - <[A; N] as PartialEq<&mut [B]>> - <[A; N] as PartialEq<[B; N]>> - <[A; N] as PartialEq<[B]>> and 3 others error: aborting due to 3 previous errors diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr index f25c7ce00e548..ea461241bf414 100644 --- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr +++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr @@ -9,8 +9,6 @@ LL | f1.foo(1usize); > > > - > - > error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr index 3aa863e900f4a..58faaf4ea9014 100644 --- a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr +++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr @@ -11,11 +11,6 @@ LL | Foo::::bar(&1i8); > > > - > - > - > - > - > error[E0277]: the trait bound `u8: Foo` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:25:21 @@ -30,11 +25,6 @@ LL | Foo::::bar(&1u8); > > > - > - > - > - > - > error[E0277]: the trait bound `bool: Foo` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:26:21 @@ -49,8 +39,6 @@ LL | Foo::::bar(&true); > > > - > - > error: aborting due to 3 previous errors diff --git a/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr b/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr index bd9d9e086e044..c12b02a76c58a 100644 --- a/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr +++ b/src/test/ui/did_you_mean/issue-49746-unicode-confusable-in-float-literal-expt.stderr @@ -27,10 +27,6 @@ LL | const UNIVERSAL_GRAVITATIONAL_CONSTANT: f64 = 6.674e−11; // m³⋅kg⁻¹ <&'a f64 as Sub> <&'a i128 as Sub> <&'a i16 as Sub> - <&'a i32 as Sub> - <&'a i64 as Sub> - <&'a i8 as Sub> - <&'a isize as Sub> and 48 others error: aborting due to 3 previous errors diff --git a/src/test/ui/impl-trait/equality.stderr b/src/test/ui/impl-trait/equality.stderr index 9137183375aca..6592e234d9873 100644 --- a/src/test/ui/impl-trait/equality.stderr +++ b/src/test/ui/impl-trait/equality.stderr @@ -29,10 +29,6 @@ LL | n + sum_to(n - 1) <&u32 as Add<&u32>> > - <&'a f32 as Add> - <&'a f64 as Add> - <&'a i128 as Add> - <&'a i16 as Add> and 48 others error: aborting due to 2 previous errors; 1 warning emitted diff --git a/src/test/ui/issues/issue-11771.stderr b/src/test/ui/issues/issue-11771.stderr index 019677775987e..2b93d4aab27db 100644 --- a/src/test/ui/issues/issue-11771.stderr +++ b/src/test/ui/issues/issue-11771.stderr @@ -10,10 +10,6 @@ LL | 1 + <&'a f64 as Add> <&'a i128 as Add> <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error[E0277]: cannot add `()` to `{integer}` @@ -28,10 +24,6 @@ LL | 1 + <&'a f64 as Add> <&'a i128 as Add> <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-24352.stderr b/src/test/ui/issues/issue-24352.stderr index 364fbbc981e64..f61ff0bda0bbd 100644 --- a/src/test/ui/issues/issue-24352.stderr +++ b/src/test/ui/issues/issue-24352.stderr @@ -10,10 +10,6 @@ LL | 1.0f64 - 1 <&f64 as Sub<&f64>> > - <&'a f32 as Sub> - <&'a i128 as Sub> - <&'a i16 as Sub> - <&'a i32 as Sub> and 48 others help: consider using a floating-point literal by writing it with `.0` | diff --git a/src/test/ui/issues/issue-50582.stderr b/src/test/ui/issues/issue-50582.stderr index a1e614807de4a..64bcfcd6016ab 100644 --- a/src/test/ui/issues/issue-50582.stderr +++ b/src/test/ui/issues/issue-50582.stderr @@ -19,10 +19,6 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new(); <&'a f64 as Add> <&'a i128 as Add> <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-59488.stderr b/src/test/ui/issues/issue-59488.stderr index c61d44bf89526..55616d2d322ee 100644 --- a/src/test/ui/issues/issue-59488.stderr +++ b/src/test/ui/issues/issue-59488.stderr @@ -99,10 +99,6 @@ LL | assert_eq!(Foo::Bar, i); Ret as Debug> Ret as Debug> Ret as Debug> - Ret as Debug> - Ret as Debug> - Ret as Debug> - Ret as Debug> and 68 others = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/test/ui/kindck/kindck-copy.stderr b/src/test/ui/kindck/kindck-copy.stderr index 29c9b872b5816..6272c4b702266 100644 --- a/src/test/ui/kindck/kindck-copy.stderr +++ b/src/test/ui/kindck/kindck-copy.stderr @@ -9,10 +9,6 @@ LL | assert_copy::<&'static mut isize>(); - - - - and 6 others note: required by a bound in `assert_copy` --> $DIR/kindck-copy.rs:5:18 @@ -31,10 +27,6 @@ LL | assert_copy::<&'a mut isize>(); - - - - and 6 others note: required by a bound in `assert_copy` --> $DIR/kindck-copy.rs:5:18 diff --git a/src/test/ui/lexer/lex-bad-char-literals-6.stderr b/src/test/ui/lexer/lex-bad-char-literals-6.stderr index 9df6c92d1e578..0e1851d292cf9 100644 --- a/src/test/ui/lexer/lex-bad-char-literals-6.stderr +++ b/src/test/ui/lexer/lex-bad-char-literals-6.stderr @@ -43,10 +43,6 @@ LL | if x == y {} <&'a str as PartialEq> <&'b str as PartialEq>> >> - > - > - > - and 4 others error[E0308]: mismatched types @@ -69,10 +65,6 @@ LL | if x == z {} <&'a str as PartialEq> <&'b str as PartialEq>> >> - > - > - > - and 4 others error: aborting due to 6 previous errors diff --git a/src/test/ui/mismatched_types/binops.stderr b/src/test/ui/mismatched_types/binops.stderr index 843ae5044c37a..6e67a7b454529 100644 --- a/src/test/ui/mismatched_types/binops.stderr +++ b/src/test/ui/mismatched_types/binops.stderr @@ -10,10 +10,6 @@ LL | 1 + Some(1); <&'a f64 as Add> <&'a i128 as Add> <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> and 48 others error[E0277]: cannot subtract `Option<{integer}>` from `usize` @@ -28,10 +24,6 @@ LL | 2 as usize - Some(1); <&usize as Sub<&usize>> > - <&'a f32 as Sub> - <&'a f64 as Sub> - <&'a i128 as Sub> - <&'a i16 as Sub> and 48 others error[E0277]: cannot multiply `{integer}` by `()` @@ -46,10 +38,6 @@ LL | 3 * (); <&'a f64 as Mul> <&'a i128 as Mul> <&'a i16 as Mul> - <&'a i32 as Mul> - <&'a i64 as Mul> - <&'a i8 as Mul> - <&'a isize as Mul> and 49 others error[E0277]: cannot divide `{integer}` by `&str` @@ -64,10 +52,6 @@ LL | 4 / ""; <&'a f64 as Div> <&'a i128 as Div> <&'a i16 as Div> - <&'a i32 as Div> - <&'a i64 as Div> - <&'a i8 as Div> - <&'a isize as Div> and 54 others error[E0277]: can't compare `{integer}` with `String` @@ -82,10 +66,6 @@ LL | 5 < String::new(); - - - - and 6 others error[E0277]: can't compare `{integer}` with `Result<{integer}, _>` @@ -100,10 +80,6 @@ LL | 6 == Ok(1); - - - - and 6 others error: aborting due to 6 previous errors diff --git a/src/test/ui/never_type/issue-13352.stderr b/src/test/ui/never_type/issue-13352.stderr index cfb5d28e7674b..12a6d7962f46b 100644 --- a/src/test/ui/never_type/issue-13352.stderr +++ b/src/test/ui/never_type/issue-13352.stderr @@ -10,10 +10,6 @@ LL | 2_usize + (loop {}); <&usize as Add<&usize>> > - <&'a f32 as Add> - <&'a f64 as Add> - <&'a i128 as Add> - <&'a i16 as Add> and 48 others error: aborting due to previous error diff --git a/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr b/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr index 431cbf81b01bd..d8bba1509d868 100644 --- a/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr +++ b/src/test/ui/numbers-arithmetic/not-suggest-float-literal.stderr @@ -10,10 +10,6 @@ LL | x + 100.0 <&u8 as Add<&u8>> > - <&'a f32 as Add> - <&'a f64 as Add> - <&'a i128 as Add> - <&'a i16 as Add> and 48 others error[E0277]: cannot add `&str` to `f64` @@ -28,10 +24,6 @@ LL | x + "foo" <&f64 as Add<&f64>> > - <&'a f32 as Add> - <&'a i128 as Add> - <&'a i16 as Add> - <&'a i32 as Add> and 48 others error[E0277]: cannot add `{integer}` to `f64` @@ -46,10 +38,6 @@ LL | x + y <&f64 as Add<&f64>> > - <&'a f32 as Add> - <&'a i128 as Add> - <&'a i16 as Add> - <&'a i32 as Add> and 48 others error[E0277]: cannot subtract `{float}` from `u8` @@ -64,10 +52,6 @@ LL | x - 100.0 <&u8 as Sub<&u8>> > - <&'a f32 as Sub> - <&'a f64 as Sub> - <&'a i128 as Sub> - <&'a i16 as Sub> and 48 others error[E0277]: cannot subtract `&str` from `f64` @@ -82,10 +66,6 @@ LL | x - "foo" <&f64 as Sub<&f64>> > - <&'a f32 as Sub> - <&'a i128 as Sub> - <&'a i16 as Sub> - <&'a i32 as Sub> and 48 others error[E0277]: cannot subtract `{integer}` from `f64` @@ -100,10 +80,6 @@ LL | x - y <&f64 as Sub<&f64>> > - <&'a f32 as Sub> - <&'a i128 as Sub> - <&'a i16 as Sub> - <&'a i32 as Sub> and 48 others error[E0277]: cannot multiply `u8` by `{float}` @@ -118,10 +94,6 @@ LL | x * 100.0 <&u8 as Mul<&u8>> > - <&'a f32 as Mul> - <&'a f64 as Mul> - <&'a i128 as Mul> - <&'a i16 as Mul> and 49 others error[E0277]: cannot multiply `f64` by `&str` @@ -136,10 +108,6 @@ LL | x * "foo" <&f64 as Mul<&f64>> > - <&'a f32 as Mul> - <&'a i128 as Mul> - <&'a i16 as Mul> - <&'a i32 as Mul> and 49 others error[E0277]: cannot multiply `f64` by `{integer}` @@ -154,10 +122,6 @@ LL | x * y <&f64 as Mul<&f64>> > - <&'a f32 as Mul> - <&'a i128 as Mul> - <&'a i16 as Mul> - <&'a i32 as Mul> and 49 others error[E0277]: cannot divide `u8` by `{float}` @@ -172,10 +136,6 @@ LL | x / 100.0 <&u8 as Div<&u8>> > > - - <&'a f32 as Div> - <&'a f64 as Div> - <&'a i128 as Div> and 54 others error[E0277]: cannot divide `f64` by `&str` @@ -190,10 +150,6 @@ LL | x / "foo" <&f64 as Div<&f64>> > - <&'a f32 as Div> - <&'a i128 as Div> - <&'a i16 as Div> - <&'a i32 as Div> and 54 others error[E0277]: cannot divide `f64` by `{integer}` @@ -208,10 +164,6 @@ LL | x / y <&f64 as Div<&f64>> > - <&'a f32 as Div> - <&'a i128 as Div> - <&'a i16 as Div> - <&'a i32 as Div> and 54 others error: aborting due to 12 previous errors diff --git a/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr b/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr index 543e3137fdd09..b7591dfca99b3 100644 --- a/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr +++ b/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr @@ -10,10 +10,6 @@ LL | x + 100 <&f32 as Add<&f32>> > - <&'a f64 as Add> - <&'a i128 as Add> - <&'a i16 as Add> - <&'a i32 as Add> and 48 others help: consider using a floating-point literal by writing it with `.0` | @@ -32,10 +28,6 @@ LL | x + 100 <&f64 as Add<&f64>> > - <&'a f32 as Add> - <&'a i128 as Add> - <&'a i16 as Add> - <&'a i32 as Add> and 48 others help: consider using a floating-point literal by writing it with `.0` | @@ -54,10 +46,6 @@ LL | x - 100 <&f32 as Sub<&f32>> > - <&'a f64 as Sub> - <&'a i128 as Sub> - <&'a i16 as Sub> - <&'a i32 as Sub> and 48 others help: consider using a floating-point literal by writing it with `.0` | @@ -76,10 +64,6 @@ LL | x - 100 <&f64 as Sub<&f64>> > - <&'a f32 as Sub> - <&'a i128 as Sub> - <&'a i16 as Sub> - <&'a i32 as Sub> and 48 others help: consider using a floating-point literal by writing it with `.0` | @@ -98,10 +82,6 @@ LL | x * 100 <&f32 as Mul<&f32>> > - <&'a f64 as Mul> - <&'a i128 as Mul> - <&'a i16 as Mul> - <&'a i32 as Mul> and 49 others help: consider using a floating-point literal by writing it with `.0` | @@ -120,10 +100,6 @@ LL | x * 100 <&f64 as Mul<&f64>> > - <&'a f32 as Mul> - <&'a i128 as Mul> - <&'a i16 as Mul> - <&'a i32 as Mul> and 49 others help: consider using a floating-point literal by writing it with `.0` | @@ -142,10 +118,6 @@ LL | x / 100 <&f32 as Div<&f32>> > - <&'a f64 as Div> - <&'a i128 as Div> - <&'a i16 as Div> - <&'a i32 as Div> and 54 others help: consider using a floating-point literal by writing it with `.0` | @@ -164,10 +136,6 @@ LL | x / 100 <&f64 as Div<&f64>> > - <&'a f32 as Div> - <&'a i128 as Div> - <&'a i16 as Div> - <&'a i32 as Div> and 54 others help: consider using a floating-point literal by writing it with `.0` | diff --git a/src/test/ui/span/multiline-span-simple.stderr b/src/test/ui/span/multiline-span-simple.stderr index dee457ebd7f3f..1542832f0129c 100644 --- a/src/test/ui/span/multiline-span-simple.stderr +++ b/src/test/ui/span/multiline-span-simple.stderr @@ -10,10 +10,6 @@ LL | foo(1 as u32 + <&u32 as Add<&u32>> > - <&'a f32 as Add> - <&'a f64 as Add> - <&'a i128 as Add> - <&'a i16 as Add> and 48 others error: aborting due to previous error diff --git a/src/test/ui/suggestions/into-str.stderr b/src/test/ui/suggestions/into-str.stderr index 88a0f8f065027..4bdea05b06b8d 100644 --- a/src/test/ui/suggestions/into-str.stderr +++ b/src/test/ui/suggestions/into-str.stderr @@ -12,8 +12,6 @@ LL | foo(String::new()); > > >> - >> - > = note: required because of the requirements on the impl of `Into<&str>` for `String` note: required by a bound in `foo` --> $DIR/into-str.rs:1:31 diff --git a/src/test/ui/try-trait/bad-interconversion.stderr b/src/test/ui/try-trait/bad-interconversion.stderr index 6567eca38c81d..fc2692a9a9313 100644 --- a/src/test/ui/try-trait/bad-interconversion.stderr +++ b/src/test/ui/try-trait/bad-interconversion.stderr @@ -12,10 +12,6 @@ LL | Ok(Err(123_i32)?) > > > - > - > - > - > and 67 others = note: required because of the requirements on the impl of `FromResidual>` for `Result` diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index 15bbfeb87c6f3..80ff068ff309a 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -70,10 +70,6 @@ LL | trait ProjectionPred> where T::Item : Add {} <&i32 as Add<&i32>> > - <&'a f32 as Add> - <&'a f64 as Add> - <&'a i128 as Add> - <&'a i16 as Add> and 48 others error: aborting due to 7 previous errors diff --git a/src/test/ui/typeck/issue-81293.stderr b/src/test/ui/typeck/issue-81293.stderr index 9e2d8a6159c48..0a5ec56e91512 100644 --- a/src/test/ui/typeck/issue-81293.stderr +++ b/src/test/ui/typeck/issue-81293.stderr @@ -25,10 +25,6 @@ LL | a = c + b * 5; <&usize as Add<&usize>> > - <&'a f32 as Add> - <&'a f64 as Add> - <&'a i128 as Add> - <&'a i16 as Add> and 48 others error: aborting due to 3 previous errors diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr index 64da15c505536..c769a0df7c891 100644 --- a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -10,10 +10,6 @@ LL | >::add(1, 2); <&i32 as Add<&i32>> > - <&'a f32 as Add> - <&'a f64 as Add> - <&'a i128 as Add> - <&'a i16 as Add> and 48 others error[E0308]: mismatched types From 3e15b9281143b70a8fd6457ee7531eebfb15274b Mon Sep 17 00:00:00 2001 From: Dylan DPC Date: Tue, 5 Apr 2022 23:23:42 +0200 Subject: [PATCH 6/7] Revert "Suggest dereferncing when possible in E0277, fix #87437" This reverts commit 883b93c7b7eb02ec85f4b8f9fb129efc403d4fb2. --- .../src/traits/error_reporting/suggestions.rs | 104 +++++++----------- .../suggest-deferences/issue-39029.stderr | 2 +- .../suggest-deferences/issue-62530.stderr | 2 +- .../suggest-deferences/multiple-0.stderr | 2 +- .../suggest-deferences/root-obligation.fixed | 14 --- .../suggest-deferences/root-obligation.rs | 14 --- .../suggest-deferences/root-obligation.stderr | 24 ---- 7 files changed, 41 insertions(+), 121 deletions(-) delete mode 100644 src/test/ui/traits/suggest-deferences/root-obligation.fixed delete mode 100644 src/test/ui/traits/suggest-deferences/root-obligation.rs delete mode 100644 src/test/ui/traits/suggest-deferences/root-obligation.stderr diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index fa887536b0e2b..1f211c2be7596 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -1,6 +1,6 @@ use super::{ - DerivedObligationCause, EvaluationResult, ImplDerivedObligationCause, Obligation, - ObligationCause, ObligationCauseCode, PredicateObligation, SelectionContext, + EvaluationResult, Obligation, ObligationCause, ObligationCauseCode, PredicateObligation, + SelectionContext, }; use crate::autoderef::Autoderef; @@ -504,78 +504,50 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { trait_pred: ty::PolyTraitPredicate<'tcx>, ) -> bool { // It only make sense when suggesting dereferences for arguments - let ObligationCauseCode::FunctionArgumentObligation { .. } = obligation.cause.code() else { + let code = if let ObligationCauseCode::FunctionArgumentObligation { parent_code, .. } = + obligation.cause.code() + { + parent_code.clone() + } else { return false; }; let param_env = obligation.param_env; let body_id = obligation.cause.body_id; let span = obligation.cause.span; - let mut real_trait_pred = trait_pred; - let mut code = obligation.cause.code(); - loop { - match &code { - ObligationCauseCode::FunctionArgumentObligation { parent_code, .. } => { - code = &parent_code; - } - ObligationCauseCode::ImplDerivedObligation(box ImplDerivedObligationCause { - derived: DerivedObligationCause { parent_code, parent_trait_pred }, - .. - }) - | ObligationCauseCode::BuiltinDerivedObligation(DerivedObligationCause { - parent_code, - parent_trait_pred, - }) - | ObligationCauseCode::DerivedObligation(DerivedObligationCause { - parent_code, - parent_trait_pred, - }) => { - code = &parent_code; - real_trait_pred = *parent_trait_pred; - } - _ => break, - }; - let Some(real_ty) = real_trait_pred.self_ty().no_bound_vars() else { - continue; - }; + let real_trait_pred = match &*code { + ObligationCauseCode::ImplDerivedObligation(cause) => cause.derived.parent_trait_pred, + ObligationCauseCode::DerivedObligation(cause) + | ObligationCauseCode::BuiltinDerivedObligation(cause) => cause.parent_trait_pred, + _ => trait_pred, + }; + let Some(real_ty) = real_trait_pred.self_ty().no_bound_vars() else { + return false; + }; - if let ty::Ref(region, base_ty, mutbl) = *real_ty.kind() { - let mut autoderef = Autoderef::new(self, param_env, body_id, span, base_ty, span); - if let Some(steps) = autoderef.find_map(|(ty, steps)| { - // Re-add the `&` - let ty = self.tcx.mk_ref(region, TypeAndMut { ty, mutbl }); - let obligation = - self.mk_trait_obligation_with_new_self_ty(param_env, real_trait_pred, ty); - Some(steps).filter(|_| self.predicate_may_hold(&obligation)) - }) { - if steps > 0 { - if let Ok(src) = self.tcx.sess.source_map().span_to_snippet(span) { - // Don't care about `&mut` because `DerefMut` is used less - // often and user will not expect autoderef happens. - if src.starts_with('&') && !src.starts_with("&mut ") { - let derefs = "*".repeat(steps); - err.span_suggestion( - span, - "consider dereferencing here", - format!("&{}{}", derefs, &src[1..]), - Applicability::MachineApplicable, - ); - return true; - } + if let ty::Ref(region, base_ty, mutbl) = *real_ty.kind() { + let mut autoderef = Autoderef::new(self, param_env, body_id, span, base_ty, span); + if let Some(steps) = autoderef.find_map(|(ty, steps)| { + // Re-add the `&` + let ty = self.tcx.mk_ref(region, TypeAndMut { ty, mutbl }); + let obligation = + self.mk_trait_obligation_with_new_self_ty(param_env, real_trait_pred, ty); + Some(steps).filter(|_| self.predicate_may_hold(&obligation)) + }) { + if steps > 0 { + if let Ok(src) = self.tcx.sess.source_map().span_to_snippet(span) { + // Don't care about `&mut` because `DerefMut` is used less + // often and user will not expect autoderef happens. + if src.starts_with('&') && !src.starts_with("&mut ") { + let derefs = "*".repeat(steps); + err.span_suggestion( + span, + "consider adding dereference here", + format!("&{}{}", derefs, &src[1..]), + Applicability::MachineApplicable, + ); + return true; } } - } else if real_trait_pred != trait_pred { - // This branch addresses #87437. - let obligation = - self.mk_trait_obligation_with_new_self_ty(param_env, real_trait_pred, base_ty); - if self.predicate_may_hold(&obligation) { - err.span_suggestion_verbose( - span.shrink_to_lo(), - "consider dereferencing here", - "*".to_string(), - Applicability::MachineApplicable, - ); - return true; - } } } } diff --git a/src/test/ui/traits/suggest-deferences/issue-39029.stderr b/src/test/ui/traits/suggest-deferences/issue-39029.stderr index 5c324cd38a3ab..2c225f4311d01 100644 --- a/src/test/ui/traits/suggest-deferences/issue-39029.stderr +++ b/src/test/ui/traits/suggest-deferences/issue-39029.stderr @@ -5,7 +5,7 @@ LL | let _errors = TcpListener::bind(&bad); | ----------------- ^^^^ | | | | | the trait `ToSocketAddrs` is not implemented for `NoToSocketAddrs` - | | help: consider dereferencing here: `&*bad` + | | help: consider adding dereference here: `&*bad` | required by a bound introduced by this call | = note: required because of the requirements on the impl of `ToSocketAddrs` for `&NoToSocketAddrs` diff --git a/src/test/ui/traits/suggest-deferences/issue-62530.stderr b/src/test/ui/traits/suggest-deferences/issue-62530.stderr index d129328dae8ef..b77af7ddf4746 100644 --- a/src/test/ui/traits/suggest-deferences/issue-62530.stderr +++ b/src/test/ui/traits/suggest-deferences/issue-62530.stderr @@ -5,7 +5,7 @@ LL | takes_type_parameter(&string); // Error | -------------------- ^^^^^^^ | | | | | the trait `SomeTrait` is not implemented for `&String` - | | help: consider dereferencing here: `&*string` + | | help: consider adding dereference here: `&*string` | required by a bound introduced by this call | note: required by a bound in `takes_type_parameter` diff --git a/src/test/ui/traits/suggest-deferences/multiple-0.stderr b/src/test/ui/traits/suggest-deferences/multiple-0.stderr index efb3c7d123f70..bf9f85f1b4595 100644 --- a/src/test/ui/traits/suggest-deferences/multiple-0.stderr +++ b/src/test/ui/traits/suggest-deferences/multiple-0.stderr @@ -5,7 +5,7 @@ LL | foo(&baz); | --- ^^^^ | | | | | the trait `Happy` is not implemented for `&Baz` - | | help: consider dereferencing here: `&***baz` + | | help: consider adding dereference here: `&***baz` | required by a bound introduced by this call | note: required by a bound in `foo` diff --git a/src/test/ui/traits/suggest-deferences/root-obligation.fixed b/src/test/ui/traits/suggest-deferences/root-obligation.fixed deleted file mode 100644 index 9fd1924067827..0000000000000 --- a/src/test/ui/traits/suggest-deferences/root-obligation.fixed +++ /dev/null @@ -1,14 +0,0 @@ -// run-rustfix - -fn get_vowel_count(string: &str) -> usize { - string - .chars() - .filter(|c| "aeiou".contains(*c)) - //~^ ERROR expected a `Fn<(char,)>` closure, found `char` - .count() -} - -fn main() { - let _ = get_vowel_count("asdf"); -} - diff --git a/src/test/ui/traits/suggest-deferences/root-obligation.rs b/src/test/ui/traits/suggest-deferences/root-obligation.rs deleted file mode 100644 index 4dd0291b62970..0000000000000 --- a/src/test/ui/traits/suggest-deferences/root-obligation.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-rustfix - -fn get_vowel_count(string: &str) -> usize { - string - .chars() - .filter(|c| "aeiou".contains(c)) - //~^ ERROR expected a `Fn<(char,)>` closure, found `char` - .count() -} - -fn main() { - let _ = get_vowel_count("asdf"); -} - diff --git a/src/test/ui/traits/suggest-deferences/root-obligation.stderr b/src/test/ui/traits/suggest-deferences/root-obligation.stderr deleted file mode 100644 index 16e03e79c7571..0000000000000 --- a/src/test/ui/traits/suggest-deferences/root-obligation.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0277]: expected a `Fn<(char,)>` closure, found `char` - --> $DIR/root-obligation.rs:6:38 - | -LL | .filter(|c| "aeiou".contains(c)) - | -------- ^ expected an `Fn<(char,)>` closure, found `char` - | | - | required by a bound introduced by this call - | - = help: the trait `Fn<(char,)>` is not implemented for `char` - = note: required because of the requirements on the impl of `FnOnce<(char,)>` for `&char` - = note: required because of the requirements on the impl of `Pattern<'_>` for `&char` -note: required by a bound in `core::str::::contains` - --> $SRC_DIR/core/src/str/mod.rs:LL:COL - | -LL | pub fn contains<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool { - | ^^^^^^^^^^^ required by this bound in `core::str::::contains` -help: consider dereferencing here - | -LL | .filter(|c| "aeiou".contains(*c)) - | + - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`. From ecb0a11c3c54d34ea5891883584d6842fc82c8ce Mon Sep 17 00:00:00 2001 From: Dylan DPC Date: Tue, 5 Apr 2022 23:23:44 +0200 Subject: [PATCH 7/7] Revert "Fix #90970, doesn't address #87437" This reverts commit ac8cbbd200cfa77f03a8560f0305810e4f8f1375. --- .../src/traits/error_reporting/mod.rs | 79 ++----------------- .../generic_const_exprs/issue-85848.stderr | 1 - .../cross-return-site-inference.stderr | 1 - .../ui/impl-trait/nested_impl_trait.stderr | 2 - src/test/ui/issues/issue-32709.stderr | 1 - .../ui/kindck/kindck-impl-type-params.stderr | 2 - .../bound/assoc-fn-bound-root-obligation.rs | 12 --- .../assoc-fn-bound-root-obligation.stderr | 23 ------ 8 files changed, 6 insertions(+), 115 deletions(-) delete mode 100644 src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs delete mode 100644 src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index db811bf9ccccf..86ac639f71b06 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -2,11 +2,10 @@ pub mod on_unimplemented; pub mod suggestions; use super::{ - DerivedObligationCause, EvaluationResult, FulfillmentContext, FulfillmentError, - FulfillmentErrorCode, ImplDerivedObligationCause, MismatchedProjectionTypes, Obligation, - ObligationCause, ObligationCauseCode, OnUnimplementedDirective, OnUnimplementedNote, - OutputTypeParameterMismatch, Overflow, PredicateObligation, SelectionContext, SelectionError, - TraitNotObjectSafe, + EvaluationResult, FulfillmentContext, FulfillmentError, FulfillmentErrorCode, + MismatchedProjectionTypes, Obligation, ObligationCause, ObligationCauseCode, + OnUnimplementedDirective, OnUnimplementedNote, OutputTypeParameterMismatch, Overflow, + PredicateObligation, SelectionContext, SelectionError, TraitNotObjectSafe, }; use crate::infer::error_reporting::{TyCategory, TypeAnnotationNeeded as ErrorCode}; @@ -661,77 +660,11 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { } else if !suggested { // Can't show anything else useful, try to find similar impls. let impl_candidates = self.find_similar_impl_candidates(trait_ref); - if !self.report_similar_impl_candidates( + self.report_similar_impl_candidates( impl_candidates, trait_ref, &mut err, - ) { - // This is *almost* equivalent to - // `obligation.cause.code().peel_derives()`, but it gives us the - // trait predicate for that corresponding root obligation. This - // lets us get a derived obligation from a type parameter, like - // when calling `string.strip_suffix(p)` where `p` is *not* an - // implementer of `Pattern<'_>`. - let mut code = obligation.cause.code(); - let mut trait_pred = trait_predicate; - let mut peeled = false; - loop { - match &*code { - ObligationCauseCode::FunctionArgumentObligation { - parent_code, - .. - } => { - code = &parent_code; - } - ObligationCauseCode::ImplDerivedObligation( - box ImplDerivedObligationCause { - derived: - DerivedObligationCause { - parent_code, - parent_trait_pred, - }, - .. - }, - ) - | ObligationCauseCode::BuiltinDerivedObligation( - DerivedObligationCause { - parent_code, - parent_trait_pred, - }, - ) - | ObligationCauseCode::DerivedObligation( - DerivedObligationCause { - parent_code, - parent_trait_pred, - }, - ) => { - peeled = true; - code = &parent_code; - trait_pred = *parent_trait_pred; - } - _ => break, - }; - } - let def_id = trait_pred.def_id(); - // Mention *all* the `impl`s for the *top most* obligation, the - // user might have meant to use one of them, if any found. We skip - // auto-traits or fundamental traits that might not be exactly what - // the user might expect to be presented with. Instead this is - // useful for less general traits. - if peeled - && !self.tcx.trait_is_auto(def_id) - && !self.tcx.lang_items().items().contains(&Some(def_id)) - { - let trait_ref = trait_pred.to_poly_trait_ref(); - let impl_candidates = - self.find_similar_impl_candidates(trait_ref); - self.report_similar_impl_candidates( - impl_candidates, - trait_ref, - &mut err, - ); - } - } + ); } // Changing mutability doesn't make a difference to whether we have diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr index 27f5dce9fb266..4202cbae7eb29 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr @@ -6,7 +6,6 @@ LL | writes_to_specific_path(&cap); | | | required by a bound introduced by this call | - = help: the trait `Delegates` is implemented for `T` note: required because of the requirements on the impl of `Contains<(), true>` for `&C` --> $DIR/issue-85848.rs:21:12 | diff --git a/src/test/ui/impl-trait/cross-return-site-inference.stderr b/src/test/ui/impl-trait/cross-return-site-inference.stderr index d458c7be783d5..06afb938c5fad 100644 --- a/src/test/ui/impl-trait/cross-return-site-inference.stderr +++ b/src/test/ui/impl-trait/cross-return-site-inference.stderr @@ -7,7 +7,6 @@ LL | Err("whoops")?; | ^ the trait `From<&str>` is not implemented for `impl Debug` | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait - = help: the trait `FromResidual>` is implemented for `Result` = note: required because of the requirements on the impl of `FromResidual>` for `Result<(), impl Debug>` error[E0277]: the trait bound `impl Debug: From<&str>` is not satisfied diff --git a/src/test/ui/impl-trait/nested_impl_trait.stderr b/src/test/ui/impl-trait/nested_impl_trait.stderr index bb4ae5e828254..26b48c7cdf718 100644 --- a/src/test/ui/impl-trait/nested_impl_trait.stderr +++ b/src/test/ui/impl-trait/nested_impl_trait.stderr @@ -52,7 +52,6 @@ error[E0277]: the trait bound `impl Debug: From>` is not satisfie LL | fn bad_in_ret_position(x: impl Into) -> impl Into { x } | ^^^^^^^^^^^^^^^^^^^^^ the trait `From>` is not implemented for `impl Debug` | - = help: the trait `Into` is implemented for `T` = note: required because of the requirements on the impl of `Into` for `impl Into` error[E0277]: the trait bound `impl Debug: From>` is not satisfied @@ -61,7 +60,6 @@ error[E0277]: the trait bound `impl Debug: From>` is not satisfie LL | fn bad(x: impl Into) -> impl Into { x } | ^^^^^^^^^^^^^^^^^^^^^ the trait `From>` is not implemented for `impl Debug` | - = help: the trait `Into` is implemented for `T` = note: required because of the requirements on the impl of `Into` for `impl Into` error: aborting due to 8 previous errors diff --git a/src/test/ui/issues/issue-32709.stderr b/src/test/ui/issues/issue-32709.stderr index ed5addcbec517..b4c3f148e32b5 100644 --- a/src/test/ui/issues/issue-32709.stderr +++ b/src/test/ui/issues/issue-32709.stderr @@ -7,7 +7,6 @@ LL | Err(5)?; | ^ the trait `From<{integer}>` is not implemented for `()` | = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait - = help: the trait `FromResidual>` is implemented for `Result` = note: required because of the requirements on the impl of `FromResidual>` for `Result` error: aborting due to previous error diff --git a/src/test/ui/kindck/kindck-impl-type-params.stderr b/src/test/ui/kindck/kindck-impl-type-params.stderr index 64bbc841b330f..3558f0c9e6294 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.stderr +++ b/src/test/ui/kindck/kindck-impl-type-params.stderr @@ -80,7 +80,6 @@ error[E0277]: the trait bound `String: Copy` is not satisfied LL | let a = t as Box>; | ^ the trait `Copy` is not implemented for `String` | - = help: the trait `Gettable` is implemented for `S` note: required because of the requirements on the impl of `Gettable` for `S` --> $DIR/kindck-impl-type-params.rs:14:32 | @@ -94,7 +93,6 @@ error[E0277]: the trait bound `Foo: Copy` is not satisfied LL | let a: Box> = t; | ^ the trait `Copy` is not implemented for `Foo` | - = help: the trait `Gettable` is implemented for `S` note: required because of the requirements on the impl of `Gettable` for `S` --> $DIR/kindck-impl-type-params.rs:14:32 | diff --git a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs deleted file mode 100644 index 2720f94a3c191..0000000000000 --- a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs +++ /dev/null @@ -1,12 +0,0 @@ -fn strip_lf(s: &str) -> &str { - s.strip_suffix(b'\n').unwrap_or(s) - //~^ ERROR expected a `FnMut<(char,)>` closure, found `u8` - //~| NOTE expected an `FnMut<(char,)>` closure, found `u8` - //~| NOTE required by a bound introduced by this call - //~| HELP the trait `FnMut<(char,)>` is not implemented for `u8` - //~| HELP the following other types implement trait `Pattern<'_>`: - //~| NOTE required because of the requirements on the impl of `Pattern<'_>` for `u8` - -} - -fn main() {} diff --git a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr deleted file mode 100644 index 37cba4189d725..0000000000000 --- a/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.stderr +++ /dev/null @@ -1,23 +0,0 @@ -error[E0277]: expected a `FnMut<(char,)>` closure, found `u8` - --> $DIR/assoc-fn-bound-root-obligation.rs:2:20 - | -LL | s.strip_suffix(b'\n').unwrap_or(s) - | ------------ ^^^^^ expected an `FnMut<(char,)>` closure, found `u8` - | | - | required by a bound introduced by this call - | - = help: the trait `FnMut<(char,)>` is not implemented for `u8` - = help: the following other types implement trait `Pattern<'_>`: - &'b String - &'b [char; N] - &'b [char] - &'b str - &'c &'b str - [char; N] - char - pattern::MultiCharEqPattern - = note: required because of the requirements on the impl of `Pattern<'_>` for `u8` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0277`.