TritonVM / triton-tui

Terminal User Interface to help debugging programs written for Triton VM.
Apache License 2.0
6 stars 0 forks source link

`cargo install triton-tui` fails #2

Open chancehudson opened 1 month ago

chancehudson commented 1 month ago

When i try to install this program from cargo i get the below output. I am able to install by cloning the repo and running cargo install --path .

error[E0308]: mismatched types
    --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/triton-tui-0.2.1/src/components/memory.rs:68:41
     |
68   |         text_area.set_cursor_line_style(Style::default());
     |                   --------------------- ^^^^^^^^^^^^^^^^ expected `Style`, found a different `Style`
     |                   |
     |                   arguments to this method are incorrect
     |
     = note: `Style` and `Style` have similar names, but are actually distinct types
note: `Style` is defined in crate `ratatui`
    --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.3/src/style.rs:227:1
     |
227  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `Style` is defined in crate `ratatui`
    --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.27.0/src/style.rs:228:1
     |
228  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /Users/chance/.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
    --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/triton-tui-0.2.1/src/components/memory.rs:262:41
     |
262  |         self.text_area.set_cursor_style(cursor_style);
     |                        ---------------- ^^^^^^^^^^^^ expected `Style`, found a different `Style`
     |                        |
     |                        arguments to this method are incorrect
     |
     = note: `Style` and `Style` have similar names, but are actually distinct types
note: `Style` is defined in crate `ratatui`
    --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.3/src/style.rs:227:1
     |
227  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `Style` is defined in crate `ratatui`
    --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.27.0/src/style.rs:228:1
     |
228  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tui-textarea-0.4.0/src/textarea.rs:1941:12
     |
1941 |     pub fn set_cursor_style(&mut self, style: Style) {
     |            ^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
    --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/triton-tui-0.2.1/src/components/memory.rs:268:34
     |
268  |         self.text_area.set_style(text_style);
     |                        --------- ^^^^^^^^^^ expected `Style`, found a different `Style`
     |                        |
     |                        arguments to this method are incorrect
     |
     = note: `Style` and `Style` have similar names, but are actually distinct types
note: `Style` is defined in crate `ratatui`
    --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.3/src/style.rs:227:1
     |
227  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
note: `Style` is defined in crate `ratatui`
    --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.27.0/src/style.rs:228:1
     |
228  | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /Users/chance/.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
    --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/triton-tui-0.2.1/src/components/memory.rs:271:34
     |
271  |         self.text_area.set_block(block);
     |                        --------- ^^^^^ expected `Block<'_>`, found a different `Block<'_>`
     |                        |
     |                        arguments to this method are incorrect
     |
     = note: `Block<'_>` and `Block<'_>` have similar names, but are actually distinct types
note: `Block<'_>` is defined in crate `ratatui`
    --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.3/src/widgets/block.rs:64:1
     |
64   | pub struct Block<'a> {
     | ^^^^^^^^^^^^^^^^^^^^
note: `Block<'_>` is defined in crate `ratatui`
    --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.27.0/src/widgets/block.rs:67:1
     |
67   | pub struct Block<'a> {
     | ^^^^^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
note: method defined here
    --> /Users/chance/.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 + '_: ratatui::widgets::Widget` is not satisfied
   --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/triton-tui-0.2.1/src/components/memory.rs:272:29
    |
272 |         frame.render_widget(self.text_area.widget(), render_info.areas....
    |               ------------- ^^^^^^^^^^^^^^^^^^^^^^^ the trait `ratatui::widgets::Widget` is not implemented for `impl ratatui::widgets::Widget + '_`
    |               |
    |               required by a bound introduced by this call
    |
    = help: the following other types implement trait `ratatui::widgets::Widget`:
              &W
              &str
              BarChart<'_>
              Canvas<'_, F>
              Chart<'_>
              Gauge<'_>
              LineGauge<'_>
              List<'_>
            and 10 others
note: required by a bound in `ratatui::Frame::<'_>::render_widget`
   --> /Users/chance/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.26.3/src/terminal/frame.rs:74:29
    |
74  |     pub fn render_widget<W: Widget>(&mut self, widget: W, area: Rect) {
    |                             ^^^^^^ 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 `triton-tui` (bin "triton-tui") due to 5 previous errors
error: failed to compile `triton-tui v0.2.1`, intermediate artifacts can be found at `/var/folders/4y/4ks9r0dx6194tpvl41wqrt6c0000gn/T/cargo-installywyEDf`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
Sword-Smith commented 1 month ago

It also works for me when I run cargo install --path .. The reason that the cargo crate fails could be Triton-VM is on alpha releases now. Triton VM v0.42.0 (the next major version) should be ready within a few weeks. I think that'll fix this issue.

joshka commented 1 month ago

This was likely caused by tui-textarea's ratatui version spec, which would often select and incompatible ratatui version due to a spec like >= 0.23. This would auto-update tui-textarea to an incompatible version even if your project had not yet taken that version. This should be fixed in tui-textarea 0.5 however (which has moved to stating deps as just e.g. 0.27

Two things to help diagnose this problem more generally: