Skip to content

Commit 621d7e9

Browse files
committed
Fix rebase and sort assoc type list for deterministic output
1 parent 93fb219 commit 621d7e9

File tree

6 files changed

+21
-19
lines changed

6 files changed

+21
-19
lines changed

src/librustc_typeck/astconv.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,6 +1686,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
16861686
},
16871687
_ => {}
16881688
}
1689+
names.sort();
1690+
trait_bound_spans.sort();
16891691
let mut err = struct_span_err!(
16901692
tcx.sess,
16911693
trait_bound_spans,

src/test/compile-fail/issue-23595-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ trait Hierarchy {
66
type Value;
77
type ChildKey;
88
type Children = dyn Index<Self::ChildKey, Output=dyn Hierarchy>;
9-
//~^ ERROR: the value of the associated types `Value` (from trait `Hierarchy`), `ChildKey`
9+
//~^ ERROR: the value of the associated types
1010

1111
fn data(&self) -> Option<(Self::Value, Self::Children)>;
1212
}

src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ fn dent<C:BoxCar>(c: C, color: C::Color) {
2222

2323
fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
2424
//~^ ERROR ambiguous associated type
25-
//~| ERROR the value of the associated types `Color` (from trait `Vehicle`), `Color` (from
25+
//~| ERROR the value of the associated types
2626
}
2727

2828
fn paint<C:BoxCar>(c: C, d: C::Color) {
2929
//~^ ERROR ambiguous associated type `Color` in bounds of `C`
3030
}
3131

3232
fn dent_object_2<COLOR>(c: dyn BoxCar) where <dyn BoxCar as Vehicle>::Color = COLOR {
33-
//~^ ERROR the value of the associated types `Color` (from trait `Vehicle`), `Color` (from
34-
//~| ERROR equality constraints are not yet supported in where clauses
33+
//~^ ERROR the value of the associated types
34+
//~| ERROR equality constraints are not yet supported in `where` clauses
3535
}
3636

3737
fn dent_object_3<X, COLOR>(c: X)

src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: equality constraints are not yet supported in where clauses
1+
error: equality constraints are not yet supported in `where` clauses
22
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:46
33
|
44
LL | fn dent_object_2<COLOR>(c: dyn BoxCar) where <dyn BoxCar as Vehicle>::Color = COLOR {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not supported
66
|
7-
= note: for more information, see #20041
7+
= note: for more information, see https://github.com/rust-lang/rust/issues/20041
88

99
error[E0221]: ambiguous associated type `Color` in bounds of `C`
1010
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:19:32
@@ -45,7 +45,7 @@ LL | fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
4545
T: Box::Color = COLOR,
4646
T: Vehicle::Color = COLOR
4747

48-
error[E0191]: the value of the associated types `Color` (from trait `Vehicle`), `Color` (from trait `Box`) must be specified
48+
error[E0191]: the value of the associated types `Color` (from trait `Box`), `Color` (from trait `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 Vehicle>::Color) {
8181
| ^^^^^^^^^^^^^^^^^^^^^
8282

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

src/test/ui/associated-types/missing-associated-types.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ LL | type Foo<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs>;
99
| first non-auto trait
1010
| trait alias used in trait object type (first use)
1111

12-
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
13-
--> $DIR/missing-associated-types.rs:12:52
12+
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
13+
--> $DIR/missing-associated-types.rs:12:21
1414
|
1515
LL | type A;
1616
| ------- `A` defined here
@@ -38,8 +38,8 @@ LL | type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>;
3838
| first non-auto trait
3939
| trait alias used in trait object type (first use)
4040

41-
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
42-
--> $DIR/missing-associated-types.rs:15:43
41+
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
42+
--> $DIR/missing-associated-types.rs:15:21
4343
|
4444
LL | type A;
4545
| ------- `A` defined here
@@ -74,8 +74,8 @@ LL | type Baz<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Y<Rhs>;
7474
| first non-auto trait
7575
| trait alias used in trait object type (first use)
7676

77-
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
78-
--> $DIR/missing-associated-types.rs:18:32
77+
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
78+
--> $DIR/missing-associated-types.rs:18:21
7979
|
8080
LL | type A;
8181
| ------- `A` defined here
@@ -102,8 +102,8 @@ LL | type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
102102
| first non-auto trait
103103
| trait alias used in trait object type (first use)
104104

105-
error[E0191]: the value of the associated types `Output` (from trait `std::ops::Sub`), `Output` (from trait `std::ops::Add`) must be specified
106-
--> $DIR/missing-associated-types.rs:21:32
105+
error[E0191]: the value of the associated types `Output` (from trait `std::ops::Add`), `Output` (from trait `std::ops::Sub`) must be specified
106+
--> $DIR/missing-associated-types.rs:21:21
107107
|
108108
LL | type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
109109
| ^^^^^^^^ ^^^^^^^^ associated type `Output` must be specified
@@ -115,7 +115,7 @@ help: specify the associated types
115115
LL | type Bat<Rhs> = dyn Add<Rhs, Output = Type> + Sub<Rhs, Output = Type> + Fine<Rhs>;
116116
| ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^
117117

118-
error[E0191]: the value of the associated types `Output` (from trait `std::ops::Mul`), `Output` (from trait `std::ops::Div`) must be specified
118+
error[E0191]: the value of the associated types `Output` (from trait `std::ops::Div`), `Output` (from trait `std::ops::Mul`) must be specified
119119
--> $DIR/missing-associated-types.rs:24:21
120120
|
121121
LL | type Bal<Rhs> = dyn X<Rhs>;

src/test/ui/issues/issue-22560.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ LL | type Test = dyn Add + Sub;
3535
| first non-auto trait
3636
| trait alias used in trait object type (first use)
3737

38-
error[E0191]: the value of the associated types `Output` (from trait `Sub`), `Output` (from trait `Add`) must be specified
39-
--> $DIR/issue-22560.rs:9:23
38+
error[E0191]: the value of the associated types `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified
39+
--> $DIR/issue-22560.rs:9:17
4040
|
4141
LL | type Output;
4242
| ------------ `Output` defined here

0 commit comments

Comments
 (0)