diff options
| author | Mu42 <mu001999@outlook.com> | 2023-03-23 09:41:49 +0800 |
|---|---|---|
| committer | Mu42 <mu001999@outlook.com> | 2023-03-23 09:41:49 +0800 |
| commit | 2580348ca35270b5cefbd0f62ff4e6ccd44ef3be (patch) | |
| tree | fa421c804157ead9828b605e06954ba3a38d9515 | |
| parent | 20f3f437d1f48706930cdb6e9e5089131a34d006 (diff) | |
| download | rust-2580348ca35270b5cefbd0f62ff4e6ccd44ef3be.tar.gz rust-2580348ca35270b5cefbd0f62ff4e6ccd44ef3be.zip | |
Use span_look_ahead instead of next_point
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs | 9 |
1 files changed, 3 insertions, 6 deletions
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, |
