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..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}; @@ -30,7 +29,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}; @@ -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 @@ -1762,56 +1695,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; - } - if candidates.len() == 1 { - err.highlighted_help(vec![ - ( - format!("the trait `{}` ", 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), - ]); - 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. - let mut traits: Vec<_> = - candidates.iter().map(|c| c.print_only_trait_path().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) @@ -1821,7 +1704,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. @@ -1832,10 +1715,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() <= 5 { impl_candidates.len() } else { 4 }; + let normalize = |candidate| { self.tcx.infer_ctxt().enter(|ref infcx| { let normalized = infcx @@ -1843,8 +1761,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), } }) }; @@ -1855,6 +1773,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 }| { @@ -1870,7 +1789,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..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,81 +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/binop/binop-mul-i32-f32.stderr b/src/test/ui/binop/binop-mul-i32-f32.stderr index 21c490965b147..9fcf5d72625c5 100644 --- a/src/test/ui/binop/binop-mul-i32-f32.stderr +++ b/src/test/ui/binop/binop-mul-i32-f32.stderr @@ -5,15 +5,11 @@ 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`: - <&'a f32 as Mul> - <&'a f64 as Mul> - <&'a i128 as Mul> - <&'a i16 as Mul> + = help: the following implementations were found: <&'a i32 as Mul> - <&'a i64 as Mul> - <&'a i8 as Mul> - <&'a isize as Mul> + <&i32 as Mul<&i32>> + > + 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..9553fcc5bb204 100644 --- a/src/test/ui/binop/issue-77910-1.stderr +++ b/src/test/ui/binop/issue-77910-1.stderr @@ -16,15 +16,11 @@ 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> 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 38db66f86b461..e134095e63879 100644 --- a/src/test/ui/binop/shift-various-bad-types.stderr +++ b/src/test/ui/binop/shift-various-bad-types.stderr @@ -5,15 +5,11 @@ 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> <&'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` @@ -23,15 +19,11 @@ 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> <&'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` @@ -41,15 +33,11 @@ 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> <&'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/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 48c61c22e7a32..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: > > @@ -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: > > @@ -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 @@ -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/const-generics/exhaustive-value.stderr b/src/test/ui/const-generics/exhaustive-value.stderr index 9c1b086f4da9a..cb85b6cb93d91 100644 --- a/src/test/ui/const-generics/exhaustive-value.stderr +++ b/src/test/ui/const-generics/exhaustive-value.stderr @@ -4,15 +4,11 @@ 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 implementations were found: <() as Foo<0_u8>> <() 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/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/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 0e6be6d01ed69..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 @@ -11,15 +11,11 @@ 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`: - <&'a f32 as Add> - <&'a f64 as Add> - <&'a i128 as Add> - <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> + = help: the following implementations were found: <&'a i8 as Add> - <&'a isize as Add> + <&i8 as Add<&i8>> + > + 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 4fa017e04e97b..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 @@ -11,15 +11,11 @@ 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`: - <&'a f32 as Add> - <&'a f64 as Add> - <&'a i128 as Add> - <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> + = help: the following implementations were found: <&'a i8 as Add> - <&'a isize as Add> + <&i8 as Add<&i8>> + > + 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 8de61fcfb7330..677fa7d21aef0 100644 --- a/src/test/ui/consts/too_generic_eval_ice.stderr +++ b/src/test/ui/consts/too_generic_eval_ice.stderr @@ -21,15 +21,11 @@ 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 implementations were found: <&[B] as PartialEq<[A; N]>> <&[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-1.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-1.stderr index 26764bc0ee5cc..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 bb175367e1f9e..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 @@ -4,13 +4,11 @@ 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: > > > > - > - > 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 d27b05fe7f7df..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 @@ -6,16 +6,11 @@ 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: > > > > - > - > - > - > - > error[E0277]: the trait bound `u8: Foo` is not satisfied --> $DIR/issue-39802-show-5-trait-impls.rs:25:21 @@ -25,12 +20,7 @@ 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: > > > @@ -44,13 +34,11 @@ 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: > > > > - > - > 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 26986684f0c0a..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 @@ -22,15 +22,11 @@ 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> <&'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/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/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/equality.stderr b/src/test/ui/impl-trait/equality.stderr index f14b447b07730..6592e234d9873 100644 --- a/src/test/ui/impl-trait/equality.stderr +++ b/src/test/ui/impl-trait/equality.stderr @@ -24,15 +24,11 @@ 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`: - <&'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> + = help: the following implementations were found: + <&'a u32 as Add> + <&u32 as Add<&u32>> + > + and 48 others error: aborting due to 2 previous errors; 1 warning emitted 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-11771.stderr b/src/test/ui/issues/issue-11771.stderr index 161fce4b0315c..2b93d4aab27db 100644 --- a/src/test/ui/issues/issue-11771.stderr +++ b/src/test/ui/issues/issue-11771.stderr @@ -5,15 +5,11 @@ 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> <&'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}` @@ -23,15 +19,11 @@ 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> <&'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 118f37f6971ef..f61ff0bda0bbd 100644 --- a/src/test/ui/issues/issue-24352.stderr +++ b/src/test/ui/issues/issue-24352.stderr @@ -5,15 +5,11 @@ 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> - <&'a i128 as Sub> - <&'a i16 as Sub> - <&'a i32 as Sub> - <&'a i64 as Sub> - <&'a i8 as Sub> - <&'a isize as Sub> + <&f64 as Sub<&f64>> + > + and 48 others help: consider using a floating-point literal by writing it with `.0` | 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/issues/issue-50582.stderr b/src/test/ui/issues/issue-50582.stderr index 3d527eb6b4e4a..64bcfcd6016ab 100644 --- a/src/test/ui/issues/issue-50582.stderr +++ b/src/test/ui/issues/issue-50582.stderr @@ -14,15 +14,11 @@ 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> <&'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 76a47c49bbafb..55616d2d322ee 100644 --- a/src/test/ui/issues/issue-59488.stderr +++ b/src/test/ui/issues/issue-59488.stderr @@ -94,15 +94,11 @@ 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> 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..6272c4b702266 100644 --- a/src/test/ui/kindck/kindck-copy.stderr +++ b/src/test/ui/kindck/kindck-copy.stderr @@ -4,15 +4,11 @@ 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 +22,11 @@ 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/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/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/lexer/lex-bad-char-literals-6.stderr b/src/test/ui/lexer/lex-bad-char-literals-6.stderr index afef0cb603485..0e1851d292cf9 100644 --- a/src/test/ui/lexer/lex-bad-char-literals-6.stderr +++ b/src/test/ui/lexer/lex-bad-char-literals-6.stderr @@ -38,14 +38,10 @@ 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 @@ -64,14 +60,10 @@ 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 diff --git a/src/test/ui/mismatched_types/binops.stderr b/src/test/ui/mismatched_types/binops.stderr index 3de652d87ec54..6e67a7b454529 100644 --- a/src/test/ui/mismatched_types/binops.stderr +++ b/src/test/ui/mismatched_types/binops.stderr @@ -5,15 +5,11 @@ 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> <&'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` @@ -23,15 +19,11 @@ 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`: - <&'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> + = help: the following implementations were found: + <&'a usize as Sub> + <&usize as Sub<&usize>> + > + and 48 others error[E0277]: cannot multiply `{integer}` by `()` @@ -41,15 +33,11 @@ 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> <&'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` @@ -59,15 +47,11 @@ 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> <&'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` @@ -77,15 +61,11 @@ 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 +75,11 @@ 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 fed780e68957f..12a6d7962f46b 100644 --- a/src/test/ui/never_type/issue-13352.stderr +++ b/src/test/ui/never_type/issue-13352.stderr @@ -5,15 +5,11 @@ 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`: - <&'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> + = help: the following implementations were found: + <&'a usize as Add> + <&usize as Add<&usize>> + > + 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 6aa1ad8dd899f..d8bba1509d868 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,11 @@ 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`: - <&'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> + = help: the following implementations were found: + <&'a u8 as Add> + <&u8 as Add<&u8>> + > + and 48 others error[E0277]: cannot add `&str` to `f64` @@ -23,15 +19,11 @@ 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> - <&'a i128 as Add> - <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> + <&f64 as Add<&f64>> + > + and 48 others error[E0277]: cannot add `{integer}` to `f64` @@ -41,15 +33,11 @@ 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> - <&'a i128 as Add> - <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> + <&f64 as Add<&f64>> + > + and 48 others error[E0277]: cannot subtract `{float}` from `u8` @@ -59,15 +47,11 @@ 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`: - <&'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> + = help: the following implementations were found: + <&'a u8 as Sub> + <&u8 as Sub<&u8>> + > + and 48 others error[E0277]: cannot subtract `&str` from `f64` @@ -77,15 +61,11 @@ 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> - <&'a i128 as Sub> - <&'a i16 as Sub> - <&'a i32 as Sub> - <&'a i64 as Sub> - <&'a i8 as Sub> - <&'a isize as Sub> + <&f64 as Sub<&f64>> + > + and 48 others error[E0277]: cannot subtract `{integer}` from `f64` @@ -95,15 +75,11 @@ 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> - <&'a i128 as Sub> - <&'a i16 as Sub> - <&'a i32 as Sub> - <&'a i64 as Sub> - <&'a i8 as Sub> - <&'a isize as Sub> + <&f64 as Sub<&f64>> + > + and 48 others error[E0277]: cannot multiply `u8` by `{float}` @@ -113,15 +89,11 @@ 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`: - <&'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> + = help: the following implementations were found: + <&'a u8 as Mul> + <&u8 as Mul<&u8>> + > + and 49 others error[E0277]: cannot multiply `f64` by `&str` @@ -131,15 +103,11 @@ 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> - <&'a i128 as Mul> - <&'a i16 as Mul> - <&'a i32 as Mul> - <&'a i64 as Mul> - <&'a i8 as Mul> - <&'a isize as Mul> + <&f64 as Mul<&f64>> + > + and 49 others error[E0277]: cannot multiply `f64` by `{integer}` @@ -149,15 +117,11 @@ 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> - <&'a i128 as Mul> - <&'a i16 as Mul> - <&'a i32 as Mul> - <&'a i64 as Mul> - <&'a i8 as Mul> - <&'a isize as Mul> + <&f64 as Mul<&f64>> + > + and 49 others error[E0277]: cannot divide `u8` by `{float}` @@ -167,15 +131,11 @@ 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`: - <&'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> + = help: the following implementations were found: + <&'a u8 as Div> + <&u8 as Div<&u8>> + > + > and 54 others error[E0277]: cannot divide `f64` by `&str` @@ -185,15 +145,11 @@ 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> - <&'a i128 as Div> - <&'a i16 as Div> - <&'a i32 as Div> - <&'a i64 as Div> - <&'a i8 as Div> - <&'a isize as Div> + <&f64 as Div<&f64>> + > + and 54 others error[E0277]: cannot divide `f64` by `{integer}` @@ -203,15 +159,11 @@ 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> - <&'a i128 as Div> - <&'a i16 as Div> - <&'a i32 as Div> - <&'a i64 as Div> - <&'a i8 as Div> - <&'a isize as Div> + <&f64 as Div<&f64>> + > + 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 988379e582a34..b7591dfca99b3 100644 --- a/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr +++ b/src/test/ui/numbers-arithmetic/suggest-float-literal.stderr @@ -5,15 +5,11 @@ 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> - <&'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> + <&f32 as Add<&f32>> + > + and 48 others help: consider using a floating-point literal by writing it with `.0` | @@ -27,15 +23,11 @@ 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> - <&'a i128 as Add> - <&'a i16 as Add> - <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> + <&f64 as Add<&f64>> + > + and 48 others help: consider using a floating-point literal by writing it with `.0` | @@ -49,15 +41,11 @@ 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> - <&'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> + <&f32 as Sub<&f32>> + > + and 48 others help: consider using a floating-point literal by writing it with `.0` | @@ -71,15 +59,11 @@ 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> - <&'a i128 as Sub> - <&'a i16 as Sub> - <&'a i32 as Sub> - <&'a i64 as Sub> - <&'a i8 as Sub> - <&'a isize as Sub> + <&f64 as Sub<&f64>> + > + and 48 others help: consider using a floating-point literal by writing it with `.0` | @@ -93,15 +77,11 @@ 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> - <&'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> + <&f32 as Mul<&f32>> + > + and 49 others help: consider using a floating-point literal by writing it with `.0` | @@ -115,15 +95,11 @@ 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> - <&'a i128 as Mul> - <&'a i16 as Mul> - <&'a i32 as Mul> - <&'a i64 as Mul> - <&'a i8 as Mul> - <&'a isize as Mul> + <&f64 as Mul<&f64>> + > + and 49 others help: consider using a floating-point literal by writing it with `.0` | @@ -137,15 +113,11 @@ 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> - <&'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> + <&f32 as Div<&f32>> + > + and 54 others help: consider using a floating-point literal by writing it with `.0` | @@ -159,15 +131,11 @@ 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> - <&'a i128 as Div> - <&'a i16 as Div> - <&'a i32 as Div> - <&'a i64 as Div> - <&'a i8 as Div> - <&'a isize as Div> + <&f64 as Div<&f64>> + > + 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 06e1a222af881..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 ae7d2e1d82393..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 c0d9a8634e487..1542832f0129c 100644 --- a/src/test/ui/span/multiline-span-simple.stderr +++ b/src/test/ui/span/multiline-span-simple.stderr @@ -5,15 +5,11 @@ 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`: - <&'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> + = help: the following implementations were found: + <&'a u32 as Add> + <&u32 as Add<&u32>> + > + 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 8ae5c84794734..4bdea05b06b8d 100644 --- a/src/test/ui/suggestions/into-str.stderr +++ b/src/test/ui/suggestions/into-str.stderr @@ -7,13 +7,11 @@ 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: > > > >> - >> - > = 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/suggestions/issue-71394-no-from-impl.stderr b/src/test/ui/suggestions/issue-71394-no-from-impl.stderr index 383f40d47fa44..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 deleted file mode 100644 index 1d234518056fd..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<'a>`: - //~| 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 115539a6dc28d..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<'a>`: - &'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`. diff --git a/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr b/src/test/ui/traits/inheritance/repeated-supertrait-ambig.stderr index cab0ccdf710da..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/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 7a8433f90572e..0000000000000 --- a/src/test/ui/traits/suggest-deferences/root-obligation.fixed +++ /dev/null @@ -1,13 +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 51bac2107e3b4..0000000000000 --- a/src/test/ui/traits/suggest-deferences/root-obligation.rs +++ /dev/null @@ -1,13 +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`. diff --git a/src/test/ui/try-trait/bad-interconversion.stderr b/src/test/ui/try-trait/bad-interconversion.stderr index 1a4105231dc75..fc2692a9a9313 100644 --- a/src/test/ui/try-trait/bad-interconversion.stderr +++ b/src/test/ui/try-trait/bad-interconversion.stderr @@ -7,15 +7,11 @@ 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 264e8024fac3a..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> @@ -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 diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index f292877f30ea2..80ff068ff309a 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -65,15 +65,11 @@ 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`: - <&'a f32 as Add> - <&'a f64 as Add> - <&'a i128 as Add> - <&'a i16 as Add> + = help: the following implementations were found: <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> + <&i32 as Add<&i32>> + > + 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 9658288ac8b28..0a5ec56e91512 100644 --- a/src/test/ui/typeck/issue-81293.stderr +++ b/src/test/ui/typeck/issue-81293.stderr @@ -20,15 +20,11 @@ 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`: - <&'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> + = help: the following implementations were found: + <&'a usize as Add> + <&usize as Add<&usize>> + > + 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 ab9a72edfe98d..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 74766d9fdd1b1..c769a0df7c891 100644 --- a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -5,15 +5,11 @@ 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`: - <&'a f32 as Add> - <&'a f64 as Add> - <&'a i128 as Add> - <&'a i16 as Add> + = help: the following implementations were found: <&'a i32 as Add> - <&'a i64 as Add> - <&'a i8 as Add> - <&'a isize as Add> + <&i32 as Add<&i32>> + > + and 48 others error[E0308]: mismatched types