diff options
| author | David Wood <david.wood@huawei.com> | 2023-07-07 18:27:16 +0100 |
|---|---|---|
| committer | David Wood <david.wood@huawei.com> | 2023-07-19 09:44:51 +0100 |
| commit | f53cef31f5ea41c9a5ab8e5335637a6873b9f0b5 (patch) | |
| tree | 6100825ddfd2259c3c1a5f6dc51bafd9919548aa /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 0f16bd341eaf3ad47134c6d855a764e0099fbc93 (diff) | |
| download | rust-f53cef31f5ea41c9a5ab8e5335637a6873b9f0b5.tar.gz rust-f53cef31f5ea41c9a5ab8e5335637a6873b9f0b5.zip | |
lint/ctypes: stricter `()` return type checks
`()` is normally FFI-unsafe, but is FFI-safe when used as a return type. It is also desirable that a transparent newtype for `()` is FFI-safe when used as a return type. In order to support this, when an type was deemed FFI-unsafe, because of a `()` type, and was used in return type - then the type was considered FFI-safe. However, this was the wrong approach - it didn't check that the `()` was part of a transparent newtype! The consequence of this is that the presence of a `()` type in a more complex return type would make it the entire type be considered safe (as long as the `()` type was the first that the lint found) - which is obviously incorrect. Instead, this logic is removed, and a unit return type or a transparent wrapper around a unit is checked for directly for functions and fn-ptrs. Signed-off-by: David Wood <david@davidtw.co>
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
