@@ -63,6 +63,7 @@ thread_local! {
63
63
static FORCE_TRIMMED_PATH : Cell <bool > = const { Cell :: new( false ) } ;
64
64
static REDUCED_QUERIES : Cell <bool > = const { Cell :: new( false ) } ;
65
65
static NO_VISIBLE_PATH : Cell <bool > = const { Cell :: new( false ) } ;
66
+ static TYPE_FOR_SUGGESTION : Cell <bool > = const { Cell :: new( false ) } ;
66
67
}
67
68
68
69
macro_rules! define_helper {
@@ -122,6 +123,11 @@ define_helper!(
122
123
/// Prevent selection of visible paths. `Display` impl of DefId will prefer
123
124
/// visible (public) reexports of types as paths.
124
125
fn with_no_visible_paths( NoVisibleGuard , NO_VISIBLE_PATH ) ;
126
+ /// Render a type for the purposes of a suggestion, rather than for diagnostic
127
+ /// clarity. Right now, this suppresses the "{{ path::to::Trait::method(..) }}"
128
+ /// for RPITITs, but it could be used to render more friendly representations
129
+ /// for things like `FnDef`, too.
130
+ fn with_types_for_suggestion( TypeForSuggestionGuard , TYPE_FOR_SUGGESTION ) ;
125
131
) ;
126
132
127
133
/// Avoids running any queries during prints.
@@ -1224,6 +1230,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1224
1230
}
1225
1231
1226
1232
if self . tcx ( ) . features ( ) . return_type_notation ( )
1233
+ && !with_types_for_suggestion ( )
1227
1234
&& let Some ( ty:: ImplTraitInTraitData :: Trait { fn_def_id, .. } ) =
1228
1235
self . tcx ( ) . opt_rpitit_info ( def_id)
1229
1236
&& let ty:: Alias ( _, alias_ty) =
0 commit comments