Skip to content

Commit 39795a0

Browse files
committed
Fix optionality of safe/unsafe in guide section
The 2023-10-11 consensus from lang on how to move forward included that the `safe` and `unsafe` keywords would be optional within an `unsafe extern` block. The reference-level section correctly followed this consensus, but the guide-level section did not, and suggested that annotating items with these keywords was required. Let's fix that.
1 parent c198396 commit 39795a0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

text/0000-unsafe-extern-blocks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ An `extern` block can be placed anywhere a function declaration could appear (ge
3030

3131
Within an `extern` block is zero or more declarations of external functions and/or external static values. An extern function is declared with a `;` instead of a function body (similar to a method of a trait). An extern static value is also declared with a `;` instead of an expression (similar to an associated const of a trait). In both cases, the actual function body or value is provided by whatever external source (which is probably not even written in Rust).
3232

33-
When an `unsafe extern` block is used, all declarations within that `extern` block *must* have the `unsafe` or `safe` keywords as part of their signature. The `safe` keyword is a contextual keyword; it is currently allowed only within `extern` blocks.
33+
Declarations within an `unsafe extern` block *may* annotate their signatures with either `safe` or `unsafe`. If a signature within the block is not annotated, it is assumed to be `unsafe`. The `safe` keyword is contextual and is currently allowed only within `extern` blocks.
3434

3535
If an `extern` block is used in an older edition without the `unsafe` keyword, declarations *cannot* specify `safe` or `unsafe`. Code must update to `unsafe extern` style blocks if it wants to make `safe` declarations.
3636

0 commit comments

Comments
 (0)