-
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
Make Stdio handle UnwindSafe #51973
Make Stdio handle UnwindSafe #51973
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
src/libstd/io/stdio.rs
Outdated
} | ||
#[test] | ||
fn stdoutlock_unwind_safe() { | ||
assert_unwind_safe::<StdoutLock<'static>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need to pass in the explicit lifetime here.
Glad to hear it! I'm not sure that it was me who helped you, though =) maybe @abonander ? |
@bors delegate=abonander =) |
✌️ @abonander can now approve this pull request |
Whoops, yep for sure it was @abonander. Thanks to you @abonander. 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this builds it's probably going to infer a single lifetime whereas I would like to somehow notate a requirement that the trait be implemented for all lifetimes. I'll test locally and see if for<'a> StdoutLock<' a>
works.
@abonander interesting, not a feature I knew even existed. It compiled locally and I figured it was fine since the lifetime param seemed irrelevant to whether the StdoutLock and hence ReentrantMutex implemented UnwindSafe and RefUnwindSafe. Wrt your last comment, StdoutLock is a struct so does not appear to be compatible with HRTBs. Where do we go from here? Drop the lifetime or pin to |
Lifetimes may not be relevant now but I'm sure one could contrive a few ways to break it without breaking the test as it is written. My use-case involves |
And if you don't mind, would you squash the later commits into the first one to keep the history clean? |
@bors r+ |
📌 Commit 9797665 has been approved by |
Excellent! |
Make Stdio handle UnwindSafe Closes rust-lang#51863 This is my first compiler PR. Thanks Niko for the mentor help! r? @nikomatsakis
Make Stdio handle UnwindSafe Closes rust-lang#51863 This is my first compiler PR. Thanks Niko for the mentor help! r? @nikomatsakis
Rollup of 13 pull requests Successful merges: - #51548 (Initialize LLVM's AMDGPU target machine, if available.) - #51809 (Add read_exact_at and write_all_at methods to FileExt on unix) - #51914 (add outlives annotations to `BTreeMap`) - #51958 (Show known meta items in unknown meta items error) - #51973 (Make Stdio handle UnwindSafe) - #51977 (bootstrap: tests should use rustc from config.toml) - #51978 (Do not suggest changes to str literal if it isn't one) - #51979 (Get rid of `TyImplTraitExistential`) - #51980 (Emit column info in debuginfo for non msvc like targets) - #51982 (incr.comp.: Take names of children into account when computing the ICH of a module's HIR.) - #51997 (add entry for cargo-metadata feature to RELEASES) - #52004 (toolstate: Fixed detection of changed submodule, and other fixes.) - #52006 ( Change --keep-stage to apply more often) Failed merges: r? @ghost
Closes #51863
This is my first compiler PR. Thanks Niko for the mentor help!
r? @nikomatsakis