Skip to content

Commit 8994e39

Browse files
authored
Fix missing link (fixes #2822) (#2823)
This change fixes a broken link when markdown source is rendered as HTML by mdbook.
1 parent c15f398 commit 8994e39

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/unsafe-deep-dive/motivations/interop.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,16 @@ parsing all take energy and time.
5151
rely on its symbols, including `random`, being available to our program.
5252
- _What is the "safe" keyword?_\
5353
It allows callers to call the function without needing to wrap that call in
54-
`unsafe`. The [`safe` function qualifier] was introduced in the 2024 edition
55-
of Rust and can only be used within `extern` blocks. It was introduced because
56-
`unsafe` became a mandatory qualifier for `extern` blocks in that edition.
54+
`unsafe`. The [`safe` function qualifier][safe] was introduced in the 2024
55+
edition of Rust and can only be used within `extern` blocks. It was introduced
56+
because `unsafe` became a mandatory qualifier for `extern` blocks in that
57+
edition.
5758
- _What is the [`std::ffi::c_long`] type?_\
5859
According to the C standard, an integer that's at least 32 bits wide. On
5960
today's systems, It's an `i32` on Windows and an `i64` on Linux.
6061

61-
[`safe` keyword]: https://doc.rust-lang.org/reference/safe-keyword.html
6262
[`std::ffi::c_long`]: https://doc.rust-lang.org/std/ffi/type.c_long.html
63+
[safe]: https://doc.rust-lang.org/stable/edition-guide/rust-2024/unsafe-extern.html
6364

6465
## Consideration: type safety
6566

@@ -203,15 +204,12 @@ fn main() {
203204
}
204205
```
205206
206-
> Aside: Lifetimes in the `format_timestamp()` function
207+
> _Aside:_ Lifetimes in the `format_timestamp()` function
207208
>
208-
> Neither `'a`, nor `'static` correctly describe the lifetime of the string
209+
> Neither `'a`, nor `'static`, correctly describe the lifetime of the string
209210
> that's returned. Rust treats it as an immutable reference, but subsequent
210211
> calls to `ctime` will overwrite the static buffer that the string occupies.
211212
212-
Bonus points: can anyone spot the lifetime bug? `format_timestamp()` should
213-
return a `&'static str`.
214-
215213
## Consideration: Representation mismatch
216214

217215
Different programming languages have made different design decisions and this

0 commit comments

Comments
 (0)