gitui icon indicating copy to clipboard operation
gitui copied to clipboard

`cargo install gitui` fails without `--lock` or lockfile: gitui v0.25.1

Open nuke-web3 opened this issue 1 year ago • 8 comments

Describe the bug Install fails (expand for logs)

 Compiling gitui v0.25.1
error[E0308]: mismatched types
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gitui-0.25.1/src/components/textinput.rs:151:28
     |
151  |                 .set_cursor_line_style(self.theme.text(true, false));
     |                  --------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found a different `ratatui::style::Style`
     |                  |
     |                  arguments to this method are incorrect
     |
     = note: `ratatui::style::Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.24.0/src/style.rs:192:1
     |
192  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.1/src/style.rs:227:1
     |
227  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-textarea-0.4.0/src/textarea.rs:1770:12
     |
1770 |     pub fn set_cursor_line_style(&mut self, style: Style) {
     |            ^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gitui-0.25.1/src/components/textinput.rs:154:5
     |
153  |               text_area.set_placeholder_style(
     |                         --------------------- arguments to this method are incorrect
154  | /                 self.theme
155  | |                     .text(self.selected.unwrap_or_default(), false),
     | |___________________________________________________________________^ expected `ratatui::style::Style`, found a different `ratatui::style::Style`
     |
     = note: `ratatui::style::Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.24.0/src/style.rs:192:1
     |
192  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.1/src/style.rs:227:1
     |
227  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-textarea-0.4.0/src/textarea.rs:1850:12
     |
1850 |     pub fn set_placeholder_style(&mut self, style: Style) {
     |            ^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gitui-0.25.1/src/components/textinput.rs:158:5
     |
157  |             text_area.set_style(
     |                       --------- arguments to this method are incorrect
158  |                 self.theme.text(self.selected.unwrap_or(true), false),
     |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `ratatui::style::Style`, found a different `ratatui::style::Style`
     |
     = note: `ratatui::style::Style` and `ratatui::style::Style` have similar names, but are actually distinct types
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.24.0/src/style.rs:192:1
     |
192  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.1/src/style.rs:227:1
     |
227  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-textarea-0.4.0/src/textarea.rs:1629:12
     |
1629 |     pub fn set_style(&mut self, style: Style) {
     |            ^^^^^^^^^

error[E0308]: mismatched types
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gitui-0.25.1/src/components/textinput.rs:163:6
     |
162  |                   text_area.set_block(
     |                             --------- arguments to this method are incorrect
163  | /                     Block::default()
164  | |                         .borders(Borders::ALL)
165  | |                         .border_style(
166  | |                             ratatui::style::Style::default()
...    |
170  | |                         )
171  | |                         .title(self.title.clone()),
     | |__________________________________________________^ expected `Block<'_>`, found a different `Block<'_>`
     |
     = note: `Block<'_>` and `Block<'_>` have similar names, but are actually distinct types
note: `Block<'_>` is defined in crate `ratatui`
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.24.0/src/widgets/block.rs:230:1
     |
230  | pub struct Block<'a> {
     | ^^^^^^^^^^^^^^^^^^^^
note: `Block<'_>` is defined in crate `ratatui`
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.1/src/widgets/block.rs:64:1
     |
64   | pub struct Block<'a> {
     | ^^^^^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-textarea-0.4.0/src/textarea.rs:1648:12
     |
1648 |     pub fn set_block(&mut self, block: Block<'a>) {
     |            ^^^^^^^^^

error[E0277]: the trait bound `impl ratatui::widgets::Widget + '_: Widget` is not satisfied
   --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/gitui-0.25.1/src/components/textinput.rs:638:20
    |
638 |             f.render_widget(ta.widget(), area);
    |               ------------- ^^^^^^^^^^^ the trait `Widget` is not implemented for `impl ratatui::widgets::Widget + '_`
    |               |
    |               required by a bound introduced by this call
    |
    = help: the following other types implement trait `Widget`:
              BarChart<'a>
              ratatui::widgets::Block<'a>
              Canvas<'a, F>
              Chart<'a>
              ratatui::widgets::Clear
              Gauge<'a>
              LineGauge<'a>
              ratatui::widgets::List<'a>
            and 4 others
note: required by a bound in `ratatui::Frame::<'_>::render_widget`
   --> /home/nuke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.24.0/src/terminal.rs:598:12
    |
596 |     pub fn render_widget<W>(&mut self, widget: W, area: Rect)
    |            ------------- required by a bound in this associated function
597 |     where
598 |         W: Widget,
    |            ^^^^^^ required by this bound in `Frame::<'_>::render_widget`

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `gitui` (bin "gitui") due to 5 previous errors
error: failed to compile `gitui v0.25.1`, intermediate artifacts can be found at `/tmp/cargo-installBWqSDp`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

To Reproduce Steps to reproduce the behavior:

  1. `cargo install gitui

Context (please complete the following information):

  • OS/Distro + Version: Pop!_OS
  • GitUI Version: v0.25.1
  • Rust version: rustc 1.76.0 (07dca489a 2024-02-04)

nuke-web3 avatar Feb 23 '24 17:02 nuke-web3

cargo install gitui --locked as the README suggests does solve this :sweat_smile:

nuke-web3 avatar Feb 23 '24 17:02 nuke-web3

still weird though i thought this was fixed by pinning the version in 5cff322

extrawurst avatar Feb 23 '24 17:02 extrawurst

   Compiling ratatui v0.26.1
   Compiling ratatui v0.24.0

Seems there is some dep that is not complying to using v24...

If you kill the lockfile and rebuild you see in lock:

[[package]]
name = "tui-textarea"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e38ced1f941a9cfc923fbf2fe6858443c42cc5220bfd35bdd3648371e7bd8e"
dependencies = [
 "crossterm",
 "ratatui 0.26.1",
 "unicode-width",
]

nuke-web3 avatar Feb 23 '24 17:02 nuke-web3

ok i cant get it to work without --locked what am I missing. i pin to a specific ratatui version and still it picks up a newer one?? WTF

though I fixed it as of #2090

extrawurst avatar Feb 23 '24 17:02 extrawurst

https://github.com/rhysd/tui-textarea/blob/main/Cargo.toml#L45 Seems that this is the issue... but I would think that cargo would then resolve to the more strict requirement, that you set... IIUC textarea is less strict?

Could be a cargo bug? :shrug:

See also https://github.com/rhysd/tui-textarea/issues/36

nuke-web3 avatar Feb 23 '24 17:02 nuke-web3

i mean there is no right or wrong I guess, in most cases cargo magically allowing two versions of the same dependency works fine, but I know of no way to control/configure that I want cargo to optimize for less duplication instead of most newest crates at expense of bloat and incompatibility like in this case.

extrawurst avatar Feb 23 '24 17:02 extrawurst

If I had to bet, I would think that it's a problem with features not matching up. But I see both here and in textarea default-features = false is present... I would think that this would be sufficient as only in this repo do you then use more features: crossterm and serde

IDK but maybe it has to do with resolving this nested crossterm feature for ratatui here? https://github.com/rhysd/tui-textarea/blob/main/Cargo.toml#L29

nuke-web3 avatar Feb 23 '24 17:02 nuke-web3

anyone coming across this: this is currently blocked by upstream work needed from ratatui. please see #2079 for more info

extrawurst avatar Mar 26 '24 15:03 extrawurst