Our cfg system makes it a bit too easy for a given type to implement a given libstd trait on one platform and not implement that trait on a different platform. This risk is especially high for default impls, where a negative impl may be present for a field of a given abstraction but not on another.
According to this reddit post, this problem manifested itself for the Process type, which was/is Send on non-windows platforms but is not Send on windows, due to the use of a *mut () field in the windows version.
Now, the obvious answer here is "testing!" But we might want to try to go further.
E.g., we could implement an analysis that pulls in the libstd code under every target cfg, and then compares all of the pub types to ensure that they are all consistent with respect to which pub traits they implement.
Our
cfgsystem makes it a bit too easy for a given type to implement a givenlibstdtrait on one platform and not implement that trait on a different platform. This risk is especially high for default impls, where a negative impl may be present for a field of a given abstraction but not on another.According to this reddit post, this problem manifested itself for the
Processtype, which was/isSendon non-windows platforms but is notSendon windows, due to the use of a*mut ()field in the windows version.Now, the obvious answer here is "testing!" But we might want to try to go further.
E.g., we could implement an analysis that pulls in the libstd code under every target
cfg, and then compares all of thepubtypes to ensure that they are all consistent with respect to whichpubtraits they implement.