-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
portability risk: impls for libstd type can be platform dependent #22228
Comments
background discussion on |
nominating, as I am not sure whether the presence/absence of the current set of default impls in |
cc @aturon |
Currently Process implements Send on Unix and not on Windows: http://internals.rust-lang.org/t/what-rate-of-importability-do-we-allow-in-libstd/1556/4 |
Calls for some automated testing infra. |
we should do some kind of audit before 1.0 itself, though it can happen after 1.0 beta. Polish issue, 1.0, P-high. |
There's a similar issue with rustdoc, in that it can only document a single platform at a time. If the "cfg" system could be extended, it could solve both issues in one go. I'm envisaging something that would allow compiling multiple sets of "cfg" parameters in one go: this could be used to output documentation for all platforms, or to compare the non-platform-specific parts to check that they implement the same set of traits across all "cfg" variations. Whether or not it's done that way, I think this would be a good way of telling the compiler about cfg options:
|
an audit was done. closing. |
Our
cfg
system makes it a bit too easy for a given type to implement a givenlibstd
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/isSend
on non-windows platforms but is notSend
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 thepub
types to ensure that they are all consistent with respect to whichpub
traits they implement.The text was updated successfully, but these errors were encountered: