@@ -9,7 +9,7 @@ use crate::{
9
9
TupleArgumentsFlag ,
10
10
} ;
11
11
use rustc_ast as ast;
12
- use rustc_data_structures:: fx:: FxHashSet ;
12
+ use rustc_data_structures:: fx:: FxIndexSet ;
13
13
use rustc_errors:: { pluralize, Applicability , Diagnostic , DiagnosticId , MultiSpan } ;
14
14
use rustc_hir as hir;
15
15
use rustc_hir:: def:: { CtorOf , DefKind , Res } ;
@@ -1689,7 +1689,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1689
1689
// even if their `ObligationCauseCode` isn't an `Expr*Obligation` kind.
1690
1690
// This is important since if we adjust one span but not the other, then
1691
1691
// we will have "duplicated" the error on the UI side.
1692
- let mut remap_cause = FxHashSet :: default ( ) ;
1692
+ let mut remap_cause = FxIndexSet :: default ( ) ;
1693
1693
let mut not_adjusted = vec ! [ ] ;
1694
1694
1695
1695
for error in errors {
@@ -1717,6 +1717,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1717
1717
}
1718
1718
}
1719
1719
1720
+ // Adjust any other errors that come from other cause codes, when these
1721
+ // errors are of the same predicate as one we successfully adjusted, and
1722
+ // when their spans overlap (suggesting they're due to the same root cause).
1723
+ //
1724
+ // This is because due to normalization, we often register duplicate
1725
+ // obligations with misc obligations that are basically impossible to
1726
+ // line back up with a useful ExprBindingObligation.
1720
1727
for error in not_adjusted {
1721
1728
for ( span, predicate, cause) in & remap_cause {
1722
1729
if * predicate == error. obligation . predicate
0 commit comments