Closed
Description
// The attribute around the whole FFI block works.
#[allow(improper_ctypes)]
extern {
// But this one on an individual FFI item doesn't.
#[allow(improper_ctypes)]
fn exit(_: &String);
}
The problem arises because the lint iterates over the children of ForeignMod
(extern {...}
):
rust/src/librustc_lint/types.rs
Lines 788 to 792 in 2ddc0cb
and it does so through
check_item
, but only check_foreign_item
would be affected by attributes on the individual foreign fn
/ static
/ type
children of the extern {...}
block.check_foreign_item
could be used instead, with the small change that the abi
has to be obtained from cx.tcx.hir.get_foreign_abi(ni.id)
, instead of nmod
's field (as nmod
would be gone).