Uh oh!
There was an error while loading. Please reload this page.
Use a hardcoded constant instead of calling OpenProcessToken. - #119032
Conversation
rustbot
commented
Dec 17, 2023
r? @thomcc (rustbot has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
deltragon
commented
Dec 17, 2023
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.
smmalis37
commented
Dec 17, 2023
Hmm, doesn't seem to like my cfg for win7 support. What should it be? |
ChrisDenton
commented
Dec 18, 2023
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. |
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
ChrisDenton
commented
Dec 19, 2023
Ok, this looks good. Could you squish your commits in to one? |
Urgau
commented
Jan 3, 2024
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 |
bors
commented
Jan 13, 2024
☔ The latest upstream changes (presumably #117285) made this pull request unmergeable. Please resolve the merge conflicts. |
ChrisDenton
commented
Feb 9, 2024
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 |
smmalis37
commented
Feb 10, 2024
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.
smmalis37
commented
Feb 16, 2024
Rebase came out clean, think this is ready. |
ChrisDenton
commented
Feb 17, 2024
Thanks for sticking with this and sorry again for the delay. @bors r+ rollup |
bors
commented
Feb 17, 2024
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.