Skip to content

Implement low-hanging fruit of collection conventions #18605

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

Merged
merged 2 commits into from
Nov 7, 2014

Conversation

Gankra
Copy link
Contributor

@Gankra Gankra commented Nov 4, 2014

Implement low-hanging fruit of collection conventions

  • Renames/deprecates the simplest and most obvious methods

  • Adds FIXME(conventions)s for outstanding work

  • Marks "handled" methods as unstable

    NOTE: the semantics of reserve and reserve_exact have changed!
    Other methods have had their semantics changed as well, but in a
    way that should obviously not typecheck if used incorrectly.

    Lots of work and breakage to come, but this handles most of the core
    APIs and most eggregious breakage. Future changes should mostly focus on
    niche collections, APIs, or simply back-compat additions.

    [breaking-change]

r? @aturon

@rust-highfive
Copy link
Contributor

warning Warning warning

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

@Gankra Gankra mentioned this pull request Nov 4, 2014
24 tasks
@Gankra
Copy link
Contributor Author

Gankra commented Nov 4, 2014

Rebased from merge conflict. Note to self: handle @thestinger's notes about future semantics of reserve_exact.

@aturon
Copy link
Member

aturon commented Nov 4, 2014

Really great work @gankro! I just left a few minor comments, r=me after those and a squash.

@Gankra Gankra force-pushed the collect-fruit branch 2 times, most recently from 5600b71 to 8a02137 Compare November 5, 2014 13:34
@Gankra
Copy link
Contributor Author

Gankra commented Nov 5, 2014

Rebased.

@Gankra Gankra force-pushed the collect-fruit branch 2 times, most recently from 171aa8d to 2be71db Compare November 6, 2014 14:32
@aturon
Copy link
Member

aturon commented Nov 6, 2014

@gankro Needs moar rebase

@Gankra
Copy link
Contributor Author

Gankra commented Nov 6, 2014

👿

@Gankra
Copy link
Contributor Author

Gankra commented Nov 6, 2014

Still working on resolving the like a million check errors acrichto found.

@Gankra
Copy link
Contributor Author

Gankra commented Nov 6, 2014

There were so many flaws with my previous two commits that I just made a third separate patch to handle them all. Most of of it is just fixing method names, but there were legit bugs in VecMap and EnumSet.

I also uncovered that the old impls of reserve, reserve_exact, and capacity are completely wrong in RingBuf. I faithfully migrated their logic because fixing it is a waste of time if @csherratt's branch is just going to rewrite everything anyway. They're only "optimization" features, and are therefore unimportant to basic functionality. with_capacity works fine.

Evidently if you happen to have -j8 going when you make-check, any compilation or test failures won't actually stop the whole check process, they'll just get buried as all the other tests run happily. 😖

I'm still checking these changes (this is like my 10th rebuild), but I'm optimistic. Last failure was in the shootouts. I guess I'll have to rebuild again to confirm my rebase is correct.

@aturon
Copy link
Member

aturon commented Nov 6, 2014

@gankro Wow, this is turning out to be quite the adventure :-) Thanks for the hard work getting this out, let me know when it's good to go!

@Gankra
Copy link
Contributor Author

Gankra commented Nov 6, 2014

Made it into check-formatting. You can definitely start reviewing the third commit now. Will need to re-run everything again to confirm the rebase, though (shouldn't be a problem, the conflict was just a doc cleanup-- but someone might have added some more collections-using code in librustc).

@Gankra
Copy link
Contributor Author

Gankra commented Nov 6, 2014

Oops, missed a HEAD.

@Gankra
Copy link
Contributor Author

Gankra commented Nov 6, 2014

Yuck, now they're all throughout my history. sigh

I can rebase this into a sane state if you want. But the sum of the patches seems right. Checking...

@Gankra
Copy link
Contributor Author

Gankra commented Nov 6, 2014

It's the never-ending rebase

* Renames/deprecates the simplest and most obvious methods
* Adds FIXME(conventions)s for outstanding work
* Marks "handled" methods as unstable

NOTE: the semantics of reserve and reserve_exact have changed!
Other methods have had their semantics changed as well, but in a
way that should obviously not typecheck if used incorrectly.

Lots of work and breakage to come, but this handles most of the core
APIs and most eggregious breakage. Future changes should *mostly* focus on
niche collections, APIs, or simply back-compat additions.

[breaking-change]
@Gankra
Copy link
Contributor Author

Gankra commented Nov 6, 2014

All passed! 🌴

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Nov 6, 2014
/// Returns `true` if this `EnumSet` is included in the given `EnumSet`.
#[unstable = "matches collection reform specification, waiting for dust to settle"]
pub fn is_subset(&self, other: &EnumSet<E>) -> bool {
other.is_subset(self)
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn’t this infinite recursion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure is!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SimonSapin sent a patch to @alexcrichton for the rollup, thanks!

@bors bors merged commit eec145b into rust-lang:master Nov 7, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request Dec 11, 2024
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.

6 participants