We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3313e50 + 9944b22 commit d06f1dcCopy full SHA for d06f1dc
src/libstd/thread/mod.rs
@@ -321,6 +321,35 @@ pub fn yield_now() {
321
}
322
323
/// Determines whether the current thread is unwinding because of panic.
324
+///
325
+/// # Examples
326
327
+/// ```rust,should_panic
328
+/// use std::thread;
329
330
+/// struct SomeStruct;
331
332
+/// impl Drop for SomeStruct {
333
+/// fn drop(&mut self) {
334
+/// if thread::panicking() {
335
+/// println!("dropped while unwinding");
336
+/// } else {
337
+/// println!("dropped while not unwinding");
338
+/// }
339
340
341
342
+/// {
343
+/// print!("a: ");
344
+/// let a = SomeStruct;
345
346
347
348
+/// print!("b: ");
349
+/// let b = SomeStruct;
350
+/// panic!()
351
352
+/// ```
353
#[inline]
354
#[stable(feature = "rust1", since = "1.0.0")]
355
pub fn panicking() -> bool {
0 commit comments