Description
While reviewing #60300 I noticed for the first time that the improper_ctypes lint normalizes with the "reveal_all" mode. I don't have a nuanced understanding of what that means exactly but based on the general description in the rustc docs and experimentation (see below) I think that's probably the wrong choice for this lint, because it exposes details to the user that are normally hidden during type checking.
For example, in this program using existential types, the lint pierces through otherwise-opaque existentials to look at the underlying (hidden) type, thus it both
- accepts code that is only FFI-safe because of the particular type underlying the existential, which users of that type shouldn't know or rely on
- leaks the underlying type to the user in error messages when (correctly) rejecting uses of an existential type as FFI-unsafe
I can't quickly find an equivalent using only stable impl Trait
, because we don't have typeof(function)
, but if there's a way to write "Option of the return type of this function" in stable Rust, then that would presumably have the same issue.
cc @eddyb for fact-checking my understanding that this is because of reveal_all