about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/Linker.cpp
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-04-26 07:13:07 +0200
committerGitHub <noreply@github.com>2025-04-26 07:13:07 +0200
commit806260e973deb3a0e10f193880b5e0db27b3ab48 (patch)
tree53f9c87a5336afc0bb32454bff729d23f881dd7d /compiler/rustc_llvm/llvm-wrapper/Linker.cpp
parente970d63b61b48ce72f0f7b325d75bb905dfd83c6 (diff)
parent1862feb0e7b88487e17d999ee5d1eb97a0b27b6a (diff)
downloadrust-806260e973deb3a0e10f193880b5e0db27b3ab48.tar.gz
rust-806260e973deb3a0e10f193880b5e0db27b3ab48.zip
Rollup merge of #140216 - t5kd:master, r=tgross35
Document that "extern blocks must be unsafe" in Rust 2024

The [documentation on `extern`](https://doc.rust-lang.org/std/keyword.extern.html) contains the following code sample:
```rust
#[link(name = "my_c_library")]
extern "C" {
    fn my_c_function(x: i32) -> bool;
}
```

Due to #123743, attempting to compile such code with the 2024 edition of Rust fails:
```
error: extern blocks must be unsafe
```

This PR extends the `extern` documentation with a brief explanation of the new requirement. It also adds the missing `unsafe` keyword to the code sample, which should be compatible with rustc since v1.82.

**Related docs:**
- https://doc.rust-lang.org/reference/items/external-blocks.html
- https://doc.rust-lang.org/edition-guide/rust-2024/unsafe-extern.html
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/Linker.cpp')
0 files changed, 0 insertions, 0 deletions