Skip to content

Commit f24b8d4

Browse files
committed
merge unsafe-block and unsafe-function into one page
1 parent bf1453f commit f24b8d4

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

book.toml

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ edit-url-template = "https://github.com/rust-lang/reference/edit/master/{path}"
1010

1111
[output.html.redirect]
1212
"/expressions/enum-variant-expr.html" = "struct-expr.html"
13+
"/unsafe-blocks.html" = "unsafe-keyword.html"
14+
"/unsafe-functions.html" = "unsafe-keyword.html"
1315

1416
[rust]
1517
edition = "2021"

src/SUMMARY.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@
118118
- [Inline assembly](inline-assembly.md)
119119

120120
- [Unsafety](unsafety.md)
121-
- [Unsafe functions](unsafe-functions.md)
122-
- [Unsafe blocks](unsafe-blocks.md)
121+
- [The `unsafe` keyword](unsafe-keyword.md)
123122
- [Behavior considered undefined](behavior-considered-undefined.md)
124123
- [Behavior not considered unsafe](behavior-not-considered-unsafe.md)
125124

src/attributes/codegen.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ trait object whose methods are attributed.
347347
[target architecture]: ../conditional-compilation.md#target_arch
348348
[trait]: ../items/traits.md
349349
[undefined behavior]: ../behavior-considered-undefined.md
350-
[unsafe function]: ../unsafe-functions.md
350+
[unsafe function]: ../unsafe-keyword.md
351351
[rust-abi]: ../items/external-blocks.md#abi
352352
[`core::intrinsics::caller_location`]: ../../core/intrinsics/fn.caller_location.html
353353
[`core::panic::Location::caller`]: ../../core/panic/struct.Location.html#method.caller

src/types/function-pointer.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ restrictions as [regular function parameters].
6262
[closures]: closure.md
6363
[extern function]: ../items/functions.md#extern-function-qualifier
6464
[function items]: function-item.md
65-
[unsafe function]: ../unsafe-functions.md
65+
[unsafe function]: ../unsafe-keyword.md
6666
[regular function parameters]: ../items/functions.md#attributes-on-function-parameters

src/unsafe-functions.md

-5
This file was deleted.

src/unsafe-blocks.md renamed to src/unsafe-keyword.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
# Unsafe blocks
1+
# The `unsafe` keyword
2+
3+
## Unsafe functions
4+
5+
Unsafe functions are functions that are not safe in all contexts and/or for all
6+
possible inputs. Such a function must be prefixed with the keyword `unsafe` and
7+
can only be called from an `unsafe` block or another `unsafe` function.
8+
9+
## Unsafe blocks
210

311
A block of code can be prefixed with the `unsafe` keyword, to permit calling
412
`unsafe` functions or dereferencing raw pointers within a safe function.

0 commit comments

Comments
 (0)