Skip to content

Commit

Permalink
Fix rebase and sort assoc type list for deterministic output
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Dec 25, 2019
1 parent 93fb219 commit 621d7e9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
2 changes: 2 additions & 0 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-23595-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ trait Hierarchy {
type Value;
type ChildKey;
type Children = dyn Index<Self::ChildKey, Output=dyn Hierarchy>;
//~^ 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)>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ fn dent<C:BoxCar>(c: C, color: C::Color) {

fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
//~^ 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:BoxCar>(c: C, d: C::Color) {
//~^ ERROR ambiguous associated type `Color` in bounds of `C`
}

fn dent_object_2<COLOR>(c: dyn BoxCar) where <dyn BoxCar as Vehicle>::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<X, COLOR>(c: X)
Expand Down
Original file line number Diff line number Diff line change
@@ -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<COLOR>(c: dyn BoxCar) where <dyn BoxCar as Vehicle>::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
Expand Down Expand Up @@ -45,7 +45,7 @@ LL | fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
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;
Expand Down Expand Up @@ -80,7 +80,7 @@ help: use fully qualified syntax to disambiguate
LL | fn paint<C:BoxCar>(c: C, d: <C as Vehicle>::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;
Expand Down
18 changes: 9 additions & 9 deletions src/test/ui/associated-types/missing-associated-types.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ LL | type Foo<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs>;
| 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
Expand Down Expand Up @@ -38,8 +38,8 @@ LL | type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>;
| 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
Expand Down Expand Up @@ -74,8 +74,8 @@ LL | type Baz<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Y<Rhs>;
| 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
Expand All @@ -102,8 +102,8 @@ LL | type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
| 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<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
| ^^^^^^^^ ^^^^^^^^ associated type `Output` must be specified
Expand All @@ -115,7 +115,7 @@ help: specify the associated types
LL | type Bat<Rhs> = dyn Add<Rhs, Output = Type> + Sub<Rhs, Output = Type> + Fine<Rhs>;
| ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^

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<Rhs> = dyn X<Rhs>;
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/issues/issue-22560.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 621d7e9

Please sign in to comment.