-
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
add owned locked stdio handles #86799
Conversation
Add stderr_locked, stdin_locked, and stdout_locked free functions to obtain owned locked stdio handles in a single step. Also add into_lock methods to consume a stdio handle and return an owned lock. These methods will make it easier to use locked stdio handles without having to deal with lifetime problems or keeping bindings to the unlocked handles around.
Looks good, and thank you for adding detailed tests! I don't think we need the type aliases to hide the lifetimes; people won't need to write them. Also, as a minor nit, since we have the free functions for the common case, I think we should use the more grammatically flowing r=me with both of those addressed. |
Rename methods to `into_locked`. Remove type aliases for owned locks.
Thanks for the review!
Both done.
I think I don't have enough privileges on bors to do that? |
@bors r+ |
📌 Commit c58ceb7 has been approved by |
☀️ Test successful - checks-actions |
@tlyu Sorry, I missed a detail: you need to file a tracking issue (use the library tracking issue template when filing), and then fill in the tracking issue number in the feature gate usages, rather than "none". Could you please file a follow-up PR for that? |
…riplett stdio_locked: add tracking issue Add the tracking issue number rust-lang#86845 to the stability attributes for the implementation in rust-lang#86799. r? `@joshtriplett` `@rustbot` label +A-io +C-cleanup +T-libs-api
Add stderr_locked, stdin_locked, and stdout_locked free functions
to obtain owned locked stdio handles in a single step. Also add
into_lock methods to consume a stdio handle and return an owned
lock. These methods will make it easier to use locked stdio
handles without having to deal with lifetime problems or keeping
bindings to the unlocked handles around.
Fixes #85383; enables #86412.
r? @joshtriplett
@rustbot label +A-io +C-enhancement +D-newcomer-roadblock +T-libs-api