diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 8f6940cc0ce..d28af783c0b 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1686,6 +1686,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { }, _ => {} } + names.sort(); + trait_bound_spans.sort(); let mut err = struct_span_err!( tcx.sess, trait_bound_spans, diff --git a/src/test/compile-fail/issue-23595-1.rs b/src/test/compile-fail/issue-23595-1.rs index 1970b9af14e..483c205f42d 100644 --- a/src/test/compile-fail/issue-23595-1.rs +++ b/src/test/compile-fail/issue-23595-1.rs @@ -6,7 +6,7 @@ trait Hierarchy { type Value; type ChildKey; type Children = dyn Index; - //~^ ERROR: the value of the associated types `Value` (from trait `Hierarchy`), `ChildKey` + //~^ ERROR: the value of the associated types fn data(&self) -> Option<(Self::Value, Self::Children)>; } diff --git a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs index 77ed784f1fa..df19332b645 100644 --- a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs +++ b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs @@ -22,7 +22,7 @@ fn dent(c: C, color: C::Color) { fn dent_object(c: dyn BoxCar) { //~^ ERROR ambiguous associated type - //~| ERROR the value of the associated types `Color` (from trait `Vehicle`), `Color` (from + //~| ERROR the value of the associated types } fn paint(c: C, d: C::Color) { @@ -30,8 +30,8 @@ fn paint(c: C, d: C::Color) { } fn dent_object_2(c: dyn BoxCar) where ::Color = COLOR { - //~^ ERROR the value of the associated types `Color` (from trait `Vehicle`), `Color` (from - //~| ERROR equality constraints are not yet supported in where clauses + //~^ ERROR the value of the associated types + //~| ERROR equality constraints are not yet supported in `where` clauses } fn dent_object_3(c: X) diff --git a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr index 8eb296d4998..c60d5f8f2c8 100644 --- a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr +++ b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr @@ -1,10 +1,10 @@ -error: equality constraints are not yet supported in where clauses +error: equality constraints are not yet supported in `where` clauses --> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:46 | LL | fn dent_object_2(c: dyn BoxCar) where ::Color = COLOR { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not supported | - = note: for more information, see #20041 + = note: for more information, see https://github.com/rust-lang/rust/issues/20041 error[E0221]: ambiguous associated type `Color` in bounds of `C` --> $DIR/associated-type-projection-from-multiple-supertraits.rs:19:32 @@ -45,7 +45,7 @@ LL | fn dent_object(c: dyn BoxCar) { T: Box::Color = COLOR, T: Vehicle::Color = COLOR -error[E0191]: the value of the associated types `Color` (from trait `Vehicle`), `Color` (from trait `Box`) must be specified +error[E0191]: the value of the associated types `Color` (from trait `Box`), `Color` (from trait `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` (from trait `Vehicle`), `Color` (from trait `Box`) must be specified +error[E0191]: the value of the associated types `Color` (from trait `Box`), `Color` (from trait `Vehicle`) must be specified --> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:32 | LL | type Color; diff --git a/src/test/ui/associated-types/missing-associated-types.stderr b/src/test/ui/associated-types/missing-associated-types.stderr index 7d5207fa321..f9951170acd 100644 --- a/src/test/ui/associated-types/missing-associated-types.stderr +++ b/src/test/ui/associated-types/missing-associated-types.stderr @@ -9,8 +9,8 @@ LL | type Foo = dyn Add + Sub + X + Y; | first non-auto trait | trait alias used in trait object type (first use) -error[E0191]: the value of the associated types `A` (from trait `Y`), `Output` (from trait `std::ops::Mul`), `Output` (from trait `std::ops::Add`), `Output` (from trait `std::ops::Sub`) must be specified - --> $DIR/missing-associated-types.rs:12:52 +error[E0191]: the value of the associated types `A` (from trait `Y`), `Output` (from trait `std::ops::Add`), `Output` (from trait `std::ops::Mul`), `Output` (from trait `std::ops::Sub`) must be specified + --> $DIR/missing-associated-types.rs:12:21 | LL | type A; | ------- `A` defined here @@ -38,8 +38,8 @@ LL | type Bar = dyn Add + Sub + X + Z; | first non-auto trait | trait alias used in trait object type (first use) -error[E0191]: the value of the associated types `Output` (from trait `std::ops::Mul`), `Output` (from trait `std::ops::Div`), `Output` (from trait `std::ops::Sub`), `A` (from trait `Z`), `B` (from trait `Z`), `Output` (from trait `std::ops::Div`), `Output` (from trait `std::ops::Add`) must be specified - --> $DIR/missing-associated-types.rs:15:43 +error[E0191]: the value of the associated types `A` (from trait `Z`), `B` (from trait `Z`), `Output` (from trait `std::ops::Add`), `Output` (from trait `std::ops::Div`), `Output` (from trait `std::ops::Div`), `Output` (from trait `std::ops::Mul`), `Output` (from trait `std::ops::Sub`) must be specified + --> $DIR/missing-associated-types.rs:15:21 | LL | type A; | ------- `A` defined here @@ -74,8 +74,8 @@ LL | type Baz = dyn Add + Sub + Y; | first non-auto trait | trait alias used in trait object type (first use) -error[E0191]: the value of the associated types `Output` (from trait `std::ops::Sub`), `A` (from trait `Y`), `Output` (from trait `std::ops::Add`) must be specified - --> $DIR/missing-associated-types.rs:18:32 +error[E0191]: the value of the associated types `A` (from trait `Y`), `Output` (from trait `std::ops::Add`), `Output` (from trait `std::ops::Sub`) must be specified + --> $DIR/missing-associated-types.rs:18:21 | LL | type A; | ------- `A` defined here @@ -102,8 +102,8 @@ LL | type Bat = dyn Add + Sub + Fine; | first non-auto trait | trait alias used in trait object type (first use) -error[E0191]: the value of the associated types `Output` (from trait `std::ops::Sub`), `Output` (from trait `std::ops::Add`) must be specified - --> $DIR/missing-associated-types.rs:21:32 +error[E0191]: the value of the associated types `Output` (from trait `std::ops::Add`), `Output` (from trait `std::ops::Sub`) must be specified + --> $DIR/missing-associated-types.rs:21:21 | LL | type Bat = dyn Add + Sub + Fine; | ^^^^^^^^ ^^^^^^^^ associated type `Output` must be specified @@ -115,7 +115,7 @@ help: specify the associated types LL | type Bat = dyn Add + Sub + Fine; | ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ -error[E0191]: the value of the associated types `Output` (from trait `std::ops::Mul`), `Output` (from trait `std::ops::Div`) must be specified +error[E0191]: the value of the associated types `Output` (from trait `std::ops::Div`), `Output` (from trait `std::ops::Mul`) must be specified --> $DIR/missing-associated-types.rs:24:21 | LL | type Bal = dyn X; diff --git a/src/test/ui/issues/issue-22560.stderr b/src/test/ui/issues/issue-22560.stderr index bf80b24fa56..e5e50ddd155 100644 --- a/src/test/ui/issues/issue-22560.stderr +++ b/src/test/ui/issues/issue-22560.stderr @@ -35,8 +35,8 @@ LL | type Test = dyn Add + Sub; | first non-auto trait | trait alias used in trait object type (first use) -error[E0191]: the value of the associated types `Output` (from trait `Sub`), `Output` (from trait `Add`) must be specified - --> $DIR/issue-22560.rs:9:23 +error[E0191]: the value of the associated types `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified + --> $DIR/issue-22560.rs:9:17 | LL | type Output; | ------------ `Output` defined here