Skip to content

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

Description

@renato-zannon

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions