about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2023-07-07 18:27:16 +0100
committerDavid Wood <david.wood@huawei.com>2023-07-19 09:44:51 +0100
commitf53cef31f5ea41c9a5ab8e5335637a6873b9f0b5 (patch)
tree6100825ddfd2259c3c1a5f6dc51bafd9919548aa /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent0f16bd341eaf3ad47134c6d855a764e0099fbc93 (diff)
downloadrust-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