Open
Description
In certain cases, rustc
will emit an error message on what appears to be valid code, claiming that
- a bound that is present is not present, and must be present
- but the bound is present and must not be present
Here is a MWE (or playground):
trait Foo<T> { type Quux; }
trait Bar<B> {
type Baz;
fn arthur() where B: Foo<Self::Baz>, B::Quux: Send;
}
impl<B> Bar<B> for () {
type Baz = ();
fn arthur() where B: Foo<()>, B::Quux: Send { }
}
This produces the pair of errors:
rustc 1.16.0 (30cf806ef 2017-03-10)
error[E0277]: the trait bound `B: Foo<()>` is not satisfied
--> <anon>:8:5
|
8 | fn arthur() where B: Foo<()>, B::Quux: Send { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo<()>` is not implemented for `B`
|
= help: consider adding a `where B: Foo<()>` bound
error[E0276]: impl has stricter requirements than trait
--> <anon>:8:5
|
4 | fn arthur() where B: Foo<Self::Baz>, B::Quux: Send;
| --------------------------------------------------- definition of `arthur` from trait
...
8 | fn arthur() where B: Foo<()>, B::Quux: Send { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `B: Foo<()>`
error: aborting due to 2 previous errors