about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-07-31 10:16:57 +0000
committerbors <bors@rust-lang.org>2020-07-31 10:16:57 +0000
commite614f66800c2b289f6c969dbabd2902e253a5e69 (patch)
tree1f2b305be9bd2e9dad64fbc0d7aa521f313260af
parent3a92b9987abd01c4b7e59c870e85beb9dd4d4aa2 (diff)
parent1629fed4c0bdc6d3246ea63a91f600bcb8874626 (diff)
downloadrust-e614f66800c2b289f6c969dbabd2902e253a5e69.tar.gz
rust-e614f66800c2b289f6c969dbabd2902e253a5e69.zip
Auto merge of #74965 - JohnTitor:sort-params, r=estebank
Presort restrictions to make output consistent

The const test part is already adjusted so this should fix #74886.
r? @estebank
-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,
                         );