@@ -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"
@@ -565,7 +565,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
565
565
let term = pred. skip_binder ( ) . term ;
566
566
567
567
let obligation = format ! ( "{} = {}" , projection_ty, term) ;
568
- let quiet = format ! ( "{} = {}" , quiet_projection_ty, term) ;
568
+ let quiet = with_forced_trimmed_paths ! ( format!(
569
+ "{} = {}" ,
570
+ quiet_projection_ty, term
571
+ ) ) ;
569
572
570
573
bound_span_label ( projection_ty. self_ty ( ) , & obligation, & quiet) ;
571
574
Some ( ( obligation, projection_ty. self_ty ( ) ) )
@@ -575,7 +578,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
575
578
let self_ty = p. self_ty ( ) ;
576
579
let path = p. print_only_trait_path ( ) ;
577
580
let obligation = format ! ( "{}: {}" , self_ty, path) ;
578
- let quiet = format ! ( "_: {}" , path) ;
581
+ let quiet = with_forced_trimmed_paths ! ( format!( "_: {}" , path) ) ;
579
582
bound_span_label ( self_ty, & obligation, & quiet) ;
580
583
Some ( ( obligation, self_ty) )
581
584
}
@@ -798,7 +801,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
798
801
( None , None )
799
802
} ;
800
803
let primary_message = primary_message. unwrap_or_else ( || format ! (
801
- "the {item_kind} `{item_name}` exists for {actual_prefix} `{ty_str}`, but its trait bounds were not satisfied"
804
+ "the {item_kind} `{item_name}` exists for {actual_prefix} `{ty_str}`, \
805
+ but its trait bounds were not satisfied"
802
806
) ) ;
803
807
err. set_primary_message ( & primary_message) ;
804
808
if let Some ( label) = label {
@@ -895,7 +899,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
895
899
}
896
900
}
897
901
} else {
898
- err. span_label ( span, format ! ( "{item_kind} cannot be called on `{ty_str}` due to unsatisfied trait bounds" ) ) ;
902
+ err. span_label (
903
+ span,
904
+ format ! (
905
+ "{item_kind} cannot be called on `{ty_str}` due to unsatisfied \
906
+ trait bounds",
907
+ ) ,
908
+ ) ;
899
909
}
900
910
} ;
901
911
0 commit comments