Skip to content

Commit b8a8ba9

Browse files
committed
Sort errors
1 parent 8c55772 commit b8a8ba9

File tree

6 files changed

+15
-13
lines changed

6 files changed

+15
-13
lines changed

compiler/rustc_hir_analysis/src/astconv/errors.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -585,9 +585,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
585585
}
586586
}
587587

588-
let names = names
588+
let mut names = names
589589
.into_iter()
590-
.map(|(trait_, assocs)| {
590+
.map(|(trait_, mut assocs)| {
591+
assocs.sort();
591592
format!(
592593
"{} in `{trait_}`",
593594
match &assocs[..] {
@@ -600,8 +601,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
600601
}
601602
)
602603
})
603-
.collect::<Vec<String>>()
604-
.join(", ");
604+
.collect::<Vec<String>>();
605+
names.sort();
606+
let names = names.join(", ");
605607

606608
trait_bound_spans.sort();
607609
let mut err = struct_span_err!(

tests/ui/associated-type-bounds/overlaping-bound-suggestion.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0191]: the value of the associated types `Item`, `IntoIter`, `Item` and `IntoIter` in `IntoIterator` must be specified
1+
error[E0191]: the value of the associated types `Item`, `Item`, `IntoIter` and `IntoIter` in `IntoIterator` must be specified
22
--> $DIR/overlaping-bound-suggestion.rs:7:13
33
|
44
LL | inner: <IntoIterator<Item: IntoIterator<Item: >>::IntoIterator as Item>::Core,

tests/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ LL | fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
4545
T: Vehicle::Color = COLOR,
4646
T: Box::Color = COLOR
4747

48-
error[E0191]: the value of the associated types `Color` in `Vehicle`, `Color` in `Box` must be specified
48+
error[E0191]: the value of the associated types `Color` in `Box`, `Color` in `Vehicle` must be specified
4949
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:30
5050
|
5151
LL | type Color;
@@ -80,7 +80,7 @@ help: use fully-qualified syntax to disambiguate
8080
LL | fn paint<C:BoxCar>(c: C, d: <C as Box>::Color) {
8181
| ~~~~~~~~~~~~
8282

83-
error[E0191]: the value of the associated types `Color` in `Vehicle`, `Color` in `Box` must be specified
83+
error[E0191]: the value of the associated types `Color` in `Box`, `Color` in `Vehicle` must be specified
8484
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:32
8585
|
8686
LL | type Color;

tests/ui/associated-types/issue-22560.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | type Test = dyn Add + Sub;
99
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add + Sub {}`
1010
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
1111

12-
error[E0191]: the value of the associated types `Output` in `Sub`, `Output` in `Add` must be specified
12+
error[E0191]: the value of the associated types `Output` in `Add`, `Output` in `Sub` must be specified
1313
--> $DIR/issue-22560.rs:9:17
1414
|
1515
LL | type Output;

tests/ui/associated-types/missing-associated-types.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | type Foo<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs>;
99
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs> {}`
1010
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
1111

12-
error[E0191]: the value of the associated types `A` in `Y`, `Output` in `Sub`, `Output` in `Mul`, `Output` in `Add` must be specified
12+
error[E0191]: the value of the associated types `A` in `Y`, `Output` in `Add`, `Output` in `Mul`, `Output` in `Sub` must be specified
1313
--> $DIR/missing-associated-types.rs:12:21
1414
|
1515
LL | type A;
@@ -38,7 +38,7 @@ LL | type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>;
3838
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs> {}`
3939
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
4040

41-
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
41+
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
4242
--> $DIR/missing-associated-types.rs:15:21
4343
|
4444
LL | type A;
@@ -74,7 +74,7 @@ LL | type Baz<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Y<Rhs>;
7474
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + Y<Rhs> {}`
7575
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
7676

77-
error[E0191]: the value of the associated types `Output` in `Sub`, `A` in `Y`, `Output` in `Add` must be specified
77+
error[E0191]: the value of the associated types `A` in `Y`, `Output` in `Add`, `Output` in `Sub` must be specified
7878
--> $DIR/missing-associated-types.rs:18:21
7979
|
8080
LL | type A;
@@ -102,7 +102,7 @@ LL | type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
102102
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + Fine<Rhs> {}`
103103
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
104104

105-
error[E0191]: the value of the associated types `Output` in `Sub`, `Output` in `Add` must be specified
105+
error[E0191]: the value of the associated types `Output` in `Add`, `Output` in `Sub` must be specified
106106
--> $DIR/missing-associated-types.rs:21:21
107107
|
108108
LL | type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;

tests/ui/suggestions/use-type-argument-instead-of-assoc-type.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ help: replace the generic bounds with the associated types
1414
LL | i: Box<dyn T<usize, usize, A = usize, C = usize, B=usize>>,
1515
| +++ +++
1616

17-
error[E0191]: the value of the associated types `A` and `C` in `T` must be specified
17+
error[E0191]: the value of the associated types `C` and `A` in `T` must be specified
1818
--> $DIR/use-type-argument-instead-of-assoc-type.rs:7:16
1919
|
2020
LL | type A;

0 commit comments

Comments
 (0)