We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
unreachable!()
1 parent 62efba8 commit b41b2e5Copy full SHA for b41b2e5
library/core/src/macros/mod.rs
@@ -554,7 +554,10 @@ macro_rules! writeln {
554
///
555
/// # Panics
556
557
-/// This will always [`panic!`].
+/// This will always [`panic!`] because `unreachable!` is just a shorthand for `panic!` with a
558
+/// fixed, specific message.
559
+///
560
+/// Like `panic!`, this macro has a second form for displaying custom values.
561
562
/// # Examples
563
@@ -581,7 +584,7 @@ macro_rules! writeln {
581
584
/// if 3*i < i { panic!("u32 overflow"); }
582
585
/// if x < 3*i { return i-1; }
583
586
/// }
-/// unreachable!();
587
+/// unreachable!("The loop should always return");
588
589
/// ```
590
#[macro_export]
0 commit comments