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

Derive std::cmp::Reverse as Copy or Clone #47379

Merged
merged 1 commit into from
Feb 22, 2018
Merged

Conversation

da-x
Copy link
Member

@da-x da-x commented Jan 12, 2018

If the type parameter is Copy or Clone, then Reverse should be too.

If the type parameter is Copy or Clone, then `Reverse` should be too.
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @BurntSushi (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@Mark-Simulacrum
Copy link
Member

Shouldn't we add Hash and Default for this?

@shepmaster
Copy link
Member

@Mark-Simulacrum can you expand on what you mean by "for this"? Do you mean "since we are adding the Copy and Clone traits, we should also add Hash and Default?

@shepmaster shepmaster added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 13, 2018
@Mark-Simulacrum
Copy link
Member

Yes, that's what I meant. Sorry for not being clear.

@da-x
Copy link
Member Author

da-x commented Jan 13, 2018

Interesting. If there is any unwritten 'gold standard' for wrapper type deriving in libcore, then perhaps it is apparent by looking at Option, Result, and others. Perhaps we should match ourselves to them, i.e:

#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] // PartialOrd and Ord specialized here

What do you think?

EDIT: PartialOrd and Ord are specialized here.

@Mark-Simulacrum
Copy link
Member

Option also implements Default, which we should derive as well; Option needs to implement it as an enum but this struct can derive it.

@shepmaster
Copy link
Member

Actually, iterators shouldn't implement Copy. That's how it used to be before Rust 1.0, but that behavior was deemed too confusing and was removed. The explicit clone call is preferred.

@eddyb
Copy link
Member

eddyb commented Jan 15, 2018

@shepmaster I wish we had a canonical thing to point to - but it's basically blocked on a lint.

@kennytm kennytm added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jan 17, 2018
@goffrie
Copy link
Contributor

goffrie commented Jan 20, 2018

Actually, iterators shouldn't implement Copy

Reverse isn't an iterator though ;)

@kennytm
Copy link
Member

kennytm commented Jan 24, 2018

Review ping for you @BurntSushi!

@shepmaster
Copy link
Member

Reverse isn't an iterator though ;)

Haha, I was thinking std::iter::Rev, not std::cmp::Reverse, oops!

@BurntSushi
Copy link
Member

BurntSushi commented Jan 24, 2018

It seems like we probably want a Hash impl on this too. But this LGTM.

@rfcbot fcp merge

@kennytm
Copy link
Member

kennytm commented Jan 24, 2018

@BurntSushi I guess rfcbot doesn't recognize edits.

@BurntSushi
Copy link
Member

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Jan 24, 2018

Team member @BurntSushi has proposed to merge this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Jan 24, 2018
@kennytm kennytm added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 24, 2018
@shepmaster
Copy link
Member

Ping for ticky boxes, @Kimundi !

@pietroalbini
Copy link
Member

@Kimundi there is a nice checkbox in #47379 (comment) waiting for you!

@da-x
Copy link
Member Author

da-x commented Feb 14, 2018

Hey @Kimundi can you please respond?

@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Feb 16, 2018
@rfcbot
Copy link

rfcbot commented Feb 16, 2018

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Feb 16, 2018
@rfcbot
Copy link

rfcbot commented Feb 16, 2018

🔔 This is now entering its final comment period, as per the review above. 🔔

1 similar comment
@rfcbot
Copy link

rfcbot commented Feb 16, 2018

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Feb 16, 2018
@Kimundi
Copy link
Member

Kimundi commented Feb 20, 2018

Sorry! I'm really bad at staying on top of my github notifications, and I thought I had already checked this one at the last ping...

@sfackler
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Feb 20, 2018

📌 Commit 96157ef has been approved by sfackler

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Feb 20, 2018
@kennytm kennytm added the relnotes Marks issues that should be documented in the release notes of the next release. label Feb 21, 2018
@kennytm
Copy link
Member

kennytm commented Feb 21, 2018

@bors rollup

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Feb 21, 2018
Derive std::cmp::Reverse as Copy or Clone

If the type parameter is Copy or Clone, then `Reverse` should be too.
bors added a commit that referenced this pull request Feb 22, 2018
Rollup of 12 pull requests

- Successful merges: #47379, #47833, #48106, #48198, #48314, #48325, #48335, #48352, #48354, #48360, #48382, #48397
- Failed merges:
@bors bors merged commit 96157ef into rust-lang:master Feb 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.