about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-03-21 17:14:14 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-03-27 14:02:17 +0000
commite522d2906d712b27fa218ccabe3e962bfab9867b (patch)
treeb35c145319710443565d5a6bad3821482d95b88a
parent5676326c7292e043278f2cfc2b35d93167817f30 (diff)
downloadrust-e522d2906d712b27fa218ccabe3e962bfab9867b.tar.gz
rust-e522d2906d712b27fa218ccabe3e962bfab9867b.zip
Stop sorting `DefId`s in the compiler
-rw-r--r--compiler/rustc_hir_typeck/src/method/suggest.rs2
-rw-r--r--tests/ui/methods/method-not-found-generic-arg-elision.stderr4
2 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs
index 34b73947e3d..12f522d1adc 100644
--- a/compiler/rustc_hir_typeck/src/method/suggest.rs
+++ b/compiler/rustc_hir_typeck/src/method/suggest.rs
@@ -1185,7 +1185,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                         })
                         .collect::<Vec<_>>();
                     if !inherent_impls_candidate.is_empty() {
-                        inherent_impls_candidate.sort();
+                        inherent_impls_candidate.sort_by_key(|id| self.tcx.def_path_str(id));
                         inherent_impls_candidate.dedup();
 
                         // number of types to show at most
diff --git a/tests/ui/methods/method-not-found-generic-arg-elision.stderr b/tests/ui/methods/method-not-found-generic-arg-elision.stderr
index b97688d3868..a665500fd9e 100644
--- a/tests/ui/methods/method-not-found-generic-arg-elision.stderr
+++ b/tests/ui/methods/method-not-found-generic-arg-elision.stderr
@@ -35,10 +35,10 @@ LL |     wrapper.method();
    |             ^^^^^^ method not found in `Wrapper<bool>`
    |
    = note: the method was found for
-           - `Wrapper<i8>`
            - `Wrapper<i16>`
            - `Wrapper<i32>`
            - `Wrapper<i64>`
+           - `Wrapper<i8>`
            and 2 more types
 
 error[E0599]: no method named `other` found for struct `Wrapper` in the current scope
@@ -60,9 +60,9 @@ LL |     wrapper.method();
    |             ^^^^^^ method not found in `Wrapper2<'_, bool, 3>`
    |
    = note: the method was found for
-           - `Wrapper2<'a, i8, C>`
            - `Wrapper2<'a, i16, C>`
            - `Wrapper2<'a, i32, C>`
+           - `Wrapper2<'a, i8, C>`
 
 error[E0599]: no method named `other` found for struct `Wrapper2` in the current scope
   --> $DIR/method-not-found-generic-arg-elision.rs:98:13