Skip to content

Commit

Permalink
Auto merge of rust-lang#74965 - JohnTitor:sort-params, r=estebank
Browse files Browse the repository at this point in the history
Presort restrictions to make output consistent

The const test part is already adjusted so this should fix rust-lang#74886.
r? @estebank
  • Loading branch information
bors committed Jul 31, 2020
2 parents 3a92b99 + 1629fed commit e614f66
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/librustc_typeck/check/method/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand All @@ -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,
);
Expand Down

0 comments on commit e614f66

Please sign in to comment.