From ef91519b45d2bbf0ce8c0180118160562eaaa0ca Mon Sep 17 00:00:00 2001 From: Esteban Kuber Date: Sun, 27 Mar 2022 01:49:01 +0000 Subject: [PATCH] Dedup logic and improve output for other types that impl trait --- .../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, 363 insertions(+), 357 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 fdafb2d3d417e..09b445058c0d3 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, Ty, TyCtxt, TypeFoldable, + self, SubtypePredicate, ToPolyTraitRef, ToPredicate, TraitRef, Ty, TyCtxt, TypeFoldable, }; use rustc_span::symbol::{kw, sym}; use rustc_span::{ExpnKind, MultiSpan, Span, DUMMY_SP}; @@ -1756,6 +1756,60 @@ 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) @@ -1765,7 +1819,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { // Mentioning implementers of `Copy`, `Debug` and friends is not useful. return false; } - let mut normalized_impl_candidates: Vec<_> = self + let normalized_impl_candidates: Vec<_> = self .tcx .all_impls(def_id) // Ignore automatically derived impls and `!Trait` impls. @@ -1776,45 +1830,10 @@ 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(); - 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; + return report(normalized_impl_candidates, err); } - 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 @@ -1822,8 +1841,8 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { .normalize(candidate) .ok(); match normalized { - Some(normalized) => format!("\n {}", normalized.value), - None => format!("\n {}", candidate), + Some(normalized) => normalized.value, + None => candidate, } }) }; @@ -1834,7 +1853,6 @@ 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 }| { @@ -1850,26 +1868,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { .map(|(_, normalized)| normalized) .collect::>(); - 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 + report(normalized_impl_candidates, err) } /// 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 b369c73387198..16ecca254c7b0 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -557,8 +557,11 @@ 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 715e52b41e75c..453333fb56a87 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 implementations were found: - <&'a i32 as Mul> - <&i32 as Mul<&i32>> - > - + = help: the following other types implement trait `Mul`: <&'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 16b06a0198b27..95ee51a88261a 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 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> + = 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 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..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 implementations were found: + = 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 implementations were found: + = 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 implementations were found: + = 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/chalkify/chalk_initial_program.stderr b/src/test/ui/chalkify/chalk_initial_program.stderr index 7b0b3f85b3915..343c0a31862b9 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 implementations were found: - - + = help: the following other types implement trait `Foo`: + i32 + u32 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 14d43c1474c57..508a6dd1388cb 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 implementations were found: - - + = help: the following other types implement trait `Bar`: + i32 + u32 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 9cadc4110e1e6..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 implementations were found: + = help: the following other types implement trait `Traitor`: > > @@ -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 implementations were found: - > + = help: the following other types implement trait `Traitor`: > + > 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 fcbb41bb4fcc4..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 implementations were found: + = 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/const-generics/issues/issue-67185-2.stderr b/src/test/ui/const-generics/issues/issue-67185-2.stderr index 89aa3d395e25b..c7be8e14a10d5 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 implementations were found: - <[[u16; 3]; 3] as Bar> - <[u16; 4] as Bar> + = help: the following other types implement trait `Bar`: + [[u16; 3]; 3] + [u16; 4] = 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 implementations were found: - <[[u16; 3]; 3] as Bar> - <[u16; 4] as Bar> + = help: the following other types implement trait `Bar`: + [[u16; 3]; 3] + [u16; 4] = 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 implementations were found: - <[[u16; 3]; 3] as Bar> - <[u16; 4] as Bar> + = help: the following other types implement trait `Bar`: + [[u16; 3]; 3] + [u16; 4] 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 implementations were found: - <[[u16; 3]; 3] as Bar> - <[u16; 4] as Bar> + = help: the following other types implement trait `Bar`: + [[u16; 3]; 3] + [u16; 4] 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 implementations were found: - <[[u16; 3]; 3] as Bar> - <[u16; 4] as Bar> + = help: the following other types implement trait `Bar`: + [[u16; 3]; 3] + [u16; 4] 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 implementations were found: - <[[u16; 3]; 3] as Bar> - <[u16; 4] as Bar> + = help: the following other types implement trait `Bar`: + [[u16; 3]; 3] + [u16; 4] 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 aedf44658db63..8431d989278ba 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<{ 6 + 1 }>` + = help: the trait `Bar` is implemented for `A<7_usize>` 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 d2d68506d4e1c..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,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 implementations were found: - <&'a i8 as Add> - <&i8 as Add<&i8>> - > - + = help: the following other types implement trait `Add`: <&'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 818e3bc15b19d..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,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 implementations were found: - <&'a i8 as Add> - <&i8 as Add<&i8>> - > - + = help: the following other types implement trait `Add`: <&'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 45459b931caac..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 implementations were found: + = 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 8aedb4229e6d3..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 implementations were found: + = 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 f25c7ce00e548..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 implementations were found: + = 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 3aa863e900f4a..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 implementations were found: + = help: the following other types implement trait `Foo`: > > > @@ -25,16 +25,16 @@ LL | Foo::::bar(&1u8); | | | required by a bound introduced by this call | - = help: the following implementations were found: - > - > - > - > + = help: the following other types implement trait `Foo`: > > > > > + > + > + > + > 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 implementations were found: + = 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 bd9d9e086e044..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 implementations were found: + = 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/generic-associated-types/bugs/issue-88460.stderr b/src/test/ui/generic-associated-types/bugs/issue-88460.stderr index ec8de15dc3957..98c304cc90b53 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 `for<'a> Marker` is implemented for `()` + = help: the trait `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 9137183375aca..48cfcb4ad3e0a 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 implementations were found: - <&'a u32 as Add> - <&u32 as Add<&u32>> - > - + = help: the following other types implement trait `Add`: <&'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 019677775987e..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 implementations were found: + = 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 implementations were found: + = 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 364fbbc981e64..1fa2d356c68ef 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 implementations were found: - <&'a f64 as Sub> - <&f64 as Sub<&f64>> - > - + = help: the following other types implement trait `Sub`: <&'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 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..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 implementations were found: + = 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-59488.stderr b/src/test/ui/issues/issue-59488.stderr index c61d44bf89526..76a47c49bbafb 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 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> + = 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 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..1c61c85368be9 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 implementations were found: - - - - - - - - + = help: the following other types implement trait `Copy`: + f32 + f64 + i128 + i16 + i32 + i64 + i8 + isize 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 implementations were found: - - - - - - - - + = help: the following other types implement trait `Copy`: + f32 + f64 + i128 + i16 + i32 + i64 + i8 + 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..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,15 +38,15 @@ LL | if x == y {} | ^^ no implementation for `&str == char` | = help: the trait `PartialEq` is not implemented for `&str` - = help: the following implementations were found: + = help: the following other types implement trait `PartialEq>`: <&'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 implementations were found: + = help: the following other types implement trait `PartialEq>`: <&'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 843ae5044c37a..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 implementations were found: + = help: the following other types implement trait `Add`: <&'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 implementations were found: - <&'a usize as Sub> - <&usize as Sub<&usize>> - > - + = help: the following other types implement trait `Sub`: <&'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 implementations were found: + = 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 implementations were found: + = help: the following other types implement trait `Div`: <&'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 implementations were found: - - - - - - - - + = help: the following other types implement trait `PartialOrd`: + f32 + f64 + i128 + i16 + i32 + i64 + i8 + isize 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 implementations were found: - - - - - - - - + = help: the following other types implement trait `PartialEq`: + f32 + f64 + i128 + i16 + i32 + i64 + i8 + isize 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..449b0756012de 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 implementations were found: - <&'a usize as Add> - <&usize as Add<&usize>> - > - + = help: the following other types implement trait `Add`: <&'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 431cbf81b01bd..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,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 implementations were found: - <&'a u8 as Add> - <&u8 as Add<&u8>> - > - + = help: the following other types implement trait `Add`: <&'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 implementations were found: - <&'a f64 as Add> - <&f64 as Add<&f64>> - > - + = help: the following other types implement trait `Add`: <&'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 `{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 implementations were found: - <&'a f64 as Add> - <&f64 as Add<&f64>> - > - + = help: the following other types implement trait `Add`: <&'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 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 implementations were found: - <&'a u8 as Sub> - <&u8 as Sub<&u8>> - > - + = help: the following other types implement trait `Sub`: <&'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 implementations were found: - <&'a f64 as Sub> - <&f64 as Sub<&f64>> - > - + = help: the following other types implement trait `Sub`: <&'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 `{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 implementations were found: - <&'a f64 as Sub> - <&f64 as Sub<&f64>> - > - + = help: the following other types implement trait `Sub`: <&'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 `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 implementations were found: - <&'a u8 as Mul> - <&u8 as Mul<&u8>> - > - + = help: the following other types implement trait `Mul`: <&'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 implementations were found: - <&'a f64 as Mul> - <&f64 as Mul<&f64>> - > - + = help: the following other types implement trait `Mul`: <&'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 `{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 implementations were found: - <&'a f64 as Mul> - <&f64 as Mul<&f64>> - > - + = help: the following other types implement trait `Mul`: <&'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 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 implementations were found: - <&'a u8 as Div> - <&u8 as Div<&u8>> - > - > - + = help: the following other types implement trait `Div`: <&'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 implementations were found: - <&'a f64 as Div> - <&f64 as Div<&f64>> - > - + = help: the following other types implement trait `Div`: <&'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 `{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 implementations were found: - <&'a f64 as Div> - <&f64 as Div<&f64>> - > - + = help: the following other types implement trait `Div`: <&'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: 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..fd3996416b67a 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 implementations were found: + = help: the following other types implement trait `Add`: <&'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 implementations were found: - <&'a f64 as Add> - <&f64 as Add<&f64>> - > - + = help: the following other types implement trait `Add`: <&'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 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 implementations were found: + = help: the following other types implement trait `Sub`: <&'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 implementations were found: - <&'a f64 as Sub> - <&f64 as Sub<&f64>> - > - + = help: the following other types implement trait `Sub`: <&'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 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 implementations were found: + = help: the following other types implement trait `Mul`: <&'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 implementations were found: - <&'a f64 as Mul> - <&f64 as Mul<&f64>> - > - + = help: the following other types implement trait `Mul`: <&'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 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 implementations were found: + = help: the following other types implement trait `Div`: <&'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 implementations were found: - <&'a f64 as Div> - <&f64 as Div<&f64>> - > - + = help: the following other types implement trait `Div`: <&'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 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 be29d31d97b8e..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 implementations were found: + = 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 implementations were found: + = 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 implementations were found: + = 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 implementations were found: + = 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 implementations were found: + = 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 implementations were found: + = 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 6dc27b5d4cc56..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 implementations were found: + = 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/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 d87eceb1c9a7b..96a899ecca581 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 implementations were found: - as Termination> - as Termination> - as Termination> + = help: the following other types implement trait `Termination`: + Result + Result<(), E> + Result 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 dee457ebd7f3f..81dd7d03f919c 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 implementations were found: - <&'a u32 as Add> - <&u32 as Add<&u32>> - > - + = help: the following other types implement trait `Add`: <&'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 88a0f8f065027..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 implementations were found: + = 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 7972437771399..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 implementations were found: + = 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/bound/assoc-fn-bound-root-obligation.rs b/src/test/ui/traits/bound/assoc-fn-bound-root-obligation.rs index 2720f94a3c191..1d234518056fd 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<'_>`: + //~| HELP the following other types implement trait `Pattern<'a>`: //~| 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 37cba4189d725..115539a6dc28d 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<'_>`: + = help: the following other types implement trait `Pattern<'a>`: &'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 3645ad03cb9bb..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,9 @@ 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 trait `CompareTo` is implemented for `i64` + = help: the following other types implement trait `CompareTo`: + > + > error[E0277]: the trait bound `C: CompareTo` is not satisfied --> $DIR/repeated-supertrait-ambig.rs:30:7 @@ -23,7 +25,9 @@ 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 trait `CompareTo` is implemented for `i64` + = help: the following other types implement trait `CompareTo`: + > + > error[E0277]: the trait bound `C: CompareTo` is not satisfied --> $DIR/repeated-supertrait-ambig.rs:38:5 @@ -42,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 implementations were found: + = help: the following other types implement trait `CompareTo`: > > diff --git a/src/test/ui/traits/issue-79458.stderr b/src/test/ui/traits/issue-79458.stderr index b970012837313..cf2e4edf9f0a9 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 implementations were found: - <&T as Clone> - <*const T as Clone> - <*mut T as Clone> + = help: the following other types implement trait `Clone`: + &T + *const T + *mut T = 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 37bc5c6badc41..a4686edb71757 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 6567eca38c81d..1b46252ae89ec 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 implementations were found: - > - > + = help: the following other types implement trait `From`: > > > > > > + > + > 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 1372a018667c2..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 implementations were found: + = 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 15bbfeb87c6f3..15deade2cd8f1 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 implementations were found: - <&'a i32 as Add> - <&i32 as Add<&i32>> - > - + = help: the following other types implement trait `Add`: <&'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 9e2d8a6159c48..00f490c465345 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 implementations were found: - <&'a usize as Add> - <&usize as Add<&usize>> - > - + = help: the following other types implement trait `Add`: <&'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 998b636887f23..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 implementations were found: + = 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 64da15c505536..09208527210f9 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 implementations were found: - <&'a i32 as Add> - <&i32 as Add<&i32>> - > - + = help: the following other types implement trait `Add`: <&'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