diff options
| author | Kevin Per <kevin.per@protonmail.com> | 2020-05-22 10:52:06 +0200 |
|---|---|---|
| committer | Kevin Per <kevin.per@protonmail.com> | 2020-05-22 10:52:06 +0200 |
| commit | e776121431dc73b6e1782d5ddcc4e8d6d714f8e4 (patch) | |
| tree | eeac8820fa4a5d970c7ee49c9db41e9137623c20 | |
| parent | d232be80f82b052fd023eb2f4904ccad0aa42d7a (diff) | |
| download | rust-e776121431dc73b6e1782d5ddcc4e8d6d714f8e4.tar.gz rust-e776121431dc73b6e1782d5ddcc4e8d6d714f8e4.zip | |
Using `!span.from_expansion()` instead of snippets
| -rw-r--r-- | src/librustc_trait_selection/traits/error_reporting/suggestions.rs | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs index c90769c6655..24ca5ade597 100644 --- a/src/librustc_trait_selection/traits/error_reporting/suggestions.rs +++ b/src/librustc_trait_selection/traits/error_reporting/suggestions.rs @@ -571,30 +571,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { // Because of this, we modify the error to refer to the original obligation and // return early in the caller. - let has_colon = self - .tcx - .sess - .source_map() - .span_to_snippet(span) - .map(|w| w.contains(":")) - .unwrap_or(false); - - let has_double_colon = self - .tcx - .sess - .source_map() - .span_to_snippet(span) - .map(|w| w.contains("::")) - .unwrap_or(false); - - let has_bracket = self - .tcx - .sess - .source_map() - .span_to_snippet(span) - .map(|w| w.contains("{")) - .unwrap_or(false); - let msg = format!( "the trait bound `{}: {}` is not satisfied", found, @@ -619,7 +595,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { ); // This if is to prevent a special edge-case - if !has_colon || has_double_colon || has_bracket { + if !span.from_expansion() { // We don't want a borrowing suggestion on the fields in structs, // ``` // struct Foo { |
