Skip to content
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

collections: Remove all collections traits #18474

Closed
wants to merge 1 commit into from

Conversation

alexcrichton
Copy link
Member

As part of the collections reform RFC, this commit removes all collections
traits in favor of inherent methods on collections themselves. All methods
should continue to be available on all collections.

This is a breaking change with all of the collections traits being removed and
no longer being in the prelude. In order to update old code you should move the
trait implementations to inherent implementations directly on the type itself.

Note that some traits had default methods which will also need to be implemented
to maintain backwards compatibility.

[breaking-change]
cc #18424

@rust-highfive
Copy link
Collaborator

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@alexcrichton alexcrichton mentioned this pull request Oct 31, 2014
24 tasks
@Gankra
Copy link
Contributor

Gankra commented Oct 31, 2014

I'm building off this specualtively. Got this:

C:\users\alexis\documents\github\rust\src\libstd\rand\os.rs:133:9: 133:37 error: unresolved import `core_collections::Collection`. There is no `Collection` in `core_collections`
C:\users\alexis\documents\github\rust\src\libstd\rand\os.rs:133     use core_collections::Collection;
                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\users\alexis\documents\github\rust\src\libstd\dynamic_lib.rs:282:9: 282:32 error: unresolved import `collections::MutableSeq`. There is no `MutableSeq` in `collections`
C:\users\alexis\documents\github\rust\src\libstd\dynamic_lib.rs:282     use collections::MutableSeq;
                                                                            ^~~~~~~~~~~~~~~~~~~~~~~
C:\users\alexis\documents\github\rust\src\libstd\rt\backtrace.rs:660:9: 660:37 error: unresolved import `core_collections::Collection`. There is no `Collection` in `core_collections`
C:\users\alexis\documents\github\rust\src\libstd\rt\backtrace.rs:660     use core_collections::Collection;
                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 3 previous errors

@Gankra
Copy link
Contributor

Gankra commented Oct 31, 2014

@alexcrichton Ah, these are #[cfg(windows)] things. That explains why you missed 'em.

@alexcrichton
Copy link
Member Author

Thanks for the heads up @gankro! I've updated to hopefully compile on windows as well now

@Gankra
Copy link
Contributor

Gankra commented Oct 31, 2014

ack, and now you have merge conflicts. So many collection changes 😭

// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! Container traits for collections.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how this comment relates to the rest of the file.

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Oct 31, 2014
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Oct 31, 2014
@sfackler
Copy link
Member

sfackler commented Nov 1, 2014

Needs a rebase

@Gankra
Copy link
Contributor

Gankra commented Nov 1, 2014

Look, @bors. I know you really like generic collection programming, but you've gotta let go. Just... come on. 😞

As part of the collections reform RFC, this commit removes all collections
traits in favor of inherent methods on collections themselves. All methods
should continue to be available on all collections.

This is a breaking change with all of the collections traits being removed and
no longer being in the prelude. In order to update old code you should move the
trait implementations to inherent implementations directly on the type itself.

Note that some traits had default methods which will also need to be implemented
to maintain backwards compatibility.

[breaking-change]
cc rust-lang#18424
michaelsproul added a commit to michaelsproul/rust-typemap that referenced this pull request Nov 1, 2014
michaelsproul added a commit to michaelsproul/rust-typemap that referenced this pull request Nov 1, 2014
michaelsproul added a commit to michaelsproul/rust-typemap that referenced this pull request Nov 1, 2014
bors added a commit that referenced this pull request Nov 1, 2014
As part of the collections reform RFC, this commit removes all collections
traits in favor of inherent methods on collections themselves. All methods
should continue to be available on all collections.

This is a breaking change with all of the collections traits being removed and
no longer being in the prelude. In order to update old code you should move the
trait implementations to inherent implementations directly on the type itself.

Note that some traits had default methods which will also need to be implemented
to maintain backwards compatibility.

[breaking-change]
cc #18424
@bors bors closed this Nov 1, 2014
@Gankra
Copy link
Contributor

Gankra commented Nov 1, 2014

Awesome! Building my patch now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants