Skip to content

Commit 697f38d

Browse files
committed
Sort somem diagnostics by DefPathStr instead of DefId
1 parent fa1d27e commit 697f38d

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
@@ -2668,7 +2668,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
26682668
traits.push(trait_pred.def_id());
26692669
}
26702670
}
2671-
traits.sort();
2671+
traits.sort_by_key(|id| self.tcx.def_path_str(id));
26722672
traits.dedup();
26732673

26742674
let len = traits.len();
@@ -2891,7 +2891,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
28912891
) -> bool {
28922892
if !valid_out_of_scope_traits.is_empty() {
28932893
let mut candidates = valid_out_of_scope_traits;
2894-
candidates.sort();
2894+
candidates.sort_by_key(|id| self.tcx.def_path_str(id));
28952895
candidates.dedup();
28962896

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

0 commit comments

Comments
 (0)