merge unsafe-block and unsafe-function into one page

This commit is contained in:
Ralf Jung 2022-09-28 17:31:50 +02:00
parent bf1453fd0d
commit f24b8d4ca7
6 changed files with 14 additions and 10 deletions

View File

@ -10,6 +10,8 @@ edit-url-template = "https://github.com/rust-lang/reference/edit/master/{path}"
[output.html.redirect]
"/expressions/enum-variant-expr.html" = "struct-expr.html"
"/unsafe-blocks.html" = "unsafe-keyword.html"
"/unsafe-functions.html" = "unsafe-keyword.html"
[rust]
edition = "2021"

View File

@ -118,8 +118,7 @@
- [Inline assembly](inline-assembly.md)
- [Unsafety](unsafety.md)
- [Unsafe functions](unsafe-functions.md)
- [Unsafe blocks](unsafe-blocks.md)
- [The `unsafe` keyword](unsafe-keyword.md)
- [Behavior considered undefined](behavior-considered-undefined.md)
- [Behavior not considered unsafe](behavior-not-considered-unsafe.md)

View File

@ -347,7 +347,7 @@ trait object whose methods are attributed.
[target architecture]: ../conditional-compilation.md#target_arch
[trait]: ../items/traits.md
[undefined behavior]: ../behavior-considered-undefined.md
[unsafe function]: ../unsafe-functions.md
[unsafe function]: ../unsafe-keyword.md
[rust-abi]: ../items/external-blocks.md#abi
[`core::intrinsics::caller_location`]: ../../core/intrinsics/fn.caller_location.html
[`core::panic::Location::caller`]: ../../core/panic/struct.Location.html#method.caller

View File

@ -62,5 +62,5 @@ restrictions as [regular function parameters].
[closures]: closure.md
[extern function]: ../items/functions.md#extern-function-qualifier
[function items]: function-item.md
[unsafe function]: ../unsafe-functions.md
[unsafe function]: ../unsafe-keyword.md
[regular function parameters]: ../items/functions.md#attributes-on-function-parameters

View File

@ -1,5 +0,0 @@
# Unsafe functions
Unsafe functions are functions that are not safe in all contexts and/or for all
possible inputs. Such a function must be prefixed with the keyword `unsafe` and
can only be called from an `unsafe` block or another `unsafe` function.

View File

@ -1,4 +1,12 @@
# Unsafe blocks
# The `unsafe` keyword
## Unsafe functions
Unsafe functions are functions that are not safe in all contexts and/or for all
possible inputs. Such a function must be prefixed with the keyword `unsafe` and
can only be called from an `unsafe` block or another `unsafe` function.
## Unsafe blocks
A block of code can be prefixed with the `unsafe` keyword, to permit calling
`unsafe` functions or dereferencing raw pointers within a safe function.