Use PredicateObligations instead of Predicates

Keep more information about trait binding failures.
This commit is contained in:
Esteban Küber 2020-03-03 15:07:04 -08:00
parent 485c5fb6e1
commit bd7ea5441e
90 changed files with 280 additions and 141 deletions

View file

@ -4,4 +4,9 @@ fn ho_func(f: Option<FuncType>) {
//~^ ERROR the size for values of type
}
enum Option<T> {
Some(T),
None,
}
fn main() {}

View file

@ -3,10 +3,12 @@ error[E0277]: the size for values of type `dyn for<'r> std::ops::Fn(&'r isize) -
|
LL | fn ho_func(f: Option<FuncType>) {
| ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
...
LL | enum Option<T> {
| ------ - required by this bound in `Option`
|
= help: the trait `std::marker::Sized` is not implemented for `dyn for<'r> std::ops::Fn(&'r isize) -> isize`
= 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 by `std::option::Option`
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0277]: the size for values of type `Self` cannot be known at compilation
--> $DIR/issue-20005.rs:10:49
|
LL | trait From<Src> {
| --------------- required by `From`
| ---- --- required by this bound in `From`
...
LL | ) -> <Dst as From<Self>>::Result where Dst: From<Self> {
| ^^^^^^^^^^- help: consider further restricting `Self`: `, Self: std::marker::Sized`

View file

@ -10,7 +10,7 @@ error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<N
--> $DIR/issue-20413.rs:8:36
|
LL | trait Foo {
| --------- required by `Foo`
| --------- required by this bound in `Foo`
...
LL | impl<T> Foo for T where NoData<T>: Foo {
| ^^^
@ -148,7 +148,7 @@ error[E0275]: overflow evaluating the requirement `NoData<NoData<NoData<NoData<N
--> $DIR/issue-20413.rs:8:36
|
LL | trait Foo {
| --------- required by `Foo`
| --------- required by this bound in `Foo`
...
LL | impl<T> Foo for T where NoData<T>: Foo {
| ^^^

View file

@ -3,10 +3,14 @@ error[E0277]: the size for values of type `[i32]` cannot be known at compilation
|
LL | fn iceman(c: Vec<[i32]>) {}
| ^^^^^^^^^^ doesn't have a size known at compile-time
|
::: $SRC_DIR/liballoc/vec.rs:LL:COL
|
LL | pub struct Vec<T> {
| - required by this bound in `std::vec::Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `[i32]`
= 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 by `std::vec::Vec`
error: aborting due to previous error

View file

@ -2,7 +2,7 @@ error[E0277]: the trait bound `T: Bound` is not satisfied
--> $DIR/issue-21837.rs:8:9
|
LL | pub struct Foo<T: Bound>(T);
| ---------------------------- required by `Foo`
| --- ----- required by this bound in `Foo`
...
LL | impl<T> Trait2 for Foo<T> {}
| ^^^^^^ the trait `Bound` is not implemented for `T`

View file

@ -2,7 +2,7 @@ error[E0283]: type annotations needed
--> $DIR/issue-21974.rs:11:19
|
LL | trait Foo {
| --------- required by `Foo`
| --------- required by this bound in `Foo`
...
LL | where &'a T : Foo,
| ^^^ cannot infer type for reference `&'a T`

View file

@ -5,4 +5,8 @@ impl Struct {
//~^ ERROR the size for values of type
}
struct Vec<T> {
t: T,
}
fn main() {}

View file

@ -3,10 +3,12 @@ error[E0277]: the size for values of type `(dyn std::ops::Fn() + 'static)` canno
|
LL | pub fn function(funs: Vec<dyn Fn() -> ()>) {}
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
...
LL | struct Vec<T> {
| --- - required by this bound in `Vec`
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() + '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 by `std::vec::Vec`
error: aborting due to previous error

View file

@ -2,7 +2,9 @@ error[E0271]: type mismatch resolving `<<T as Trait>::A as MultiDispatch<i32>>::
--> $DIR/issue-24204.rs:14:12
|
LL | trait Trait: Sized {
| ------------------ required by `Trait`
| -----
LL | type A: MultiDispatch<Self::B, O = Self>;
| -------- required by this bound in `Trait`
...
LL | fn test<T: Trait<B=i32>>(b: i32) -> T where T::A: MultiDispatch<i32> { T::new(b) }
| ^^^^^^^^^^^^ expected type parameter `T`, found associated type

View file

@ -2,7 +2,7 @@ error[E0283]: type annotations needed
--> $DIR/issue-24424.rs:4:57
|
LL | trait Trait0<'l0> {}
| ----------------- required by `Trait0`
| ----------------- required by this bound in `Trait0`
LL |
LL | impl <'l0, 'l1, T0> Trait1<'l0, T0> for bool where T0 : Trait0<'l0>, T0 : Trait0<'l1> {}
| ^^^^^^^^^^^ cannot infer type for type parameter `T0`