Skip to content

Commit 5676326

Browse files
committed
Sort somem diagnostics by DefPathStr instead of DefId
1 parent 6be79cb commit 5676326

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_hir_typeck/src/method/suggest.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2665,7 +2665,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
26652665
traits.push(trait_pred.def_id());
26662666
}
26672667
}
2668-
traits.sort();
2668+
traits.sort_by_key(|id| self.tcx.def_path_str(id));
26692669
traits.dedup();
26702670

26712671
let len = traits.len();
@@ -2888,7 +2888,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
28882888
) -> bool {
28892889
if !valid_out_of_scope_traits.is_empty() {
28902890
let mut candidates = valid_out_of_scope_traits;
2891-
candidates.sort();
2891+
candidates.sort_by_key(|id| self.tcx.def_path_str(id));
28922892
candidates.dedup();
28932893

28942894
// `TryFrom` and `FromIterator` have no methods

0 commit comments

Comments
 (0)