Skip to content

Commit

Permalink
don't use partial ordering on types that support total ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
yotamofek committed Jan 18, 2025
1 parent 8e59cf9 commit f7ebbf9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
});

// Make sure error reporting is deterministic.
suggestions.sort_by(|a, b| a.candidate.as_str().partial_cmp(b.candidate.as_str()).unwrap());
suggestions.sort_by(|a, b| a.candidate.as_str().cmp(b.candidate.as_str()));

match find_best_match_for_name(
&suggestions.iter().map(|suggestion| suggestion.candidate).collect::<Vec<Symbol>>(),
Expand Down Expand Up @@ -2357,7 +2357,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
// 2) `std` suggestions before `core` suggestions.
let mut extern_crate_names =
self.extern_prelude.keys().map(|ident| ident.name).collect::<Vec<_>>();
extern_crate_names.sort_by(|a, b| b.as_str().partial_cmp(a.as_str()).unwrap());
extern_crate_names.sort_by(|a, b| b.as_str().cmp(a.as_str()));

for name in extern_crate_names.into_iter() {
// Replace first ident with a crate name and check if that is valid.
Expand Down

0 comments on commit f7ebbf9

Please sign in to comment.