diff options
| -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 { |
