diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-12-08 14:28:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-08 14:28:22 +0100 |
| commit | 703bb982303ecab02fec593899639b4c3faecddd (patch) | |
| tree | e3e5108b482ab266bbf6643f06d44b316caeee59 /compiler/rustc_codegen_llvm/src | |
| parent | f415c07494b98e4559e4b13a9c5f867b0e6b2444 (diff) | |
| parent | 02072fd83ada1ad690057b28bf01c33fb494378d (diff) | |
| download | rust-703bb982303ecab02fec593899639b4c3faecddd.tar.gz rust-703bb982303ecab02fec593899639b4c3faecddd.zip | |
Rollup merge of #131669 - niacdoial:linting-ptrdyn-ffi, r=workingjubilee
lint: change help for pointers to dyn types in FFI
### Context
while playing around, I encountered the warning for dyn types in `extern "C"` functions, but even after that I assumed that a (rust) raw pointer could be interpreted in C ('s ABI) as a `void *`... to be fair part of why I ignored the warning is because I wanted to poke at the generated assembly, not make useful code.
### Example
```rust
extern "C"
fn caller(callee: *const dyn Fn(i32)->i32){
// -- snip --
}
```
old warning:
```
warning: `extern` fn uses type `dyn Fn(i32) -> i32`, which is not FFI-safe
--> file/name.rs:42:19
|
42 | fn caller(callee: *const dyn Fn(i32)->i32) {
| ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
= note: trait objects have no C equivalent
= note: `#[warn(improper_ctypes_definitions)]` on by default
```
new warning:
```
warning: `extern` fn uses type `dyn Fn(i32) -> i32`, which is not FFI-safe
--> file/name.rs:42:19
|
42 | fn caller(callee: *const dyn Fn(i32)->i32) -> (){
| ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
|
= note: this pointer to an unsized type contains metadata, which makes it incompatible with a C pointer
= note: `#[warn(improper_ctypes_definitions)]` on by default
```
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions
