From b8a8ba9c919b76ef1e51ee42f1c7182fd1ac20cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 30 Oct 2023 22:19:17 +0000 Subject: [PATCH] Sort errors --- compiler/rustc_hir_analysis/src/astconv/errors.rs | 10 ++++++---- .../overlaping-bound-suggestion.stderr | 2 +- ...ed-type-projection-from-multiple-supertraits.stderr | 4 ++-- tests/ui/associated-types/issue-22560.stderr | 2 +- .../associated-types/missing-associated-types.stderr | 8 ++++---- .../use-type-argument-instead-of-assoc-type.stderr | 2 +- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/compiler/rustc_hir_analysis/src/astconv/errors.rs b/compiler/rustc_hir_analysis/src/astconv/errors.rs index 6e9929edc421e..32be7e0837b6d 100644 --- a/compiler/rustc_hir_analysis/src/astconv/errors.rs +++ b/compiler/rustc_hir_analysis/src/astconv/errors.rs @@ -585,9 +585,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } } - let names = names + let mut names = names .into_iter() - .map(|(trait_, assocs)| { + .map(|(trait_, mut assocs)| { + assocs.sort(); format!( "{} in `{trait_}`", match &assocs[..] { @@ -600,8 +601,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } ) }) - .collect::>() - .join(", "); + .collect::>(); + names.sort(); + let names = names.join(", "); trait_bound_spans.sort(); let mut err = struct_span_err!( diff --git a/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr index 3f170baefb7da..2a308f83731fa 100644 --- a/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr +++ b/tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr @@ -1,4 +1,4 @@ -error[E0191]: the value of the associated types `Item`, `IntoIter`, `Item` and `IntoIter` in `IntoIterator` must be specified +error[E0191]: the value of the associated types `Item`, `Item`, `IntoIter` and `IntoIter` in `IntoIterator` must be specified --> $DIR/overlaping-bound-suggestion.rs:7:13 | LL | inner: >::IntoIterator as Item>::Core, diff --git a/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr b/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr index 38906f274861e..66037054e064a 100644 --- a/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr +++ b/tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr @@ -45,7 +45,7 @@ LL | fn dent_object(c: dyn BoxCar) { T: Vehicle::Color = COLOR, T: Box::Color = COLOR -error[E0191]: the value of the associated types `Color` in `Vehicle`, `Color` in `Box` must be specified +error[E0191]: the value of the associated types `Color` in `Box`, `Color` in `Vehicle` must be specified --> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:30 | LL | type Color; @@ -80,7 +80,7 @@ help: use fully-qualified syntax to disambiguate LL | fn paint(c: C, d: ::Color) { | ~~~~~~~~~~~~ -error[E0191]: the value of the associated types `Color` in `Vehicle`, `Color` in `Box` must be specified +error[E0191]: the value of the associated types `Color` in `Box`, `Color` in `Vehicle` must be specified --> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:32 | LL | type Color; diff --git a/tests/ui/associated-types/issue-22560.stderr b/tests/ui/associated-types/issue-22560.stderr index 4cc4ee2b4a3bc..46e6e3951a5bd 100644 --- a/tests/ui/associated-types/issue-22560.stderr +++ b/tests/ui/associated-types/issue-22560.stderr @@ -9,7 +9,7 @@ LL | type Test = dyn Add + Sub; = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add + Sub {}` = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit -error[E0191]: the value of the associated types `Output` in `Sub`, `Output` in `Add` must be specified +error[E0191]: the value of the associated types `Output` in `Add`, `Output` in `Sub` must be specified --> $DIR/issue-22560.rs:9:17 | LL | type Output; diff --git a/tests/ui/associated-types/missing-associated-types.stderr b/tests/ui/associated-types/missing-associated-types.stderr index e44c5f1a8d1f1..e9669afe8c704 100644 --- a/tests/ui/associated-types/missing-associated-types.stderr +++ b/tests/ui/associated-types/missing-associated-types.stderr @@ -9,7 +9,7 @@ LL | type Foo = dyn Add + Sub + X + Y; = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add + Sub + X + Y {}` = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit -error[E0191]: the value of the associated types `A` in `Y`, `Output` in `Sub`, `Output` in `Mul`, `Output` in `Add` must be specified +error[E0191]: the value of the associated types `A` in `Y`, `Output` in `Add`, `Output` in `Mul`, `Output` in `Sub` must be specified --> $DIR/missing-associated-types.rs:12:21 | LL | type A; @@ -38,7 +38,7 @@ LL | type Bar = dyn Add + Sub + X + Z; = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add + Sub + X + Z {}` = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit -error[E0191]: the value of the associated types `Output` and `Output` in `Div`, `Output` in `Add`, `Output` in `Sub`, `Output` in `Mul`, `A` and `B` in `Z` must be specified +error[E0191]: the value of the associated types `A` and `B` in `Z`, `Output` and `Output` in `Div`, `Output` in `Add`, `Output` in `Mul`, `Output` in `Sub` must be specified --> $DIR/missing-associated-types.rs:15:21 | LL | type A; @@ -74,7 +74,7 @@ LL | type Baz = dyn Add + Sub + Y; = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add + Sub + Y {}` = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit -error[E0191]: the value of the associated types `Output` in `Sub`, `A` in `Y`, `Output` in `Add` must be specified +error[E0191]: the value of the associated types `A` in `Y`, `Output` in `Add`, `Output` in `Sub` must be specified --> $DIR/missing-associated-types.rs:18:21 | LL | type A; @@ -102,7 +102,7 @@ LL | type Bat = dyn Add + Sub + Fine; = help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add + Sub + Fine {}` = note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit -error[E0191]: the value of the associated types `Output` in `Sub`, `Output` in `Add` must be specified +error[E0191]: the value of the associated types `Output` in `Add`, `Output` in `Sub` must be specified --> $DIR/missing-associated-types.rs:21:21 | LL | type Bat = dyn Add + Sub + Fine; diff --git a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr index de828c7659dce..7c84dd4b8ff33 100644 --- a/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr +++ b/tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr @@ -14,7 +14,7 @@ help: replace the generic bounds with the associated types LL | i: Box>, | +++ +++ -error[E0191]: the value of the associated types `A` and `C` in `T` must be specified +error[E0191]: the value of the associated types `C` and `A` in `T` must be specified --> $DIR/use-type-argument-instead-of-assoc-type.rs:7:16 | LL | type A;