Remove AssocTypeBound and propagate bound Spans

This commit is contained in:
Esteban Küber 2020-04-09 13:07:22 -07:00
parent ad1c23c993
commit 6bc55c701f
17 changed files with 106 additions and 287 deletions

View file

@ -28,7 +28,7 @@ LL | fn dent<C:BoxCar>(c: C, color: <C as Vehicle>::Color) {
| ^^^^^^^^^^^^^^^^^^^^^
error[E0222]: ambiguous associated type `Color` in bounds of `BoxCar`
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:30
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:37
|
LL | type Color;
| ----------- ambiguous `Color` from `Vehicle`
@ -37,7 +37,7 @@ LL | type Color;
| ----------- ambiguous `Color` from `Box`
...
LL | fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {
| ^^^^^^^^^^^^^^^^^^^ ambiguous associated type `Color`
| ^^^^^^^^^^^ ambiguous associated type `Color`
|
= help: consider introducing a new type parameter `T` and adding `where` constraints:
where

View file

@ -1,39 +1,37 @@
error[E0277]: the trait bound `bool: Bar` is not satisfied
--> $DIR/point-at-type-on-obligation-failure-2.rs:8:5
--> $DIR/point-at-type-on-obligation-failure-2.rs:8:18
|
LL | trait Foo {
| ---
LL | type Assoc: Bar;
| ----- associated type defined here
| --- required by this bound in `Foo`
...
LL | impl Foo for () {
| --------------- in this `impl` item
LL | type Assoc = bool;
| ^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `bool`
| ^^^^ the trait `Bar` is not implemented for `bool`
|
= note: required because of the requirements on the impl of `Bar` for `<() as Foo>::Assoc`
error[E0277]: the trait bound `bool: Bar` is not satisfied
--> $DIR/point-at-type-on-obligation-failure-2.rs:16:5
--> $DIR/point-at-type-on-obligation-failure-2.rs:16:18
|
LL | trait Baz where Self::Assoc: Bar {
| ---------------- restricted in this bound
LL | type Assoc;
| ----- associated type defined here
| --- required by this bound in `Baz`
...
LL | impl Baz for () {
| --------------- in this `impl` item
LL | type Assoc = bool;
| ^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `bool`
| ^^^^ the trait `Bar` is not implemented for `bool`
|
= note: required because of the requirements on the impl of `Bar` for `<() as Baz>::Assoc`
error[E0277]: the trait bound `bool: Bar` is not satisfied
--> $DIR/point-at-type-on-obligation-failure-2.rs:24:5
--> $DIR/point-at-type-on-obligation-failure-2.rs:24:18
|
LL | trait Bat where <Self as Bat>::Assoc: Bar {
| ------------------------- restricted in this bound
LL | type Assoc;
| ----- associated type defined here
| --- required by this bound in `Bat`
...
LL | impl Bat for () {
| --------------- in this `impl` item
LL | type Assoc = bool;
| ^^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `bool`
| ^^^^ the trait `Bar` is not implemented for `bool`
|
= note: required because of the requirements on the impl of `Bar` for `<() as Bat>::Assoc`
error: aborting due to 3 previous errors

View file

@ -1,13 +1,8 @@
error[E0271]: type mismatch resolving `<Foo2 as Bar2>::Ok == ()`
--> $DIR/point-at-type-on-obligation-failure.rs:13:5
--> $DIR/point-at-type-on-obligation-failure.rs:13:15
|
LL | type Ok;
| -- associated type defined here
...
LL | impl Bar for Foo {
| ---------------- in this `impl` item
LL | type Ok = ();
| ^^^^^^^^^^^^^ expected `u32`, found `()`
| ^^ expected `u32`, found `()`
error: aborting due to previous error

View file

@ -1,19 +1,12 @@
error[E0271]: type mismatch resolving `for<'a> <<T as Baz>::Baa<'a> as std::ops::Deref>::Target == <<T as Baz>::Quux<'a> as Foo>::Bar<'a, 'static>`
--> $DIR/construct_with_other_type.rs:19:9
|
LL | trait Baz {
| ---
...
LL | type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>> where Self: 'a;
| -------------------------------------------------- required by this bound in `Baz`
...
LL | impl<T> Baz for T where T: Foo {
| ^^^ expected type parameter `T`, found associated type
|
= note: expected associated type `<T as Foo>::Bar<'_, 'static>`
found associated type `<<T as Baz>::Quux<'_> as Foo>::Bar<'_, 'static>`
= note: you might be missing a type parameter or trait bound
= note: required because of the requirements on the impl of `Baz` for `T`
error: aborting due to previous error

View file

@ -1,15 +1,8 @@
error[E0271]: type mismatch resolving `for<'a> <<std::vec::Vec<T> as Iterable>::Iter<'a> as std::iter::Iterator>::Item == <std::vec::Vec<T> as Iterable>::Item<'a>`
--> $DIR/iterable.rs:15:5
--> $DIR/iterable.rs:15:33
|
LL | impl<T> Iterable for Vec<T> {
| --------------------------- in this `impl` item
LL | type Item<'a> where T: 'a = <std::slice::Iter<'a, T> as Iterator>::Item;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found associated type
|
::: $SRC_DIR/libcore/iter/traits/iterator.rs:LL:COL
|
LL | type Item;
| ---- associated type defined here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found associated type
|
= note: expected reference `&T`
found associated type `<std::vec::Vec<T> as Iterable>::Item<'_>`
@ -17,17 +10,10 @@ LL | type Item;
= note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
error[E0271]: type mismatch resolving `for<'a> <<[T] as Iterable>::Iter<'a> as std::iter::Iterator>::Item == <[T] as Iterable>::Item<'a>`
--> $DIR/iterable.rs:27:5
--> $DIR/iterable.rs:27:33
|
LL | impl<T> Iterable for [T] {
| ------------------------ in this `impl` item
LL | type Item<'a> where T: 'a = <std::slice::Iter<'a, T> as Iterator>::Item;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found associated type
|
::: $SRC_DIR/libcore/iter/traits/iterator.rs:LL:COL
|
LL | type Item;
| ---- associated type defined here
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected reference, found associated type
|
= note: expected reference `&T`
found associated type `<[T] as Iterable>::Item<'_>`

View file

@ -1,14 +1,10 @@
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/issue-43784-associated-type.rs:14:5
--> $DIR/issue-43784-associated-type.rs:14:18
|
LL | type Assoc: Partial<Self>;
| ----- associated type defined here
...
LL | impl<T> Complete for T {
| ---------------------- in this `impl` item
LL | type Assoc = T;
| ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
| ^ the trait `std::marker::Copy` is not implemented for `T`
|
= note: required because of the requirements on the impl of `std::marker::Copy` for `<T as Complete>::Assoc`
help: consider restricting type parameter `T`
|
LL | impl<T: std::marker::Copy> Complete for T {

View file

@ -1,16 +1,17 @@
error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time
--> $DIR/issue-65673.rs:9:5
--> $DIR/issue-65673.rs:9:16
|
LL | trait WithType {
| --------
LL | type Ctx;
| --- associated type defined here
| --------- required by this bound in `WithType`
...
LL | impl<T> WithType for T {
| ---------------------- in this `impl` item
LL | type Ctx = dyn Alias<T>;
| ^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
| ^^^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn Trait + 'static)`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because of the requirements on the impl of `std::marker::Sized` for `<T as WithType>::Ctx`
error: aborting due to previous error

View file

@ -13,20 +13,22 @@ LL | impl<A, T: Parent<Ty = A>> Parent for ParentWrapper<T> {
| the trait `Child<A>` is not implemented for `<T as Parent>::Assoc`
error[E0277]: the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
--> $DIR/missing-assoc-type-bound-restriction.rs:20:5
--> $DIR/missing-assoc-type-bound-restriction.rs:20:18
|
LL | trait Parent {
| ------
LL | type Ty;
LL | type Assoc: Child<Self::Ty>;
| ----- associated type defined here
| --------------- required by this bound in `Parent`
...
LL | impl<A, T: Parent<Ty = A>> Parent for ParentWrapper<T> {
| ------------------------------------------------------- help: consider further restricting the associated type: `where <T as Parent>::Assoc: Child<A>`
| |
| in this `impl` item
| - help: consider further restricting the associated type: `where <T as Parent>::Assoc: Child<A>`
...
LL | type Assoc = ChildWrapper<T::Assoc>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Child<A>` is not implemented for `<T as Parent>::Assoc`
| ^^^^^^^^^^^^^^^^^^^^^^ the trait `Child<A>` is not implemented for `<T as Parent>::Assoc`
|
= note: required because of the requirements on the impl of `Child<A>` for `ChildWrapper<<T as Parent>::Assoc>`
= note: required because of the requirements on the impl of `Child<<ParentWrapper<T> as Parent>::Ty>` for `<ParentWrapper<T> as Parent>::Assoc`
error[E0277]: the trait bound `<T as Parent>::Assoc: Child<A>` is not satisfied
--> $DIR/missing-assoc-type-bound-restriction.rs:20:5

View file

@ -7,20 +7,21 @@ LL | _parse: <ParseQuery as Query<RootDatabase>>::Data,
= note: required because of the requirements on the impl of `Query<RootDatabase>` for `ParseQuery`
error[E0275]: overflow evaluating the requirement `Runtime<RootDatabase>: std::panic::RefUnwindSafe`
--> $DIR/cycle-cache-err-60010.rs:31:5
--> $DIR/cycle-cache-err-60010.rs:31:20
|
LL | trait Database {
| --------
LL | type Storage;
| ------- associated type defined here
| ------------- required by this bound in `Database`
...
LL | impl Database for RootDatabase {
| ------------------------------ in this `impl` item
LL | type Storage = SalsaStorage;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^
|
= note: required because it appears within the type `RootDatabase`
= note: required because of the requirements on the impl of `SourceDatabase` for `RootDatabase`
= note: required because of the requirements on the impl of `Query<RootDatabase>` for `ParseQuery`
= note: required because it appears within the type `SalsaStorage`
= note: required because of the requirements on the impl of `std::marker::Sized` for `<RootDatabase as Database>::Storage`
error: aborting due to 2 previous errors

View file

@ -8,8 +8,8 @@ pub trait Foo: Iterator<Item=<Self as Foo>::Key> {
type Key;
}
impl Foo for IntoIter<i32> { //~ ERROR type mismatch
type Key = u32;
impl Foo for IntoIter<i32> {
type Key = u32; //~ ERROR type mismatch
}
fn main() {

View file

@ -1,13 +1,8 @@
error[E0271]: type mismatch resolving `<std::vec::IntoIter<i32> as std::iter::Iterator>::Item == u32`
--> $DIR/traits-assoc-type-in-supertrait-bad.rs:11:6
--> $DIR/traits-assoc-type-in-supertrait-bad.rs:12:16
|
LL | pub trait Foo: Iterator<Item=<Self as Foo>::Key> {
| ----------------------- required by this bound in `Foo`
...
LL | impl Foo for IntoIter<i32> {
| ^^^ expected `i32`, found `u32`
|
= note: required because of the requirements on the impl of `Foo` for `std::vec::IntoIter<i32>`
LL | type Key = u32;
| ^^^ expected `i32`, found `u32`
error: aborting due to previous error

View file

@ -5,10 +5,10 @@ LL | fn f<F:Trait(isize) -> isize>(x: F) {}
| ^^^^^^^^^^^^ unexpected type argument
error[E0220]: associated type `Output` not found for `Trait`
--> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:8
--> $DIR/unboxed-closure-sugar-wrong-trait.rs:5:24
|
LL | fn f<F:Trait(isize) -> isize>(x: F) {}
| ^^^^^^^^^^^^^^^^^^^^^ associated type `Output` not found
| ^^^^^ associated type `Output` not found
error: aborting due to 2 previous errors