-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Use a hardcoded constant instead of calling OpenProcessToken. #119032
Conversation
r? @thomcc (rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
Additionally, windows 7 was re-added as a tier 3 target in #118150, so it might be good to test with that/keep the old code under a |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hmm, doesn't seem to like my cfg for win7 support. What should it be? |
The target is probably too new to be in the bootstrap compiler (which is currently beta 2013-11-13). The bootstrap compiler will next be updated in a week or two. In the meantime, you can put something like this at the top of the file:
This will tell the bootstrap (stage0) compiler to ignore the error while not affecting the newly built (stage1+) compiler. |
This comment has been minimized.
This comment has been minimized.
Ok, this looks good. Could you squish your commits in to one? |
Note that the better and recommended way is to add the exception to the "extra check-cfg list" in bootstrap: Lines 91 to 93 in e51e98d
|
☔ The latest upstream changes (presumably #117285) made this pull request unmergeable. Please resolve the merge conflicts. |
Hi, very sorry for the delay here. This was right around when i was going on holiday and evidently I missed that I hadn't approved it. Could you rebase on master? The file has moved to |
Yeah, I should be able to get back to this next weekend. |
Now that Win 7 support is dropped, we can resurrect rust-lang#90144. GetCurrentProcessToken is defined in processthreadsapi.h as: FORCEINLINE HANDLE GetCurrentProcessToken ( VOID ) { return (HANDLE)(LONG_PTR) -4; } Since it's very unlikely that this constant will ever change, let's just use it instead of making calls to get the same information.
Rebase came out clean, think this is ready. |
Thanks for sticking with this and sorry again for the delay. @bors r+ rollup |
Use a hardcoded constant instead of calling OpenProcessToken. Now that Win 7 support is dropped, we can resurrect rust-lang#90144. GetCurrentProcessToken is defined in processthreadsapi.h as: FORCEINLINE HANDLE GetCurrentProcessToken ( VOID ) { return (HANDLE)(LONG_PTR) -4; } Since it's very unlikely that this constant will ever change, let's just use it instead of making calls to get the same information.
Rollup of 8 pull requests Successful merges: - rust-lang#119032 (Use a hardcoded constant instead of calling OpenProcessToken.) - rust-lang#120932 (const_mut_refs: allow mutable pointers to statics) - rust-lang#121059 (Add and use a simple extension trait derive macro in the compiler) - rust-lang#121135 (coverage: Discard spans that fill the entire function body) - rust-lang#121187 (Add examples to document the return type of quickselect functions) - rust-lang#121191 (Add myself to review rotation (and a rustbot ping)) - rust-lang#121192 (Give some intrinsics fallback bodies) - rust-lang#121197 (Ensure `./configure` works when `configure.py` path contains spaces) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#119032 - smmalis37:patch-1, r=ChrisDenton Use a hardcoded constant instead of calling OpenProcessToken. Now that Win 7 support is dropped, we can resurrect rust-lang#90144. GetCurrentProcessToken is defined in processthreadsapi.h as: FORCEINLINE HANDLE GetCurrentProcessToken ( VOID ) { return (HANDLE)(LONG_PTR) -4; } Since it's very unlikely that this constant will ever change, let's just use it instead of making calls to get the same information.
Now that Win 7 support is dropped, we can resurrect #90144.
GetCurrentProcessToken is defined in processthreadsapi.h as:
FORCEINLINE
HANDLE
GetCurrentProcessToken (
VOID
)
{
return (HANDLE)(LONG_PTR) -4;
}
Since it's very unlikely that this constant will ever change, let's just use it instead of making calls to get the same information.