error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
--> src/main.rs:16:11
|
16 | build(Bar);
| ----- ^^^ `impl Future<Output = ()>` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
= help: the trait `for<'a> Send` is not implemented for `impl Future<Output = ()>`
note: required by a bound in `build`
--> src/main.rs:13:41
|
13 | fn build<T>(_: T) where T: Foo<bar(..): Send> {}
| ^^^^ required by this bound in `build`
For more information about this error, try `rustc --explain E0277`.
This error message is not super clear, but it's essentially equvialent to this code:
trait Foo {
type Bar<'a> where Self: 'a;
fn bar(&self) -> Self::Bar<'_>;
}
struct Bar;
impl Foo for Bar {
type Bar<'a> = ();
fn bar(&self) {}
}
fn build<T>(_: T) where T: Foo, for<'a> T::Bar<'a>: Send {}
fn main() {
build(Bar);
}
Which results in:
error[E0277]: `<_ as Foo>::Bar<'a>` cannot be sent between threads safely
--> src/main.rs:17:11
|
17 | build(Bar);
| ----- ^^^ `<_ as Foo>::Bar<'a>` cannot be sent between threads safely
| |
| required by a bound introduced by this call
|
= help: the trait `for<'a> Send` is not implemented for `<_ as Foo>::Bar<'a>`
note: required by a bound in `build`
--> src/main.rs:14:53
|
14 | fn build<T>(_: T) where T: Foo, for<'a> T::Bar<'a>: Send {}
| ^^^^ required by this bound in `build`
So this is related to other higher-ranked projection normalization problems.
I tried this code:
I expected it to compile, instead:
This error message is not super clear, but it's essentially equvialent to this code:
Which results in:
So this is related to other higher-ranked projection normalization problems.