From 7a9273d0d4d833bd737074801a1cf5e5a1fb6d85 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Tue, 16 Jan 2024 02:44:47 +0100 Subject: [PATCH] Sort `the following types implement the trait` suggestion This should help external UI tests using `trybuild` by being less non-deterministic. --- .../src/traits/error_reporting/suggestions.rs | 1 + 1 file changed, 1 insertion(+) 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::>(); + types.sort(); let post = if types.len() > 9 { types.truncate(8); format!("\nand {} others", len - 8)