Skip to content

"__r#type" is not a valid identifier #839

Closed
@ShadowJonathan

Description

@ShadowJonathan

I currently have to work with the raw identifier r#type, as one database table is using this. I can't change this name, as i'm merely reading out the data from a pre-existing format.

However, when i try to put in a struct format, like so;

#[derive(Debug, ToSql, FromSql)]
struct DeviceInboxMessageFormat {
    pub messages: Json<HashMap<UserId, HashMap<DeviceId, Value>>>,
    pub sender: UserId,
    pub r#type: String,
}

The proc-macro panics on;

error: proc-macro derive panicked
  --> adapters/synapse/src/extract.rs:83:24
   |
83 | #[derive(Debug, ToSql, FromSql)]
   |                        ^^^^^^^
   |
   = help: message: `"__r#type"` is not a valid identifier

I think this problem will be the same across all raw identifiers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions