1
Fork 0

lint ImproperCTypes: confirm that Box<FfiSafeType> and Option<Box<FfiSafeType>> are FFI-safe in function declarations too

This commit is contained in:
niacdoial 2024-11-10 01:38:54 +01:00
parent d857bc8fbb
commit 9b59dd8178
3 changed files with 27 additions and 63 deletions

View file

@ -866,7 +866,7 @@ fn ty_is_known_nonnull<'tcx>(
match ty.kind() {
ty::FnPtr(..) => true,
ty::Ref(..) => true,
ty::Adt(def, _) if def.is_box() && matches!(mode, CItemKind::Definition) => true,
ty::Adt(def, _) if def.is_box() => true,
ty::Adt(def, args) if def.repr().transparent() && !def.is_union() => {
let marked_non_null = nonnull_optimization_guaranteed(tcx, *def);