diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2018-07-03 11:31:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-03 11:31:03 +0200 |
| commit | 0ceeb1be31b52837e270a3349f9c62087ff11985 (patch) | |
| tree | 24afda5e4e332fa30ca5e89b6cf4497cc1e382bf /src/libstd/io | |
| parent | bd0fe736beb9142073da68b62a0002b12e1f9bc7 (diff) | |
| parent | 9797665b286db3f34cc475560a68380012fadde7 (diff) | |
| download | rust-0ceeb1be31b52837e270a3349f9c62087ff11985.tar.gz rust-0ceeb1be31b52837e270a3349f9c62087ff11985.zip | |
Rollup merge of #51973 - estk:master, r=abonander
Make Stdio handle UnwindSafe Closes #51863 This is my first compiler PR. Thanks Niko for the mentor help! r? @nikomatsakis
Diffstat (limited to 'src/libstd/io')
| -rw-r--r-- | src/libstd/io/stdio.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 2472bed5ba4..fce85a200ba 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -712,10 +712,32 @@ pub fn _eprint(args: fmt::Arguments) { #[cfg(test)] mod tests { + use panic::{UnwindSafe, RefUnwindSafe}; use thread; use super::*; #[test] + fn stdout_unwind_safe() { + assert_unwind_safe::<Stdout>(); + } + #[test] + fn stdoutlock_unwind_safe() { + assert_unwind_safe::<StdoutLock>(); + assert_unwind_safe::<StdoutLock<'static>>(); + } + #[test] + fn stderr_unwind_safe() { + assert_unwind_safe::<Stderr>(); + } + #[test] + fn stderrlock_unwind_safe() { + assert_unwind_safe::<StderrLock>(); + assert_unwind_safe::<StderrLock<'static>>(); + } + + fn assert_unwind_safe<T: UnwindSafe + RefUnwindSafe>() {} + + #[test] #[cfg_attr(target_os = "emscripten", ignore)] fn panic_doesnt_poison() { thread::spawn(|| { |
