about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-07-31 09:03:14 +0900
committerYuki Okushi <huyuumi.dev@gmail.com>2020-07-31 09:03:14 +0900
commit1629fed4c0bdc6d3246ea63a91f600bcb8874626 (patch)
tree730eadf0c91100cc34d09e4128f81645d08dd96b
parent438c59f010016a8a3a11fbcc4c18ae555d7adf94 (diff)
downloadrust-1629fed4c0bdc6d3246ea63a91f600bcb8874626.tar.gz
rust-1629fed4c0bdc6d3246ea63a91f600bcb8874626.zip
Presort restrictions to make output consistent
-rw-r--r--src/librustc_typeck/check/method/suggest.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs
index ae2cf6daf53..e69102d1995 100644
--- a/src/librustc_typeck/check/method/suggest.rs
+++ b/src/librustc_typeck/check/method/suggest.rs
@@ -678,6 +678,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                         .collect::<Vec<(usize, String)>>();
                     for ((span, empty_where), obligations) in type_params.into_iter() {
                         restrict_type_params = true;
+                        // #74886: Sort here so that the output is always the same.
+                        let mut obligations = obligations.into_iter().collect::<Vec<_>>();
+                        obligations.sort();
                         err.span_suggestion_verbose(
                             span,
                             &format!(
@@ -688,7 +691,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                             format!(
                                 "{} {}",
                                 if empty_where { " where" } else { "," },
-                                obligations.into_iter().collect::<Vec<_>>().join(", ")
+                                obligations.join(", ")
                             ),
                             Applicability::MaybeIncorrect,
                         );