Skip to content

Commit 92f47db

Browse files
authored
Merge pull request #1103 from vks/patch-2
Update list of unsafe things
2 parents e459fb3 + 01eb511 commit 92f47db

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/unsafe.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
As an introduction to this section, to borrow from [the official docs][unsafe],
44
"one should try to minimize the amount of unsafe code in a code base." With that
5-
in mind, let's get started! Unsafe blocks in Rust are used to bypass protections
6-
put in place by the compiler; specifically, there are four primary things that
7-
unsafe blocks are used for:
5+
in mind, let's get started! Unsafe annotations in Rust are used to bypass
6+
protections put in place by the compiler; specifically, there are four primary
7+
things that unsafe is used for:
88

99
* dereferencing raw pointers
10-
* calling a function over FFI (but this is covered in [a previous
11-
chapter](std_misc/ffi.html) of the book)
12-
* calling functions which are `unsafe`
13-
* inline assembly
10+
* calling functions or methods which are `unsafe` (including calling a function
11+
over FFI, see [a previous chapter](std_misc/ffi.html) of the book)
12+
* accessing or modifying static mutable variables
13+
* implementing unsafe traits
1414

1515
### Raw Pointers
1616
Raw pointers `*` and references `&T` function similarly, but references are
@@ -45,7 +45,7 @@ fn main() {
4545
4646
unsafe {
4747
let my_slice: &[u32] = slice::from_raw_parts(pointer, length);
48-
48+
4949
assert_eq!(some_vector.as_slice(), my_slice);
5050
}
5151
}

0 commit comments

Comments
 (0)