-
Notifications
You must be signed in to change notification settings - Fork 296
Open
Description
Iter<T> acts like a &T so it's Send impl should depend on T: Sync, not T: Send.
unsafe impl<'a, T: Send> Send for Iter<'a, T> {}should be
unsafe impl<'a, T: Sync> Send for Iter<'a, T> {}Here's some example code which shouldn't compile but does.
let mut list = LinkedList::new();
list.push_back(Cell::new(0));
let mut iter_a = list.iter();
let mut iter_b = list.iter();
std::thread::scope(move |scope| {
scope.spawn(move || iter_a.next().unwrap().set(1));
scope.spawn(move || iter_b.next().unwrap().set(2));
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels