Currently, if one crate defines a 1-ZST with private fields, and then another crate tries to use that in a repr(transparent) type, that produces an error:
// Crate A
pub struct MyMarkerType((());
// Crate B
#[repr(transparent)]
struct Transparent(i32, A::MyMarkerType);
This warning is caused by #78586. The intention of the warning is to guard against a semver hazard: if crate A adds non-zero-sized fields to MyMarkerType in the future, that would break compilation of crate B.
However, what if crate A actually wants to promise that it will never add such fields? Currently it has no way to express this, the lint will always fire for types with private fields in other crates. This is on track to becoming a hard error (#78586).
See here for where @CAD97 originally brought up this issue.
Currently, if one crate defines a 1-ZST with private fields, and then another crate tries to use that in a
repr(transparent)type, that produces an error:This warning is caused by #78586. The intention of the warning is to guard against a semver hazard: if crate A adds non-zero-sized fields to
MyMarkerTypein the future, that would break compilation of crate B.However, what if crate A actually wants to promise that it will never add such fields? Currently it has no way to express this, the lint will always fire for types with private fields in other crates. This is on track to becoming a hard error (#78586).
See here for where @CAD97 originally brought up this issue.