Remove GetCurrentProcessId's frame_in_std check#3716
Merged
bors merged 1 commit intoJun 28, 2024
Conversation
…ecessary std frame restriction
Contributor
Author
|
@rustbot ready |
Member
|
Yeah not sure why we made that function std-only... thanks for the PR! @bors r+ |
Contributor
Contributor
Contributor
|
☀️ Test successful - checks-actions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Most of the support required to close #1727 was actually added a while back, in #2215.
However, for some reason, even though the Unix/Linux syscall equivalent has no
frame_in_std()check, the WindowsGetCurrentProcessIdcheck did. While the vast majority of use cases usestd::process::id, there's no particular reason to penalize any Windows code that is no_std or for whatever other reason choses to call the function directly (e.g. via the generated windows-sys method). The emulation should still work fine. Given there's no reason not to, we might as well simplify the code a tiny bit and save that branch / frame check during runtime too.This PR removes the
frame_in_stdrestriction forGetCurrentProcessId, and also moves it into the environment related shim section per discussion in #1727 (comment).Still passes existing tests/pass/getpid.rs test.
Closes #1727 unless we wish to give a dummy value when isolated, which we don't seem to want to do at this time.