Closed
Description
The IntoIter
iterator on Vec
s (and possibly other collections, though I haven't checked) isn't Send
anymore, even though I think it could be - it seems to drop the remaining elements and deallocate the memory when dropped, and doesn't refer to anything on the stack.
Reproduction:
fn main() {
let vec = vec![1, 2, 3];
typecheck_me(vec.into_iter());
}
fn typecheck_me<T>(_: T) where T: Send {}
The program above produces following error message when compiled:
sender.rs:3:5: 3:17 error: the trait `core::marker::Send` is not implemented for the type `*mut _`
sender.rs:3 typecheck_me(vec.into_iter());
^~~~~~~~~~~~
sender.rs:3:5: 3:17 error: the trait `core::marker::Send` is not implemented for the type `*const _`
sender.rs:3 typecheck_me(vec.into_iter());
Which is not very helpful, especially when IntoIter
is several levels deep on the object being sent (which was my case)