Robbepop / modular-bitfield

Macro to generate bitfields for structs that allow for modular use of enums.
Apache License 2.0
155 stars 40 forks source link

Compilation broken for 0.10.0 for Rust edition 2015 #51

Closed henrikssn closed 3 years ago

henrikssn commented 3 years ago

This code does not compile in 0.10.0

#[bitfield(specifier = true)]
#[derive(Copy, Clone, PartialEq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct OpMode {
  reserved: B2,
  pub modem_mode: ModemMode,
  pub listen_abort: bool,
  pub listen_on: bool,
  pub sequencer_off: bool,
}
error[E0433]: failed to resolve: use of undeclared type or module `dyn`
  --> src/register.rs:39:3
   |
39 |   reserved: B2,
   |   ^^^^^^^^ use of undeclared type or module `dyn`

Suspicion: https://stackoverflow.com/questions/51071925/error-e0433-when-dyn-used-with-absolute-path https://github.com/Robbepop/modular-bitfield/blob/b9708ee98cf14d671bab58cf1f2b0b57dec047e0/impl/src/bitfield/expand.rs#L133

Robbepop commented 3 years ago

Thanks for the bug report!

Unfortunately I (again) cannot reproduce this since I am missing information about:

From this answer I guess we could fix this by using some parentheses. Please confirm! https://stackoverflow.com/a/51072034/1849963

Robbepop commented 3 years ago

@henrikssn Please see if this revision of modular_bitfield works for you: https://github.com/Robbepop/modular-bitfield/commit/9f805c8087782b546d765934d41634f06e3d1edf

henrikssn commented 3 years ago

Seems like I was using edition 2015, upgrading to 2018 compiles fine at current HEAD (fb37b66). I can't get it to compile at 0.10.0 though but I'll just wait for next version :)

I can also confirm 9f805c8 solves the compilation issue on edition 2015.

Robbepop commented 3 years ago

Okay thanks a lot for the confirmation. Closed then.