Skip to content

Commit 241c28e

Browse files
authored
Move unreachable! to speaker notes (#2628)
1 parent d7a8821 commit 241c28e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/control-flow-basics/macros.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ standard library includes an assortment of useful macros.
1515
- `dbg!(expression)` logs the value of the expression and returns it.
1616
- `todo!()` marks a bit of code as not-yet-implemented. If executed, it will
1717
panic.
18-
- `unreachable!()` marks a bit of code as unreachable. If executed, it will
19-
panic.
2018

2119
```rust,editable
2220
fn factorial(n: u32) -> u32 {
@@ -46,4 +44,19 @@ especially critical.
4644
The course does not cover defining macros, but a later section will describe use
4745
of derive macros.
4846

47+
## More To Explore
48+
49+
There are a number of other useful macros provided by the standard library. Some
50+
other examples you can share with students if they want to know more:
51+
52+
- [`assert!`] and related macros can be used to add assertions to your code.
53+
These are used heavily in writing tests.
54+
- [`unreachable!`] is used to mark a branch of control flow that should never be
55+
hit.
56+
- [`eprintln!`] allows you to print to stderr.
57+
4958
</details>
59+
60+
[`assert!`]: https://doc.rust-lang.org/stable/std/macro.assert.html
61+
[`unreachable!`]: https://doc.rust-lang.org/stable/std/macro.unreachable.html
62+
[`eprintln!`]: https://doc.rust-lang.org/stable/std/macro.eprintln.html

0 commit comments

Comments
 (0)