Skip to content

collections::vec::IntoIter is not Send + confusing error message #21027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
renato-zannon opened this issue Jan 12, 2015 · 1 comment · Fixed by #21036
Closed

collections::vec::IntoIter is not Send + confusing error message #21027

renato-zannon opened this issue Jan 12, 2015 · 1 comment · Fixed by #21036
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@renato-zannon
Copy link
Contributor

The IntoIter iterator on Vecs (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)

@Gankra
Copy link
Contributor

Gankra commented Jan 12, 2015

IntoIter should just be as Send as Vec. Feel free to send a PR to ammend this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants