You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> [^unsafe-2024]: Starting with the 2024 Edition, the `unsafe` keyword is required semantically.
18
20
19
21
r[items.extern.intro]
20
22
External blocks provide _declarations_ of items that are not _defined_ in the
@@ -31,6 +33,12 @@ Calling functions or accessing statics that are declared in external blocks is o
31
33
r[items.extern.namespace]
32
34
The external block defines its functions and statics in the [value namespace] of the module or block where it is located.
33
35
36
+
r[items.extern.unsafe-required]
37
+
The `unsafe` keyword is semantically required to appear before the `extern` keyword on external blocks.
38
+
39
+
r[items.extern.edition2024]
40
+
> **Edition differences**: Prior to the 2024 edition, the `unsafe` keyword is optional. The `safe` and `unsafe` item qualifiers are only allowed if the external block itself is marked as `unsafe`.
Copy file name to clipboardExpand all lines: src/unsafe-keyword.md
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,9 @@ r[unsafe.extern]
81
81
82
82
The programmer who declares an [external block] must assure that the signatures of the items contained within are correct. Failing to do so may lead to undefined behavior. That this obligation has been met is indicated by writing `unsafe extern`.
83
83
84
+
r[unsafe.extern.edition2024]
85
+
> **Edition differences**: Prior to edition 2024, `extern` blocks were allowed without being qualified as `unsafe`.
0 commit comments