derive_more::Display error in macro invocation: expected expression, found ','

error: expected expression, found `,`
  --> src/amanuensis/registers.rs:87:10
   |
87 | #[derive(Display)]
   |          ^^^^^^^ expected expression
   |
   = note: this error originates in the derive macro `Display` (in Nightly builds, run with -Z macro-backtrace for more info)
[14:55]
Cargo.toml entry derive_more = { version = "1.0.0", features = ["display"] }

A bit more code and context may help solving this issue.

1 Like

This sounds like there is a syntax error in the struct, which is being hidden by the derive macro. Try removing the #[derive(Debug)] and see what errors you get.

More context:

#[bitsize(32)]
#[derive(FromBits, DebugBits, PartialEq)]
#[derive(Display)]
#[display(
    "{trig_timed_cap} {trig_round_cap} {trig_manual_cap} {end_manual_cap} {sel_bist_data} {bypass_wireless} {bypass_sd} {recoding}",
)]
pub struct CtrlReg {
    pub trig_timed_cap: bool,
    pub trig_round_cap: bool,
    pub trig_manual_cap: bool,
    pub end_manual_cap: bool,
    pub sel_bist_data: bool,
    pub bypass_wireless: bool,
    pub bypass_sd: bool,
    pub recording: bool,
    _reserved: u24,
}

My guess would be that the #[display] attribute doesn't support trailing commas. Could you try removing it, please?

#[bitsize(32)]
#[derive(FromBits, DebugBits, PartialEq)]
#[derive(Display)]
#[display(
-    "{trig_timed_cap} {trig_round_cap} {trig_manual_cap} {end_manual_cap} {sel_bist_data} {bypass_wireless} {bypass_sd} {recoding}",
+    "{trig_timed_cap} {trig_round_cap} {trig_manual_cap} {end_manual_cap} {sel_bist_data} {bypass_wireless} {bypass_sd} {recoding}"
)]
pub struct CtrlReg {
    pub trig_timed_cap: bool,
    pub trig_round_cap: bool,
    pub trig_manual_cap: bool,
    pub end_manual_cap: bool,
    pub sel_bist_data: bool,
    pub bypass_wireless: bool,
    pub bypass_sd: bool,
    pub recording: bool,
    _reserved: u24,
}
1 Like

solved thanks

1 Like

Would you mind reverting the change to the title, so that others searching for answers see the original title? To mark sometime solved, change the category to Help and then click the checkbox at the bottom of the reply that most represents the solution.