From 875b905a389455c5329ae088600c0b5f7222104d Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Fri, 9 Aug 2024 15:30:05 -0700 Subject: [PATCH] Remove 2024 unsafe extern block notes These will be added back when 2024 stabilizes. --- src/items/external-blocks.md | 9 +-------- src/items/functions.md | 6 +----- src/unsafe-keyword.md | 2 -- src/unsafety.md | 4 +--- 4 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/items/external-blocks.md b/src/items/external-blocks.md index 3af2a67f0..bb59af898 100644 --- a/src/items/external-blocks.md +++ b/src/items/external-blocks.md @@ -2,7 +2,7 @@ > **Syntax**\ > _ExternBlock_ :\ ->    `unsafe`?[^unsafe-2024] `extern` [_Abi_]? `{`\ +>    `unsafe`? `extern` [_Abi_]? `{`\ >       [_InnerAttribute_]\*\ >       _ExternalItem_\*\ >    `}` @@ -12,8 +12,6 @@ >          [_MacroInvocationSemi_]\ >       | ( [_Visibility_]? ( [_StaticItem_] | [_Function_] ) )\ >    ) -> -> [^unsafe-2024]: Starting with the 2024 Edition, the `unsafe` keyword is required semantically. External blocks provide _declarations_ of items that are not _defined_ in the current crate and are the basis of Rust's foreign function interface. These are @@ -25,11 +23,6 @@ blocks is only allowed in an `unsafe` context. The external block defines its functions and statics in the [value namespace] of the module or block where it is located. -**Edition differences**: Starting in the 2024 edition, the `unsafe` keyword is -required to appear before the `extern` keyword on external blocks. In previous -editions, it is accepted but not required. The `safe` and `unsafe` item qualifiers -are only allowed if the external block itself is marked as `unsafe`. - ## Functions Functions within external blocks are declared in the same way as other Rust diff --git a/src/items/functions.md b/src/items/functions.md index af4fc7bc7..54988df31 100644 --- a/src/items/functions.md +++ b/src/items/functions.md @@ -8,7 +8,7 @@ >       ( [_BlockExpression_] | `;` ) > > _FunctionQualifiers_ :\ ->    `const`? `async`[^async-edition]? _ItemSafety_?[^extern-qualifiers] (`extern` _Abi_?)? +>    `const`? `async`[^async-edition]? _ItemSafety_? (`extern` _Abi_?)? > > _ItemSafety_ :\ >    `safe`[^extern-safe] | `unsafe` @@ -45,10 +45,6 @@ > [^extern-safe]: The `safe` function qualifier is only allowed semantically within > `extern` blocks. > -> [^extern-qualifiers]: *Relevant to editions earlier than Rust 2024*: Within -> `extern` blocks, the `safe` or `unsafe` function qualifier is only allowed -> when the `extern` is qualified as `unsafe`. -> > [^fn-param-2015]: Function parameters with only a type are only allowed > in an associated function of a [trait item] in the 2015 edition. diff --git a/src/unsafe-keyword.md b/src/unsafe-keyword.md index 63bc13879..df68a74cc 100644 --- a/src/unsafe-keyword.md +++ b/src/unsafe-keyword.md @@ -61,6 +61,4 @@ Unsafe trait implementations are the logical dual to unsafe traits: where unsafe 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`. -**Edition differences**: Prior to edition 2024, `extern` blocks were allowed without being qualified as `unsafe`. - [external block]: items/external-blocks.md diff --git a/src/unsafety.md b/src/unsafety.md index 2330edd48..237a4bfec 100644 --- a/src/unsafety.md +++ b/src/unsafety.md @@ -11,9 +11,7 @@ Rust: - Accessing a field of a [`union`], other than to assign to it. - Calling an unsafe function (including an intrinsic or foreign function). - Implementing an [unsafe trait]. -- Declaring an [`extern`] block[^extern-2024]. - -[^extern-2024]: Prior to the 2024 edition, extern blocks were allowed to be declared without `unsafe`. +- Declaring an [`extern`] block. [`extern`]: items/external-blocks.md [`union`]: items/unions.md