Skip to content

Commit 941ca6f

Browse files
committed
Clarify docs for unreachable! macro
1 parent 119bbc2 commit 941ca6f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/libcore/macros.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,10 @@ macro_rules! writeln {
445445
/// * Iterators that dynamically terminate.
446446
///
447447
/// If the determination that the code is unreachable proves incorrect, the
448-
/// program immediately terminates with a [`panic!`]. The function [`unreachable_unchecked`],
449-
/// which belongs to the [`std::hint`] module, informs the compiler to
450-
/// optimize the code out of the release version entirely.
448+
/// program immediately terminates with a [`panic!`].
449+
///
450+
/// The unsafe counterpart of this macro is the [`unreachable_unchecked`] function, which
451+
/// instead of a [`panic!`] will cause undefined behavior if the code is reached.
451452
///
452453
/// [`panic!`]: ../std/macro.panic.html
453454
/// [`unreachable_unchecked`]: ../std/hint/fn.unreachable_unchecked.html

0 commit comments

Comments
 (0)