-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
Description
use std::collections::BTreeMap;
use std::rc::Rc;
fn foo<T: Send>() {}
fn main() {
foo::<BTreeMap<Rc<()>, Rc<()>>>();
}
<anon>:5:5: 5:36 error: the trait `core::marker::Send` is not implemented for the type `alloc::rc::Rc<()>` [E0277]
<anon>:5 foo::<BTreeMap<Rc<()>, Rc<()>>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:5:5: 5:36 note: `alloc::rc::Rc<()>` cannot be sent between threads safely
<anon>:5 foo::<BTreeMap<Rc<()>, Rc<()>>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
The lack of an impl of Send for Rc is the problem, but the more pertinent problem is that BTreeMap itself is not Send. The Rc detail is a great piece of additional information, though.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints