Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the trait bound TableColor: From<crossterm::style::Color> is not satisfied #218

Open
jiayingwang-db opened this issue May 28, 2023 · 7 comments

Comments

@jiayingwang-db
Copy link

Hi, I might these 2 errors when installing Click on my laptop, could someone help to take a look?

error[E0277]: the trait bound `TableColor: From<crossterm::style::Color>` is not satisfied
  --> /Users/xxx.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/click-0.6.2/src/command/click.rs:59:55
   |
59 |                 Some(env.styles.context_table_color().into()),
   |                                                       ^^^^ the trait `From<crossterm::style::Color>` is not implemented for `TableColor`
   |
   = help: the following other types implement trait `From<T>`:
             <TableColor as From<ColorType>>
             <TableColor as From<comfy_table::Color>>
   = note: required for `crossterm::style::Color` to implement `Into<TableColor>`

error[E0308]: mismatched types
  --> /Users/xxx/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/click-0.6.2/src/table.rs:65:36
   |
61 |     fn to_color(&self, env: &Env) -> Color {
   |                                      ----- expected `comfy_table::Color` because of return type
...
65 |                 ColorType::Info => env.styles.info_color(),
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^ expected `comfy_table::Color`, found `crossterm::style::Color`
   |
   = note: `crossterm::style::Color` and `comfy_table::Color` have similar names, but are actually distinct types
note: `crossterm::style::Color` is defined in crate `crossterm`
  --> /Users/xxx/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/crossterm-0.25.0/src/style/types/color.rs:28:1
   |
28 | pub enum Color {
   | ^^^^^^^^^^^^^^
note: `comfy_table::Color` is defined in crate `crossterm`
  --> /Users/xxx/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/crossterm-0.26.1/src/style/types/color.rs:28:1
   |
28 | pub enum Color {
   | ^^^^^^^^^^^^^^
   = note: perhaps two different versions of crate `crossterm` are being used?

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `click` due to 2 previous errors
error: failed to compile `click v0.6.2`, intermediate artifacts can be found at `/var/folders/04/jlt2yd8n07x9np7x2lph9ghh0000gp/T/cargo-installuJD6gf`
@adiram359
Copy link

adiram359 commented Jun 15, 2023

click is also part of universe at bin/click.

@dsiddharth
Copy link

@nicklan we're running into the same issue when trying to install latest click as well

@rock-lucasnascin
Copy link

same here

@ryaminal
Copy link

ryaminal commented Sep 1, 2023

cloning the repo and doing cargo build works fine and can certainly use the prebuilt binaries, but it's strange that cargo install isn't working.

edit: oh, cargo install ignores the lock... interesting.
cargo build in the repo uses crossterm v0.26.1 but the cargo install uses v0.25.0 and v0.26.1... not certain how to fix but likely the problem.

@libratiger
Copy link

same issue

@hasnain-db
Copy link
Collaborator

hm, I'm unable to repro this on the latest rust/cargo version (1.75.0). if anyone here can still reproduce this please let me know

@hasnain-db
Copy link
Collaborator

rust-lang/cargo#7169 suggests cargo install click --locked is the right fix for this.

If this pops up again with more people affected we could update the readme. What do you think, @nicklan ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants