Skip to content

Commit d895106

Browse files
committed
Rollup merge of #28422 - christopherdumas:label_code, r=steveklabnik
2 parents fe8a95e + b69a511 commit d895106

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/doc/trpl/error-handling.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ thread '<main>' panicked at 'Invalid number: 11', src/bin/panic-simple.rs:5
8787
Here's another example that is slightly less contrived. A program that accepts
8888
an integer as an argument, doubles it and prints it.
8989

90+
<a name="code-unwrap-double"/>
9091
```rust,should_panic
92+
9193
use std::env;
9294
9395
fn main() {
@@ -120,7 +122,7 @@ It would be better if we just showed the code for unwrapping because it is so
120122
simple, but to do that, we will first need to explore the `Option` and `Result`
121123
types. Both of these types have a method called `unwrap` defined on them.
122124

123-
## The `Option` type
125+
### The `Option` type
124126

125127
The `Option` type is [defined in the standard library][5]:
126128

@@ -137,6 +139,7 @@ system is an important concept because it will cause the compiler to force the
137139
programmer to handle that absence. Let's take a look at an example that tries
138140
to find a character in a string:
139141

142+
<a name="code-option-ex-string-find"/>
140143
```rust
141144
// Searches `haystack` for the Unicode character `needle`. If one is found, the
142145
// byte offset of the character is returned. Otherwise, `None` is returned.

0 commit comments

Comments
 (0)