diff options
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs index a7d1f1bd8d0..8e0bdce1280 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs @@ -5105,24 +5105,13 @@ pub(super) fn get_explanation_based_on_obligation<'tcx>( _ => None, }; - let pred = obligation.predicate; - let (_, base) = obligation.cause.code().peel_derives_with_predicate(); - let post = if let ty::PredicateKind::Clause(clause) = pred.kind().skip_binder() - && let ty::ClauseKind::Trait(pred) = clause - && let Some(base) = base - && base.skip_binder() != pred - { - format!(", which is required by `{base}`") - } else { - String::new() - }; let desc = match ty_desc { Some(desc) => format!(" {desc}"), None => String::new(), }; if let ty::PredicatePolarity::Positive = trait_predicate.polarity() { format!( - "{pre_message}the trait `{}` is not implemented for{desc} `{}`{post}", + "{pre_message}the trait `{}` is not implemented for{desc} `{}`", trait_predicate.print_modifiers_and_trait_path(), tcx.short_ty_string(trait_predicate.self_ty().skip_binder(), &mut None), ) @@ -5130,7 +5119,7 @@ pub(super) fn get_explanation_based_on_obligation<'tcx>( // "the trait bound `T: !Send` is not satisfied" reads better than "`!Send` is // not implemented for `T`". // FIXME: add note explaining explicit negative trait bounds. - format!("{pre_message}the trait bound `{trait_predicate}` is not satisfied{post}") + format!("{pre_message}the trait bound `{trait_predicate}` is not satisfied") } } } |
