Closed
Description
I tried this code:
trait Duh {}
impl Duh for i32 {}
trait Trait {
type Assoc: Duh;
}
impl<R: Duh, F: FnMut() -> R> Trait for F {
type Assoc = R;
}
type Sendable = impl Send;
type Foo = impl Trait<Assoc = Sendable>;
fn foo() -> Foo {
|| 42
}
I expected to see this happen: it compiles, just like
trait Duh {}
impl Duh for i32 {}
trait Trait {
type Assoc: Duh;
}
impl<R: Duh, F: FnMut() -> R> Trait for F {
type Assoc = R;
}
type Sendable = impl Send;
fn foo() -> impl Trait<Assoc = Sendable> {
|| 42
}
Instead, this happened:
error[[E0277]](https://doc.rust-lang.org/nightly/error-index.html#E0277): the trait bound `Sendable: Duh` is not satisfied
--> src/lib.rs:19:5
|
19 | || 42
| ^^^^^ the trait `Duh` is not implemented for `Sendable`
|
= help: the trait `Duh` is implemented for `i32`
note: required for `[closure@src/lib.rs:19:5: 19:7]` to implement `Trait`
--> src/lib.rs:10:31
|
10 | impl<R: Duh, F: FnMut() -> R> Trait for F {
| ^^^^^ ^
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done