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

Fix missing const for inherent pointer replace methods #136877

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sky9x
Copy link
Contributor

@Sky9x Sky9x commented Feb 11, 2025

ptr::replace (the free fn) is already const stable. However, there are inherent convenience methods on *mut T and NonNull<T>, allowing you to write eg. unsafe { foo.replace(bar) } where foo is *mut T or NonNull<T>.

It seems const was never added to the inherent method (likely oversight), so this PR adds it.
I don't believe this needs another1 FCP as the inherent methods are already stable and ptr::replace is already const stable, so this adds no new API.

Original tracking issue: #83164
ptr::replace constified in #83091
ptr::replace const stabilized in #130954

Footnotes

  1. const_replace FCP completed: https://github.com/rust-lang/rust/issues/83164#issuecomment-2385670050

@rustbot
Copy link
Collaborator

rustbot commented Feb 11, 2025

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 11, 2025
@Sky9x
Copy link
Contributor Author

Sky9x commented Feb 11, 2025

@rustbot label +T-libs-api

@rustbot rustbot added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Feb 11, 2025
@jhpratt
Copy link
Member

jhpratt commented Feb 11, 2025

I agree that this seems like an oversight and doesn't need another FCP, but I'll defer to @rust-lang/libs-api as it is ultimately their decision. r=me if they're fine with it.

@dtolnay dtolnay removed the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Feb 11, 2025
@dtolnay
Copy link
Member

dtolnay commented Feb 11, 2025

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Feb 11, 2025

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 Feb 11, 2025
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. proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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.

5 participants