Skip to content

Commit 93ab85f

Browse files
committed
Sort suggestions in diagnostics to make error reporting deterministic
1 parent 477de93 commit 93ab85f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/rustc_resolve/src/diagnostics.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
13661366
);
13671367

13681368
if lookup_ident.span.at_least_rust_2018() {
1369-
// It will be sorted later.
1369+
// Extended suggestions will be sorted at the end of this function.
13701370
#[allow(rustc::potential_query_instability)]
13711371
for ident in self.extern_prelude.clone().into_keys() {
13721372
if ident.span.from_expansion() {
@@ -1422,6 +1422,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
14221422
}
14231423
}
14241424

1425+
// Make sure error reporting is deterministic.
1426+
suggestions.sort_by_key(|suggestion| suggestion.did.unwrap().index);
14251427
suggestions
14261428
}
14271429

0 commit comments

Comments
 (0)