From 2580348ca35270b5cefbd0f62ff4e6ccd44ef3be Mon Sep 17 00:00:00 2001 From: Mu42 Date: Thu, 23 Mar 2023 09:41:49 +0800 Subject: Use span_look_ahead instead of next_point --- .../src/traits/error_reporting/suggestions.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'compiler/rustc_trait_selection/src') 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 eb2a87100d3..4a45d9b9bef 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -1367,12 +1367,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { // Issue #109436, we need to add parentheses properly for method calls // for example, `foo.into()` should be `(&foo).into()` - if let Ok(snippet) = self - .tcx - .sess - .source_map() - .span_to_snippet(self.tcx.sess.source_map().next_point(span)) - { + if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet( + self.tcx.sess.source_map().span_look_ahead(span, Some("."), Some(50)), + ) { if snippet == "." { err.multipart_suggestion_verbose( sugg_msg, -- cgit 1.4.1-3-g733a5