This tracks eventually removing support for repr(transparent) types ignoring ZST that might not actually remain ZST in the future or on other targets.
Types that can gain more fields
In crate A:
#[non_exhaustive]
pub struct UnitType {}
In crate B:
#[repr(transparent)]
pub struct TransparentThing(i32, UnitType);
I expected that to fail in crate B, because the reason crate A put #[non_exhaustive] on the type was to allow it to get additional fields in the future, which would no longer allow it to work in repr(transparent).
But this actually compiles today, creating what I would consider an accidental semver hazard.
https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Stability.20of.201-ZSTness/near/215120408
repr(C) types
#[repr(C)]
struct CZst([u8; 0]);
#[repr(transparent)]
pub struct TransparentThing(i32, CZst);
This should fail since CZst actually is not a ZST for all C compilers, and since the type can be relevant for the ABI.