@@ -1291,7 +1291,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1291
1291
ty:: TraitRef :: new ( self . tcx , into_def_id, [ expr_ty, expected_ty] ) ,
1292
1292
) )
1293
1293
{
1294
- let span = find_local_most_ancestor_suggestable_span ( expr. span ) ;
1294
+ let span = expr. span . find_local_most_ancestor_suggestable_span ( ) ;
1295
1295
1296
1296
let mut sugg = if expr. precedence ( ) . order ( ) >= PREC_POSTFIX {
1297
1297
vec ! [ ( span. shrink_to_hi( ) , ".into()" . to_owned( ) ) ]
@@ -1896,7 +1896,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1896
1896
None => sugg. to_string ( ) ,
1897
1897
} ;
1898
1898
1899
- let span = find_local_most_ancestor_suggestable_span ( expr. span ) ;
1899
+ let span = expr. span . find_local_most_ancestor_suggestable_span ( ) ;
1900
1900
err. span_suggestion_verbose ( span. shrink_to_hi ( ) , msg, sugg, Applicability :: HasPlaceholders ) ;
1901
1901
return true ;
1902
1902
}
@@ -3171,19 +3171,3 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3171
3171
}
3172
3172
}
3173
3173
}
3174
-
3175
- /// For suggestion span, recursively try to look for the ancestor span which shares the same syntax
3176
- /// context as the initially provided `span`. This will recursively look into local macros until the
3177
- /// span inside the most ancestor local macro is found. It will stop recursing as soon as the
3178
- /// syntax context of a potential parent callsite changes, such as if the potential parent callsite
3179
- /// is in a foreign macro. This helps to prevent leaking implementation details from upstream
3180
- /// crates and stdlib crates that the user likely have no control over.
3181
- fn find_local_most_ancestor_suggestable_span ( initial_span : Span ) -> Span {
3182
- let mut span = initial_span;
3183
- while initial_span. eq_ctxt ( span)
3184
- && let Some ( parent_callsite) = span. parent_callsite ( )
3185
- {
3186
- span = parent_callsite;
3187
- }
3188
- span
3189
- }
0 commit comments