@@ -25,7 +25,7 @@ use rustc_middle::infer::unify_key::{ConstVariableOrigin, ConstVariableOriginKin
25
25
use rustc_middle:: traits:: util:: supertraits;
26
26
use rustc_middle:: ty:: fast_reject:: DeepRejectCtxt ;
27
27
use rustc_middle:: ty:: fast_reject:: { simplify_type, TreatParams } ;
28
- use rustc_middle:: ty:: print:: with_crate_prefix;
28
+ use rustc_middle:: ty:: print:: { with_crate_prefix, with_forced_trimmed_paths } ;
29
29
use rustc_middle:: ty:: { self , DefIdTree , GenericArgKind , Ty , TyCtxt , TypeVisitable } ;
30
30
use rustc_middle:: ty:: { IsSuggestable , ToPolyTraitRef } ;
31
31
use rustc_span:: symbol:: { kw, sym, Ident } ;
@@ -270,7 +270,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
270
270
let tcx = self . tcx ;
271
271
272
272
let rcvr_ty = self . resolve_vars_if_possible ( rcvr_ty) ;
273
- let ty_str = self . ty_to_string ( rcvr_ty) ;
273
+ let ty_str = with_forced_trimmed_paths ! ( self . ty_to_string( rcvr_ty) ) ;
274
274
let is_method = mode == Mode :: MethodCall ;
275
275
let item_kind = if is_method {
276
276
"method"
@@ -563,7 +563,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
563
563
let term = pred. skip_binder ( ) . term ;
564
564
565
565
let obligation = format ! ( "{} = {}" , projection_ty, term) ;
566
- let quiet = format ! ( "{} = {}" , quiet_projection_ty, term) ;
566
+ let quiet = with_forced_trimmed_paths ! ( format!(
567
+ "{} = {}" ,
568
+ quiet_projection_ty, term
569
+ ) ) ;
567
570
568
571
bound_span_label ( projection_ty. self_ty ( ) , & obligation, & quiet) ;
569
572
Some ( ( obligation, projection_ty. self_ty ( ) ) )
@@ -573,7 +576,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
573
576
let self_ty = p. self_ty ( ) ;
574
577
let path = p. print_only_trait_path ( ) ;
575
578
let obligation = format ! ( "{}: {}" , self_ty, path) ;
576
- let quiet = format ! ( "_: {}" , path) ;
579
+ let quiet = with_forced_trimmed_paths ! ( format!( "_: {}" , path) ) ;
577
580
bound_span_label ( self_ty, & obligation, & quiet) ;
578
581
Some ( ( obligation, self_ty) )
579
582
}
@@ -796,7 +799,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
796
799
( None , None )
797
800
} ;
798
801
let primary_message = primary_message. unwrap_or_else ( || format ! (
799
- "the {item_kind} `{item_name}` exists for {actual_prefix} `{ty_str}`, but its trait bounds were not satisfied"
802
+ "the {item_kind} `{item_name}` exists for {actual_prefix} `{ty_str}`, \
803
+ but its trait bounds were not satisfied"
800
804
) ) ;
801
805
err. set_primary_message ( & primary_message) ;
802
806
if let Some ( label) = label {
0 commit comments