-
Notifications
You must be signed in to change notification settings - Fork 141
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
zerocopy-derive used to support struct fields with raw identifiers, like r#type, up to 0.8.12, but this was broken in 0.8.13. For example:
use zerocopy::byteorder::network_endian::U16;
use zerocopy::{FromBytes, Immutable, IntoBytes, KnownLayout, Unaligned};
#[repr(C)]
#[derive(KnownLayout, FromBytes, IntoBytes, Immutable, Unaligned, Debug, PartialEq, Eq, Clone)]
pub struct IcmpHeader {
r#type: u8,
code: u8,
checksum: U16,
id: U16,
sequence: U16,
}This compiles successfully with this Cargo.toml:
[package]
name = "foo"
version = "0.1.0"
edition = "2021"
[dependencies]
zerocopy = { version = "=0.8.12", features = ["derive"] }But fails with this Cargo.toml:
[package]
name = "foo"
version = "0.1.0"
edition = "2021"
[dependencies]
zerocopy = { version = "=0.8.13", features = ["derive"] }with this error message:
% cargo build
Updating crates.io index
Compiling foo v0.1.0 (/usr/local/google/home/etryzelaar/foo)
error: proc-macro derive panicked
--> src/lib.rs:5:10
|
5 | #[derive(KnownLayout, FromBytes, IntoBytes, Immutable, Unaligned, Debug, PartialEq, Eq, Clone)]
| ^^^^^^^^^^^
|
= help: message: `"__Zerocopy_Field_r#type"` is not a valid identifier
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working