Presort restrictions to make output consistent

This commit is contained in:
Yuki Okushi 2020-07-31 09:03:14 +09:00
parent 438c59f010
commit 1629fed4c0
No known key found for this signature in database
GPG Key ID: B0986C85C0E2DAA1
1 changed files with 4 additions and 1 deletions

View File

@ -678,6 +678,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
.collect::<Vec<(usize, String)>>(); .collect::<Vec<(usize, String)>>();
for ((span, empty_where), obligations) in type_params.into_iter() { for ((span, empty_where), obligations) in type_params.into_iter() {
restrict_type_params = true; 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( err.span_suggestion_verbose(
span, span,
&format!( &format!(
@ -688,7 +691,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
format!( format!(
"{} {}", "{} {}",
if empty_where { " where" } else { "," }, if empty_where { " where" } else { "," },
obligations.into_iter().collect::<Vec<_>>().join(", ") obligations.join(", ")
), ),
Applicability::MaybeIncorrect, Applicability::MaybeIncorrect,
); );