Closed RalfJung closed 9 months ago
I wrote a patch that fixes the build and pushed it to https://github.com/RalfJung/winapi-rs/tree/0.2. I am not entirely sure, however, if there was some reason why Copy
was implemented instead of derived?
It might have been implemented instead of derived due to compile-duration concerns.
Is there a reason why the derived Debug
implementation cannot take the implemented Copy
into account? This would solve the issue in a backward compatible way.
The reason is "it's a breaking change" (given the constraints on how derive macros work), but we are probably going to do that anyway. See https://github.com/rust-lang/rust/pull/104429.
We ended up changing the implementation of derive
on packed types to keep winapi 0.2 working, see https://github.com/rust-lang/rust/pull/104429.
In https://github.com/rust-lang/rust/pull/102513 we are moving ahead with finally closing the ancient soundness issue https://github.com/rust-lang/rust/issues/82523 (originally tracked at https://github.com/rust-lang/rust/issues/27060): we are disallowing creating references to fields of packed structs. It seems like that will make winapi 0.2.8 fail to build:
It looks like current versions of winapi avoid that error by deriving
Copy
for those structs.I am not sure if there is anything you want to do about this -- winapi 0.2.8 seems to not be supported any more. However, given how widely used this crate is, it still might make sense to do a patch release so that people can fix their build with
cargo update
. If you want to do that, I'm open to waiting a bit before landing the rustc PR so that you can get the patch release out first.