Skip to content

Commit fe16182

Browse files
committed
unsafe superpowers
1 parent a7177ac commit fe16182

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

content/lessons/15_unsafe/index.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ But no respectable, powerful programming language can stand being constrained th
1717

1818
In Rust, `unsafe` keyworld unleashes the hidden superpowers.
1919

20-
### Unsafe superpowers
20+
## Unsafe code superpowers
2121

2222
Inside a `unsafe { ... }` block, you can (and normally you can't):
2323

@@ -29,6 +29,14 @@ Inside a `unsafe { ... }` block, you can (and normally you can't):
2929

3030
The first superpower is the most important. (Efficient) implementation of many data structures would be impossible without ability to use raw pointers, as references don't allow circular dependencies, among other limitations.
3131

32+
In the following code sample, we show all superpowers of `unsafe` code:
33+
34+
{{ include_code_sample(path="lessons/15_unsafe/unsafe_superpowers.rs", language="rust") }}
35+
36+
## Safe code guarantees
37+
38+
Safe code may **_never_** cause Undefined Behaviour.
39+
3240
## Reading
3341

3442
- [The Book, Chapter 19.1](https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html)

0 commit comments

Comments
 (0)