diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
index 0e33e9cd790d0..ea30b632cb641 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -3081,6 +3081,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
                                         ))
                                     })
                                     .collect::<Vec<_>>();
+                                types.sort();
                                 let post = if types.len() > 9 {
                                     types.truncate(8);
                                     format!("\nand {} others", len - 8)