Remove GetCurrentProcessId's frame_in_std check #3716
Merged
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 WindowsGetCurrentProcessId
check 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_std
restriction 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.