-
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
Fix assertion failures in OwnedHandle
with windows_subsystem
.
#88798
Fix assertion failures in OwnedHandle
with windows_subsystem
.
#88798
Conversation
As discussed in rust-lang#88576, raw handle values in Windows can be null, such as in `windows_subsystem` mode, or when consoles are detached from a process. So, don't use `NonNull` to hold them, don't assert that they're not null, and remove `OwnedHandle`'s `repr(transparent)`. Introduce a new `HandleOrNull` type, similar to `HandleOrInvalid`, to cover the FFI use case.
This comment has been minimized.
This comment has been minimized.
Can you please clarify in the comments whether I don't know which way around makes sense, but I would expect that there's some type that doesn't allow either invalid or NULL, and whose |
I've now added a patch documenting this. My current understanding of |
@joshtriplett I've now added comments clarifying the valid values for |
I've now addressed the review comments. |
I've addressed the comments, so this is ready for review. |
Will review this today; sorry for the delay. I feel like this might not be exactly the right design for handling NULL, but that's a secondary concern. It's a nightly API, and we can always evolve it further, but we need to fix the issue first. |
Nominating for both stable and beta backport. T-libs thinks this is definitely worth a beta backport, but it's only worth a stable backport if we're already going to do a stable release for some other reason. |
Personally I'd backport to stable as well -- I feel like having the GUI target broken on stable Rust does not look good or inspire confidence in Rust for anyone who hits this bug. It's core functionality for Windows targets. |
Reviewing this carefully, I'm not sure this is the right API, but I am sure that we should prioritize a fix for the observed assertion failures that occur with stable APIs backed by this over further refinements to the nightly-only API. @bors r+ rollup=never p=10 |
📌 Commit 5d79870 has been approved by |
⌛ Testing commit 5d79870 with merge b95b96d44ba66d4615822c169c0c924d50b670dc... |
💔 Test failed - checks-actions |
The job Click to see the possible cause of the failure (guessed by this bot)
|
@joshtriplett Restart the CI? ^^ |
@bors retry |
☀️ Test successful - checks-actions |
Finished benchmarking commit (d71ba74): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
[beta] backports - Fix assertion failures in OwnedHandle with windows_subsystem. rust-lang#88798 - Ensure that pushing empty path works as before on verbatim paths rust-lang#89665 - Feature gate + make must_not_suspend allow-by-default rust-lang#89826 - Only use clone3 when needed for pidfd rust-lang#89930 - Fix documentation header sizes rust-lang#90186 - Fixes incorrect handling of ADT's drop requirements rust-lang#90218 - Fix ICE when forgetting to Box a parameter to a Self::func call rust-lang#90221 - Prevent duplicate caller bounds candidates by exposing default substs in Unevaluated rust-lang#90266 - Update odht crate to 0.3.1 (big-endian bugfix) rust-lang#90403 - rustdoc: Go back to loading all external crates unconditionally rust-lang#90489 - Split doc_cfg and doc_auto_cfg features rust-lang#90502 - Apply adjustments for field expression even if inaccessible rust-lang#90508 - Warn for variables that are no longer captured rust-lang#90597 - Properly register text_direction_codepoint_in_comment lint. rust-lang#90626 - CI: Use ubuntu image to download openssl, curl sources, cacert.pem for x86 dist builds rust-lang#90457 - Android is not GNU rust-lang#90834 - Update llvm submodule rust-lang#90954 Additionally, this bumps the stage 0 compiler from beta to stable 1.56.1. r? `@Mark-Simulacrum`
As discussed in #88576, raw handle values in Windows can be null, such
as in
windows_subsystem
mode, or when consoles are detached from aprocess. So, don't use
NonNull
to hold them, don't assert that they'renot null, and remove
OwnedHandle
'srepr(transparent)
. Introduce anew
HandleOrNull
type, similar toHandleOrInvalid
, to cover the FFIuse case.
r? @joshtriplett