about summary refs log tree commit diff
path: root/library/std/src/io/error
diff options
context:
space:
mode:
authorThom Chiovoloni <chiovolonit@gmail.com>2022-03-23 17:29:19 -0700
committerThom Chiovoloni <chiovolonit@gmail.com>2022-03-23 17:29:19 -0700
commit09d83e292dcb6630c1e8c08734062524466db66e (patch)
tree23c6ecf6026885e4539d8830e778e85fe62d8482 /library/std/src/io/error
parentb898ad499f7a2c806e8df0bfde6fbe3f3c5cb925 (diff)
Add a `compile_fail` doctest to check that `io::Error: !UnwindSafe`
Diffstat (limited to 'library/std/src/io/error')
-rw-r--r--library/std/src/io/error/repr_bitpacked.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/library/std/src/io/error/repr_bitpacked.rs b/library/std/src/io/error/repr_bitpacked.rs
index e8070dc419b..06614d9f4d1 100644
--- a/library/std/src/io/error/repr_bitpacked.rs
+++ b/library/std/src/io/error/repr_bitpacked.rs
@@ -115,6 +115,15 @@ const TAG_CUSTOM: usize = 0b01;
 const TAG_OS: usize = 0b10;
 const TAG_SIMPLE: usize = 0b11;
 
+/// The internal representation.
+///
+/// See the module docs for more, this is just a way to hack in a check that we
+/// indeed are not unwind-safe.
+///
+/// ```compile_fail
+/// fn is_unwind_safe<T: core::panic::UnwindSafe>() {}
+/// is_unwind_safe::<std::io::Error>();
+/// ```
 #[repr(transparent)]
 pub(super) struct Repr(NonNull<()>, PhantomData<ErrorData<Box<Custom>>>);