Skip to content

Commit e776121

Browse files
committed
Using !span.from_expansion() instead of snippets
1 parent d232be8 commit e776121

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

src/librustc_trait_selection/traits/error_reporting/suggestions.rs

+1-25
Original file line numberDiff line numberDiff line change
@@ -571,30 +571,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
571571
// Because of this, we modify the error to refer to the original obligation and
572572
// return early in the caller.
573573

574-
let has_colon = self
575-
.tcx
576-
.sess
577-
.source_map()
578-
.span_to_snippet(span)
579-
.map(|w| w.contains(":"))
580-
.unwrap_or(false);
581-
582-
let has_double_colon = self
583-
.tcx
584-
.sess
585-
.source_map()
586-
.span_to_snippet(span)
587-
.map(|w| w.contains("::"))
588-
.unwrap_or(false);
589-
590-
let has_bracket = self
591-
.tcx
592-
.sess
593-
.source_map()
594-
.span_to_snippet(span)
595-
.map(|w| w.contains("{"))
596-
.unwrap_or(false);
597-
598574
let msg = format!(
599575
"the trait bound `{}: {}` is not satisfied",
600576
found,
@@ -619,7 +595,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
619595
);
620596

621597
// This if is to prevent a special edge-case
622-
if !has_colon || has_double_colon || has_bracket {
598+
if !span.from_expansion() {
623599
// We don't want a borrowing suggestion on the fields in structs,
624600
// ```
625601
// struct Foo {

0 commit comments

Comments
 (0)