Module improper_ctypes

Module improper_ctypes 

Source

StructsΒ§

ImproperCTypesLint
ImproperCTypesVisitor πŸ”’
Visitor used to recursively traverse MIR types and evaluate FFI-safety. It uses check_* methods as entrypoints to be called elsewhere, and visit_* methods to recurse.
VisitorState πŸ”’

EnumsΒ§

CItemKind πŸ”’
FfiResult πŸ”’

StaticsΒ§

IMPROPER_CTYPES πŸ”’
The improper_ctypes lint detects incorrect use of types in foreign modules.
IMPROPER_CTYPES_DEFINITIONS πŸ”’
The improper_ctypes_definitions lint detects incorrect use of extern function definitions.
USES_POWER_ALIGNMENT πŸ”’
The uses_power_alignment lint detects specific repr(C) aggregates on AIX. In its platform C ABI, AIX uses the β€œpower” (as in PowerPC) alignment rule (detailed in https://www.ibm.com/docs/en/xl-c-and-cpp-aix/16.1?topic=data-using-alignment-modes#alignment), which can also be set for XLC by #pragma align(power) or -qalign=power. Aggregates with a floating-point type as the recursively first field (as in β€œat offset 0”) modify the layout of subsequent fields of the associated structs to use an alignment value where the floating-point type is aligned on a 4-byte boundary.

FunctionsΒ§

check_arg_for_power_alignment πŸ”’
Per-struct-field function that checks if a struct definition follows the Power alignment Rule (see the check_struct_for_power_alignment function).
check_non_exhaustive_variant πŸ”’
Check a variant of a non-exhaustive enum for improper ctypes
check_struct_for_power_alignment πŸ”’
Check a struct definition for respect of the Power alignment Rule (as in PowerPC), which should be respected in the β€œaix” target OS. To do so, we must follow one of the two following conditions:
variant_has_complex_ctor πŸ”’

Type AliasesΒ§

PartialFfiResult πŸ”’
The result when a type has been checked but perhaps not completely. None indicates that FFI safety/unsafety has not yet been determined, Some(res) indicates that the safety/unsafety in the FfiResult is final.