dbus2 / zbus-old

Rust D-Bus crate.
https://gitlab.freedesktop.org/dbus/zbus
Other
49 stars 13 forks source link

zvariant_derive macros do not correctly handle `r#` identifiers #259

Open zeenix opened 2 years ago

zeenix commented 2 years ago

In GitLab by @jhartzell42 on Feb 1, 2022, 22:44

To reproduce, use SerializeDict with a field that uses the r# syntax, which is sometimes absolutely necessary bc of overlap with keywords e.g.:

#[derive(SerializeDict, TypeDict)]
struct Foo {
  r#type: String,
  r#struct: String,
}

The fields will be recorded as including the r#. Serde proper deals with this with an explicit special case: https://github.com/serde-rs/serde/blob/master/serde_derive/src/internals/attr.rs#L149

zeenix commented 2 years ago

@jhartzell42 Thanks. I'll have a look soon.