Skip to content

build failed because of lazy_static #1317

@cnsky1103

Description

@cnsky1103

I imported version 0.34.0 as well as 0.35.2, both failed when I try to cargo run,
the error message leads me to sdl2/event.rs:49:1, where
image
and the compile error is

error: expected one of `:`, `;`, `=`, or `where`, found `<`
  --> /home/sky/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sdl2-0.35.2/src/sdl2/event.rs:49:1
   |
49 | / lazy_static! {
50 | |     static ref CUSTOM_EVENT_TYPES: Mutex<CustomEventTypeMaps> =
51 | |         Mutex::new(CustomEventTypeMaps::new());
52 | | }
   | | ^
   | | |
   | | expected one of `:`, `;`, `=`, or `where`
   | |_while parsing this item list starting here
   |   the item list ends here
   |
   = note: this error originates in the macro `__lazy_static_internal` which comes from the expansion of the macro `lazy_static` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0046]: not all trait items implemented, missing: `Target`, `deref`
  --> /home/sky/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sdl2-0.35.2/src/sdl2/event.rs:49:1
   |
49 | / lazy_static! {
50 | |     static ref CUSTOM_EVENT_TYPES: Mutex<CustomEventTypeMaps> =
51 | |         Mutex::new(CustomEventTypeMaps::new());
52 | | }
   | |_^ missing `Target`, `deref` in implementation
   |
   = note: this error originates in the macro `__lazy_static_internal` which comes from the expansion of the macro `lazy_static` (in Nightly builds, run with -Z macro-backtrace for more info)
   = help: implement the missing item: `type Target = Type;`
   = help: implement the missing item: `fn deref(&self) -> &<Self as Deref>::Target { todo!() }`

which is really weird, because I pasted these lines to a new project and it compiles. The code seems ok, and I don't know where goes wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions