Skip to content

CommandExt::before_exec: deprecate safety in edition 2024 #125970

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 1 commit into from
Aug 15, 2024

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Jun 4, 2024

Similar to set_var, we had to find out after 1.0 was released that before_exec should have been unsafe. We partially rectified this by deprecating that function a long time ago, but since #124636 we have the ability to also deprecate the safety of the old function and make it a hard error to call the old function outside unsafe in the next edition. So just in case anyone still uses the old function, let's ensure this can't be ignored when moving code to the new edition.

Cc @rust-lang/libs-api

Tracking:

@rustbot
Copy link
Collaborator

rustbot commented Jun 4, 2024

r? @Nilstrieb

rustbot has assigned @Nilstrieb.
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 O-unix Operating system: Unix-like 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 Jun 4, 2024
@Amanieu
Copy link
Member

Amanieu commented Jun 4, 2024

The doc comment needs to be adjusted. It's confusing at the moment since before_exec now appears as an unsafe function in the docs.

@Noratrieb
Copy link
Member

r? 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 Jun 4, 2024
@rustbot rustbot assigned joshtriplett and unassigned Noratrieb Jun 4, 2024
@tbu-
Copy link
Contributor

tbu- commented Jun 4, 2024

Needs a test. I'm not sure if this works since this isn't a free standing function.

@traviscross traviscross added the A-edition-2024 Area: The 2024 edition label Jun 4, 2024
@traviscross
Copy link
Contributor

@rustbot labels +I-libs-api-nominated

Nominating for libs-api to decide whether to make calls to CommandExt::before_exec unsafe in the Rust 2024 edition, similar to what we're doing for std::env::{set_var, remove_var}.

If we decide to do this, we'll use that same tracking issue:

@RalfJung
Copy link
Member Author

RalfJung commented Jun 8, 2024

I extended the comment and added a test. It seems to be working fine.

@joshtriplett

This comment was marked as outdated.

@rfcbot

This comment was marked as outdated.

@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 Jun 11, 2024
@joshtriplett

This comment was marked as outdated.

@joshtriplett joshtriplett removed the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jun 11, 2024
@rfcbot

This comment was marked as outdated.

@rfcbot rfcbot removed 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 Jun 11, 2024
@joshtriplett
Copy link
Member

This function directly has a comment saying that it should be unsafe, and now we have a way to do that.

@rfcbot merge

@rfcbot
Copy link
Collaborator

rfcbot commented Jun 11, 2024

Team member @joshtriplett 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.

tbu- added a commit to tbu-/rust that referenced this pull request Jul 17, 2024
Relevant for the deprecation of `CommandExt::before_exit` in rust-lang#125970.
tbu- added a commit to tbu-/rust that referenced this pull request Jul 17, 2024
Relevant for the deprecation of `CommandExt::before_exit` in rust-lang#125970.
tbu- added a commit to tbu-/rust that referenced this pull request Jul 17, 2024
Relevant for the deprecation of `CommandExt::before_exit` in rust-lang#125970.
tbu- added a commit to tbu-/rust that referenced this pull request Jul 29, 2024
Relevant for the deprecation of `CommandExt::before_exit` in rust-lang#125970.
tbu- added a commit to tbu-/rust that referenced this pull request Aug 8, 2024
Relevant for the deprecation of `CommandExt::before_exit` in rust-lang#125970.
tbu- added a commit to tbu-/rust that referenced this pull request Aug 13, 2024
Relevant for the deprecation of `CommandExt::before_exit` in rust-lang#125970.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 13, 2024
…trochenkov

Allow to customize `// TODO:` comment for deprecated safe autofix

Relevant for the deprecation of `CommandExt::before_exit` in rust-lang#125970.

Tracking:
- rust-lang#124866
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 13, 2024
…trochenkov

Allow to customize `// TODO:` comment for deprecated safe autofix

Relevant for the deprecation of `CommandExt::before_exit` in rust-lang#125970.

Tracking:
- rust-lang#124866
@traviscross
Copy link
Contributor

@rustbot labels -S-blocked +S-waiting-on-review

This had been blocked on #127857. That PR has now received an r+, so it's probably time to have another look at this.

Note that this is an edition item.

@rustbot rustbot removed the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Aug 13, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 14, 2024
Rollup merge of rust-lang#127857 - tbu-:pr_deprecated_safe_todo, r=petrochenkov

Allow to customize `// TODO:` comment for deprecated safe autofix

Relevant for the deprecation of `CommandExt::before_exit` in rust-lang#125970.

Tracking:
- rust-lang#124866
@RalfJung
Copy link
Member Author

@m-ou-se I rebased, so this should be ready for review now. :)

@m-ou-se
Copy link
Member

m-ou-se commented Aug 14, 2024

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 14, 2024

📌 Commit 5ae0386 has been approved by m-ou-se

It is now in the queue for this repository.

@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 Aug 14, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 14, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#125970 (CommandExt::before_exec: deprecate safety in edition 2024)
 - rust-lang#127905 (Add powerpc-unknown-linux-muslspe compile target)
 - rust-lang#128925 (derive(SmartPointer): register helper attributes)
 - rust-lang#128946 (Hash Ipv*Addr as an integer)
 - rust-lang#128963 (Add possibility to generate rustdoc JSON output to stdout)
 - rust-lang#129015 (Update books)
 - rust-lang#129067 (Use `append` instead of `extend(drain(..))`)
 - rust-lang#129100 (Fix dependencies cron job)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 15, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#125970 (CommandExt::before_exec: deprecate safety in edition 2024)
 - rust-lang#127905 (Add powerpc-unknown-linux-muslspe compile target)
 - rust-lang#128925 (derive(SmartPointer): register helper attributes)
 - rust-lang#128946 (Hash Ipv*Addr as an integer)
 - rust-lang#128963 (Add possibility to generate rustdoc JSON output to stdout)
 - rust-lang#129015 (Update books)
 - rust-lang#129067 (Use `append` instead of `extend(drain(..))`)
 - rust-lang#129100 (Fix dependencies cron job)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0bed4d1 into rust-lang:master Aug 15, 2024
6 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Aug 15, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 15, 2024
Rollup merge of rust-lang#125970 - RalfJung:before_exec, r=m-ou-se

CommandExt::before_exec: deprecate safety in edition 2024

Similar to `set_var`, we had to find out after 1.0 was released that `before_exec` should have been unsafe. We partially rectified this by deprecating that function a long time ago, but since rust-lang#124636 we have the ability to also deprecate the safety of the old function and make it a *hard error* to call the old function outside `unsafe` in the next edition. So just in case anyone still uses the old function, let's ensure this can't be ignored when moving code to the new edition.

Cc `@rust-lang/libs-api`

Tracking:

- rust-lang#124866
@RalfJung RalfJung deleted the before_exec branch August 18, 2024 08:53
@Urgau Urgau added the relnotes Marks issues that should be documented in the release notes of the next release. label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2024 Area: The 2024 edition 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. O-unix Operating system: Unix-like 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 Relevant to the library team, which will review and decide on the PR/issue. 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.