-
Notifications
You must be signed in to change notification settings - Fork 127
Description
Running ./cargo.sh +msrv test --package zerocopy-derive -- --skip ui with our MSRV set to 1.58 results in the following test failure:
error[E0446]: private type `Private` in public interface
--> zerocopy-derive/tests/priv_in_pub.rs:18:10
|
18 | #[derive(KnownLayout, IntoBytes, FromZeros, FromBytes, Unaligned)]
| ^^^^^^^^^^^ can't leak private type
...
24 | struct Private(());
| ------------------- `Private` declared as private
|
= note: this error originates in the derive macro `KnownLayout` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0446]: private type `Private` in public interface
--> zerocopy-derive/tests/priv_in_pub.rs:18:23
|
18 | #[derive(KnownLayout, IntoBytes, FromZeros, FromBytes, Unaligned)]
| ^^^^^^^^^ can't leak private type
...
24 | struct Private(());
| ------------------- `Private` declared as private
|
= note: this error originates in the derive macro `IntoBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0446]: private type `Private` in public interface
--> zerocopy-derive/tests/priv_in_pub.rs:18:34
|
18 | #[derive(KnownLayout, IntoBytes, FromZeros, FromBytes, Unaligned)]
| ^^^^^^^^^ can't leak private type
...
24 | struct Private(());
| ------------------- `Private` declared as private
|
= note: this error originates in the derive macro `FromZeros` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0446]: private type `Private` in public interface
--> zerocopy-derive/tests/priv_in_pub.rs:18:45
|
18 | #[derive(KnownLayout, IntoBytes, FromZeros, FromBytes, Unaligned)]
| ^^^^^^^^^ can't leak private type
...
24 | struct Private(());
| ------------------- `Private` declared as private
|
= note: this error originates in the derive macro `FromBytes` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0446]: private type `Private` in public interface
--> zerocopy-derive/tests/priv_in_pub.rs:18:56
|
18 | #[derive(KnownLayout, IntoBytes, FromZeros, FromBytes, Unaligned)]
| ^^^^^^^^^ can't leak private type
...
24 | struct Private(());
| ------------------- `Private` declared as private
|
= note: this error originates in the derive macro `Unaligned` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0446`.
For the time being, we've disabled this test on versions 1.58 and earlier. This isn't a regression because our published crates do not currently support 1.58. That said, we should fix this if possible before releasing 0.8.
So far, I have found the following possible culprits:
- Accessing private fields from the def site of a proc macro rust-lang/rust#46635 (comment)
- https://docs.rs/quote/latest/quote/macro.quote.html#hygiene
In particular this documentation suggests that the quote! macro itself may not be the problem:
Any interpolated tokens preserve the
Spaninformation provided by theirToTokensimplementation. Tokens that originate within thequote!invocation are spanned withSpan::call_site().A different span can be provided through the
quote_spanned!macro.
I have not yet tried to replace all quote! invocations with quote_spanned! (passing Span::call_site()). That's the first thing to try. Next would be to consider whether an existing token passed to quote! is carrying its own span information.