Yamato-Security / hayabusa-evtx

A fork of the evtx Rust crate for Hayabusa
Apache License 2.0
6 stars 2 forks source link

Update to bitflags 2 compile error #35

Closed YamatoSecurity closed 1 year ago

YamatoSecurity commented 1 year ago

bitflags seems to have moved on to major version 2. https://crates.io/crates/bitflags However, causes the following compile error:

error[E0277]: `ChunkFlags` doesn't implement `std::fmt::Debug`
  --> src/evtx_chunk.rs:45:5
   |
34 | #[derive(Debug)]
   |          ----- in this derive macro expansion
...
45 |     pub flags: ChunkFlags,
   |     ^^^^^^^^^^^^^^^^^^^^^ `ChunkFlags` cannot be formatted using `{:?}`
   |
   = help: the trait `std::fmt::Debug` is not implemented for `ChunkFlags`
   = note: add `#[derive(Debug)]` to `ChunkFlags` or manually `impl std::fmt::Debug for ChunkFlags`
   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `ChunkFlags` with `#[derive(Debug)]`
  --> /Users/reguser/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitflags-2.3.3/src/public.rs:17:9
   |
17 +         #[derive(Debug)]
18 |
   |

error[E0277]: `HeaderFlags` doesn't implement `std::fmt::Debug`
  --> src/evtx_file_header.rs:16:5
   |
6  | #[derive(Debug, PartialEq, Eq)]
   |          ----- in this derive macro expansion
...
16 |     pub flags: HeaderFlags,
   |     ^^^^^^^^^^^^^^^^^^^^^^ `HeaderFlags` cannot be formatted using `{:?}`
   |
   = help: the trait `std::fmt::Debug` is not implemented for `HeaderFlags`
   = note: add `#[derive(Debug)]` to `HeaderFlags` or manually `impl std::fmt::Debug for HeaderFlags`
   = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `HeaderFlags` with `#[derive(Debug)]`
  --> /Users/reguser/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitflags-2.3.3/src/public.rs:17:9
   |
17 +         #[derive(Debug)]
18 |     // Checksum is of first 120 bytes of header
   |

error[E0369]: binary operation `==` cannot be applied to type `HeaderFlags`
  --> src/evtx_file_header.rs:16:5
   |
6  | #[derive(Debug, PartialEq, Eq)]
   |                 --------- in this derive macro expansion
...
16 |     pub flags: HeaderFlags,
   |     ^^^^^^^^^^^^^^^^^^^^^^
   |
note: an implementation of `PartialEq` might be missing for `HeaderFlags`
  --> src/evtx_file_header.rs:21:1
   |
21 | / bitflags! {
22 | |     pub struct HeaderFlags: u32 {
23 | |         const EMPTY = 0x0;
24 | |         const DIRTY = 0x1;
...  |
27 | |     }
28 | | }
   | |_^ must implement `PartialEq`
   = note: this error originates in the derive macro `PartialEq` which comes from the expansion of the macro `bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `HeaderFlags` with `#[derive(PartialEq)]`
  --> /Users/reguser/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitflags-2.3.3/src/public.rs:17:9
   |
17 +         #[derive(PartialEq)]
18 |     // Checksum is of first 120 bytes of header
   |

error[E0277]: the trait bound `HeaderFlags: std::cmp::Eq` is not satisfied
   --> src/evtx_file_header.rs:16:5
    |
6   | #[derive(Debug, PartialEq, Eq)]
    |                            -- in this derive macro expansion
...
16  |     pub flags: HeaderFlags,
    |     ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `HeaderFlags`
    |
note: required by a bound in `AssertParamIsEq`
   --> /Users/reguser/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/cmp.rs:313:31
    |
313 | pub struct AssertParamIsEq<T: Eq + ?Sized> {
    |                               ^^ required by this bound in `AssertParamIsEq`
    = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `HeaderFlags` with `#[derive(Eq)]`
   --> /Users/reguser/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitflags-2.3.3/src/public.rs:17:9
    |
17  +         #[derive(Eq)]
18  |     // Checksum is of first 120 bytes of header
    |

Some errors have detailed explanations: E0277, E0369.
For more information about an error, try `rustc --explain E0277`.