diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-02-21 23:02:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-21 23:02:00 +0100 |
| commit | ae0143007839fada3fadd790dc9b8c1a36c61dee (patch) | |
| tree | cd377aac8ca4ab978e86c1489f3d10d68e2d48eb /compiler/rustc_trait_selection/src | |
| parent | 8a5843f07f20ae70b8caa24d78857ef221b54ccb (diff) | |
| parent | a58682d7ccef5248ae814e9ec8c851cf019fd787 (diff) | |
| download | rust-ae0143007839fada3fadd790dc9b8c1a36c61dee.tar.gz rust-ae0143007839fada3fadd790dc9b8c1a36c61dee.zip | |
Rollup merge of #108295 - compiler-errors:wtf-is-this, r=cjgillot
Use DefKind to give more item kind information during BindingObligation note The current label says "required by a bound in this". When I see that label, my immediate impression is "this... **what**?". It feels like it was cut short. Alternative to this would be saying "in this item", but adding the item kind is strictly more informational and adds very little overhead to the existing error presentation.
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs | 8 |
1 files changed, 7 insertions, 1 deletions
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 91b463800a8..824264c21d0 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -2784,7 +2784,13 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { _ => true, }; if ident.span.is_visible(sm) && !ident.span.overlaps(span) && !same_line { - multispan.push_span_label(ident.span, "required by a bound in this"); + multispan.push_span_label( + ident.span, + format!( + "required by a bound in this {}", + tcx.def_kind(item_def_id).descr(item_def_id) + ), + ); } } let descr = format!("required by a bound in `{item_name}`"); |
