You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E0277]: `<() as Bar<&'a ()>>::Assoc` cannot be sent between threads safely
--> src/lib.rs:16:5
|
16 | oops::<()>();
| ^^^^^^^^^^ `<() as Bar<&'a ()>>::Assoc` cannot be sent between threads safely
|
= help: the trait `for<'a> std::marker::Send` is not implemented for `<() as Bar<&'a ()>>::Assoc`
note: required by `oops`
--> src/lib.rs:8:1
|
8 | / fn oops<C>()
9 | | where
10 | | for<'a> C: Bar<&'a ()>,
11 | | for<'a> <C as Bar<&'a ()>>::Assoc: Send,
12 | | {
13 | | }
| |_^
The issue seems to be that the for<'a> does not "carry along" the Send bound for Assoc in the impl Bar for (). This code compiles on the other hand compiles just fine:
Notice that the only change is that 'a is now a lifetime parameter of oops, which removes the need for the for<'a>. I believe the for<'a> version should also be correct though?
The text was updated successfully, but these errors were encountered:
The following code does not compile (playground):
with
The issue seems to be that the
for<'a>
does not "carry along" theSend
bound forAssoc
in theimpl Bar for ()
. This code compiles on the other hand compiles just fine:Notice that the only change is that
'a
is now a lifetime parameter ofoops
, which removes the need for thefor<'a>
. I believe thefor<'a>
version should also be correct though?The text was updated successfully, but these errors were encountered: