Skip to content

Commit 28b4ad6

Browse files
committed
Update extern documentation for Rust 2024
1 parent 553600e commit 28b4ad6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

library/std/src/keyword_docs.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,13 @@ mod enum_keyword {}
381381
/// lazy_static;`. The other use is in foreign function interfaces (FFI).
382382
///
383383
/// `extern` is used in two different contexts within FFI. The first is in the form of external
384-
/// blocks, for declaring function interfaces that Rust code can call foreign code by.
384+
/// blocks, for declaring function interfaces that Rust code can call foreign code by. Starting
385+
/// with Rust 2024, external blocks must be marked as `unsafe`. In earlier editions, use of
386+
/// the `unsafe` keyword remains optional.
385387
///
386388
/// ```rust ignore
387389
/// #[link(name = "my_c_library")]
388-
/// extern "C" {
390+
/// unsafe extern "C" {
389391
/// fn my_c_function(x: i32) -> bool;
390392
/// }
391393
/// ```

0 commit comments

Comments
 (0)