Skip to content

Impl Default for PhantomPinned #77893

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

Conversation

petertodd
Copy link
Contributor

@petertodd petertodd commented Oct 13, 2020

PhantomPinned is just a marker type, with an obvious default value (the only value). So I can't think of a reason not to do this. Sure, it's used in exotic situations with unsafe code. But the people writing that code can decide for themselves if they can derive Default, and in many situations the derived impl will make sense:

#[derive(Default)]
struct NeedsPin {
   marker: PhantomPinned,
   buf: [u8; 1024],
   ptr_to_data: Option<*const u8>,
}

@rust-highfive
Copy link
Contributor

r? @shepmaster

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 13, 2020
@shepmaster
Copy link
Member

r? @withoutboats

@jonas-schievink jonas-schievink added needs-fcp This change is insta-stable, so needs a completed FCP to proceed. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Oct 14, 2020
@dtolnay dtolnay assigned dtolnay and unassigned withoutboats Oct 15, 2020
@dtolnay
Copy link
Member

dtolnay commented Oct 15, 2020

@rust-lang/libs: This PR adds Default for https://doc.rust-lang.org/std/marker/struct.PhantomPinned.html.
The type is a unit struct so it has a single possible value and is safe to construct, so Default seems like a no-brainer.

@rfcbot fcp merge

@rfcbot
Copy link
Collaborator

rfcbot commented Oct 15, 2020

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

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), 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 proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Oct 15, 2020
@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Nov 13, 2020
@rfcbot
Copy link
Collaborator

rfcbot commented Nov 13, 2020

🔔 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 Nov 13, 2020
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Nov 23, 2020
@rfcbot
Copy link
Collaborator

rfcbot commented Nov 23, 2020

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

The RFC will be merged soon.

@dtolnay
Copy link
Member

dtolnay commented Nov 23, 2020

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 23, 2020

📌 Commit 28f8e62 has been approved by dtolnay

@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-review Status: Awaiting review from the assignee but also interested parties. labels Nov 23, 2020
@bors
Copy link
Collaborator

bors commented Nov 23, 2020

⌛ Testing commit 28f8e62 with merge 068320b...

@bors
Copy link
Collaborator

bors commented Nov 23, 2020

☀️ Test successful - checks-actions
Approved by: dtolnay
Pushing 068320b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 23, 2020
@bors bors merged commit 068320b into rust-lang:master Nov 23, 2020
@rustbot rustbot added this to the 1.50.0 milestone Nov 23, 2020
@spastorino spastorino removed the to-announce Announce this issue on triage meeting label Dec 3, 2020
@pthariensflame
Copy link
Contributor

relnotes needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. merged-by-bors This PR was explicitly merged by bors. needs-fcp This change is insta-stable, so needs a completed FCP to proceed. 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.