colored-rs / colored

(Rust) Coloring terminal so simple you already know how to do it !
Mozilla Public License 2.0
1.74k stars 84 forks source link

Bug: Can't compile #148

Closed Massimiliano-solutiontech closed 1 year ago

Massimiliano-solutiontech commented 1 year ago

When I compile a project with a dependency that has the colored as dependency I can't compile and I get this error

error[E0195]: lifetime parameters or bounds on type `Target` do not match the trait declaration
  --> /Users/massimilianomontagni/.cargo/registry/src/index.crates.io-6f17d22bba15001f/colored-2.0.4/src/control.rs:82:1
   |
82 | / lazy_static! {
83 | | /// The persistent [`ShouldColorize`].
84 | |     pub static ref SHOULD_COLORIZE: ShouldColorize = ShouldColorize::from_env();
85 | | }
   | |_^ lifetimes do not match type in trait
   |
   = 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)

   Compiling bit-vec v0.6.3
error[E0599]: no method named `set_override` found for struct `SHOULD_COLORIZE` in the current scope
  --> /Users/massimilianomontagni/.cargo/registry/src/index.crates.io-6f17d22bba15001f/colored-2.0.4/src/control.rs:73:21
   |
73 |       SHOULD_COLORIZE.set_override(override_colorize)
   |                       ^^^^^^^^^^^^ method not found in `SHOULD_COLORIZE`
...
82 | / lazy_static! {
83 | | /// The persistent [`ShouldColorize`].
84 | |     pub static ref SHOULD_COLORIZE: ShouldColorize = ShouldColorize::from_env();
85 | | }
   | |_- method `set_override` not found for this struct

error[E0599]: no method named `unset_override` found for struct `SHOULD_COLORIZE` in the current scope
  --> /Users/massimilianomontagni/.cargo/registry/src/index.crates.io-6f17d22bba15001f/colored-2.0.4/src/control.rs:79:21
   |
79 |       SHOULD_COLORIZE.unset_override()
   |                       ^^^^^^^^^^^^^^ method not found in `SHOULD_COLORIZE`
...
82 | / lazy_static! {
83 | | /// The persistent [`ShouldColorize`].
84 | |     pub static ref SHOULD_COLORIZE: ShouldColorize = ShouldColorize::from_env();
85 | | }
   | |_- method `unset_override` not found for this struct

error[E0599]: no method named `should_colorize` found for struct `SHOULD_COLORIZE` in the current scope
   --> /Users/massimilianomontagni/.cargo/registry/src/index.crates.io-6f17d22bba15001f/colored-2.0.4/src/lib.rs:387:34
    |
387 |           control::SHOULD_COLORIZE.should_colorize()
    |                                    ^^^^^^^^^^^^^^^ method not found in `SHOULD_COLORIZE`
    |
   ::: /Users/massimilianomontagni/.cargo/registry/src/index.crates.io-6f17d22bba15001f/colored-2.0.4/src/control.rs:82:1
    |
82  | / lazy_static! {
83  | | /// The persistent [`ShouldColorize`].
84  | |     pub static ref SHOULD_COLORIZE: ShouldColorize = ShouldColorize::from_env();
85  | | }
    | |_- method `should_colorize` not found for this struct

Some errors have detailed explanations: E0195, E0599.
For more information about an error, try `rustc --explain E0195`.
error: could not compile `colored` (lib) due to 4 previous errors
warning: build failed, waiting for other jobs to finish...

 *  The terminal process "/bin/zsh '-c', 'npm run tauri:dev'" terminated with exit code: 101.
kurtlawrence commented 1 year ago

Are you targeting wasm?

Massimiliano-solutiontech commented 1 year ago

Nope, it’s a Tauri app, but once it worked and today I had to delete the target folder and recompile all and that’s when the error popped out

Massimiliano-solutiontech commented 1 year ago

Solved, it was a conflict with the flamegraph