Closed
Description
The following code:
fn is_send<T: Send>(val: T) {}
fn use_impl_sync(val: impl Sync) {
is_send(val);
}
gives the following error:
error[E0277]: `impl Sync` cannot be sent between threads safely
--> src/lib.rs:4:5
|
1 | fn is_send<T: Send>(val: T) {}
| --------------------------- required by `is_send`
...
4 | is_send(val);
| ^^^^^^^ `impl Sync` cannot be sent between threads safely
|
= help: the trait `std::marker::Send` is not implemented for `impl Sync`
= help: consider adding a `where impl Sync: std::marker::Send` bound
The suggestion where impl Sync: std::marker::Send
is invalid: it should be impl Sync + Send
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: Suggestions generated by the compiler applied by `cargo fix`Area: Trait systemCategory: This is a bug.Diagnostics: A structured suggestion resulting in incorrect code.Relevant to the compiler team, which will review and decide on the PR/issue.