Macchina-CLI / macchina

A system information frontend with an emphasis on performance.
https://crates.io/crates/macchina
MIT License
1.48k stars 51 forks source link

[BUG] Fails to build with ratatui #289

Closed yonas closed 1 year ago

yonas commented 1 year ago

Describe the bug Lateset version fails to compile. I've tried both on FreeBSD 13.2 and Ubuntu 23.04.

To Reproduce Steps to reproduce the behavior:

  1. cargo install --git https://github.com/Macchina-CLI/macchina

Expected behavior Build should not fail.

Screenshots

  Compiling sqlite3-src v0.4.0
    Compiling libgit2-sys v0.14.2+1.5.1
     Building [======================>  ] 162/176: sqlite3-src(build), libgit2-sys(build)                                                                                                                           
    Building [======================>  ] 163/176: sqlite3-src, libgit2-sys(build)                                                                                                                                  
    Building [======================>  ] 164/176: libgit2-sys, sqlite3-src                                                                                                                                         
   Compiling sqlite3-sys v0.14.0
     Building [======================>  ] 164/176: sqlite3-sys, libgit2-sys, sqlite3-src                                                                                                                            
    Building [======================>  ] 165/176: sqlite3-sys, libgit2-sys                                                                                                                                         
   Compiling sqlite v0.27.3
     Building [======================>  ] 165/176: sqlite3-sys, libgit2-sys, sqlite                                                                                                                                 
    Building [======================>  ] 166/176: libgit2-sys, sqlite                                                                                                                                              
   Compiling git2 v0.16.1
     Building [======================>  ] 166/176: libgit2-sys, sqlite, git2                                                                                                                                        
    Building [======================>  ] 167/176: sqlite, git2                                                                                                                                                     
    Building [======================>  ] 168/176: git2                                                                                                                                                             
   Compiling vergen v7.5.1
     Building [======================>  ] 168/176: vergen, git2                                                                                                                                                     
    Building [=======================> ] 169/176: vergen                                                                                                                                                           
   Compiling libmacchina v7.1.0
    Compiling macchina v6.1.8 (/data/make-cd/files/macchina)
     Building [=======================> ] 170/176: libmacchina(build.rs), macchina(build.rs)                                                                                                                        
    Building [=======================> ] 171/176: libmacchina(build), macchina(build.rs)                                                                                                                           
    Building [=======================> ] 172/176: libmacchina, macchina(build.rs)                                                                                                                                  
    Building [=======================> ] 173/176: libmacchina, macchina(build)                                                                                                                                     
    Building [=======================> ] 174/176: libmacchina                                                                                                                                                      
    Building [=======================> ] 175/176: macchina(bin)                                                                                                                                                    
error[E0308]: mismatched types
    --> src/ascii.rs:70:8
     |
 70  |     Ok(buffer.into_text().unwrap_or_default())
     |     -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Text<'_>`, found `ratatui::text::Text<'_>`
     |     |
     |     arguments to this enum variant are incorrect
     |
     = note: `ratatui::text::Text<'_>` and `Text<'_>` have similar names, but are actually distinct types
 note: `ratatui::text::Text<'_>` is defined in crate `ratatui`
    --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/text.rs:264:1
     |
 264 | pub struct Text<'a> {
     | ^^^^^^^^^^^^^^^^^^^
 note: `Text<'_>` is defined in crate `ratatui`
    --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.20.1/src/text.rs:277:1
     |
 277 | pub struct Text<'a> {
     | ^^^^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
 help: the type constructed contains `ratatui::text::Text<'_>` due to the type of the argument passed
    --> src/ascii.rs:70:5
     |
 70  |     Ok(buffer.into_text().unwrap_or_default())
     |     ^^^--------------------------------------^
     |        |
     |        this argument influences the type of `Ok`
 note: tuple variant defined here
    --> /wrkdirs/usr/ports/lang/rust/work/rustc-1.70.0-src/library/core/src/result.rs:507:5

     Building [=======================> ] 175/176: macchina(bin)                                                                                                                                                    
error[E0308]: mismatched types
    --> src/ascii.rs:79:22
     |
 79  |     text.patch_style(Style::default().fg(color));
     |          ----------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ 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/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.20.1/src/style.rs:120:1
     |
 120 | pub struct Style {
     | ^^^^^^^^^^^^^^^^
 note: `ratatui::style::Style` is defined in crate `ratatui`
    --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/style.rs:121:1
     |
 121 | pub struct Style {
     | ^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
 note: method defined here
    --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/text.rs:353:12
     |
 353 |     pub fn patch_style(&mut self, style: Style) {
     |            ^^^^^^^^^^^

     Building [=======================> ] 175/176: macchina(bin)                                                                                                                                                    
error[E0308]: mismatched types
    --> src/ascii.rs:80:8
     |
 80  |     Ok(text)
     |     -- ^^^^ expected `Text<'_>`, found `ratatui::text::Text<'_>`
     |     |
     |     arguments to this enum variant are incorrect
     |
     = note: `ratatui::text::Text<'_>` and `Text<'_>` have similar names, but are actually distinct types
 note: `ratatui::text::Text<'_>` is defined in crate `ratatui`
    --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/text.rs:264:1
     |
 264 | pub struct Text<'a> {
     | ^^^^^^^^^^^^^^^^^^^
 note: `Text<'_>` is defined in crate `ratatui`
    --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.20.1/src/text.rs:277:1
     |
 277 | pub struct Text<'a> {
     | ^^^^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
 help: the type constructed contains `ratatui::text::Text<'_>` due to the type of the argument passed
    --> src/ascii.rs:80:5
     |
 80  |     Ok(text)
     |     ^^^----^
     |        |
     |        this argument influences the type of `Ok`
 note: tuple variant defined here
    --> /wrkdirs/usr/ports/lang/rust/work/rustc-1.70.0-src/library/core/src/result.rs:507:5

     Building [=======================> ] 175/176: macchina(bin)                                                                                                                                                    
error[E0308]: mismatched types
   --> src/theme/base.rs:14:24
    |
 14 | #[derive(Debug, Clone, Serialize, Deserialize)]
    |                        ^^^^^^^^^
    |                        |
    |                        expected `ratatui::style::Color`, found a different `ratatui::style::Color`
    |                        arguments to this function are incorrect
    |
    = note: `ratatui::style::Color` and `ratatui::style::Color` have similar names, but are actually distinct types
 note: `ratatui::style::Color` is defined in crate `ratatui`
   --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.20.1/src/style.rs:7:1
    |
 7  | pub enum Color {
    | ^^^^^^^^^^^^^^
 note: `ratatui::style::Color` is defined in crate `ratatui`
   --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/style.rs:8:1
    |
 8  | pub enum Color {
    | ^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `ratatui` are being used?
 note: function defined here
   --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/color-to-tui-0.3.0/src/lib.rs:7:8
    |
 7  | pub fn serialize<S: Serializer>(color: &Color, serializer: S) -> Result<S::Ok, S::Error> {
    |        ^^^^^^^^^
    = note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)

     Building [=======================> ] 175/176: macchina(bin)                                                                                                                                                    
error[E0308]: mismatched types
   --> src/theme/base.rs:14:35
    |
 14 | #[derive(Debug, Clone, Serialize, Deserialize)]
    |                                   ^^^^^^^^^^^ expected `ratatui::style::Color`, found a different `ratatui::style::Color`
    |
    = note: `ratatui::style::Color` and `ratatui::style::Color` have similar names, but are actually distinct types
 note: `ratatui::style::Color` is defined in crate `ratatui`
   --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/style.rs:8:1
    |
 8  | pub enum Color {
    | ^^^^^^^^^^^^^^
 note: `ratatui::style::Color` is defined in crate `ratatui`
   --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.20.1/src/style.rs:7:1
    |
 7  | pub enum Color {
    | ^^^^^^^^^^^^^^
    = note: perhaps two different versions of crate `ratatui` are being used?
    = note: this error originates in the macro `try` (in Nightly builds, run with -Z macro-backtrace for more info)

     Building [=======================> ] 175/176: macchina(bin)                                                                                                                                                    
error[E0308]: mismatched types
    --> src/theme/components.rs:106:33
     |
 106 | #[derive(Debug, Default, Clone, Serialize, Deserialize)]
     |                                 ^^^^^^^^^
     |                                 |
     |                                 expected `ratatui::style::Color`, found a different `ratatui::style::Color`
     |                                 arguments to this function are incorrect
     |
     = note: `ratatui::style::Color` and `ratatui::style::Color` have similar names, but are actually distinct types
 note: `ratatui::style::Color` is defined in crate `ratatui`
    --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.20.1/src/style.rs:7:1
     |
 7   | pub enum Color {
     | ^^^^^^^^^^^^^^
 note: `ratatui::style::Color` is defined in crate `ratatui`
    --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/style.rs:8:1
     |
 8   | pub enum Color {
     | ^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
 note: function defined here
    --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/color-to-tui-0.3.0/src/optional.rs:4:8
     |
 4   | pub fn serialize<S: Serializer>(color: &Option<Color>, serializer: S) -> Result<S::Ok, S::Error> {
     |        ^^^^^^^^^
     = note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)

     Building [=======================> ] 175/176: macchina(bin)                                                                                                                                                    
error[E0308]: mismatched types
    --> src/theme/components.rs:106:44
     |
 106 | #[derive(Debug, Default, Clone, Serialize, Deserialize)]
     |                                            ^^^^^^^^^^^ expected `ratatui::style::Color`, found a different `ratatui::style::Color`
     |
     = note: `ratatui::style::Color` and `ratatui::style::Color` have similar names, but are actually distinct types
 note: `ratatui::style::Color` is defined in crate `ratatui`
    --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.21.0/src/style.rs:8:1
     |
 8   | pub enum Color {
     | ^^^^^^^^^^^^^^
 note: `ratatui::style::Color` is defined in crate `ratatui`
    --> /home/yonas/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ratatui-0.20.1/src/style.rs:7:1
     |
 7   | pub enum Color {
     | ^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `ratatui` are being used?
     = note: this error originates in the macro `try` (in Nightly builds, run with -Z macro-backtrace for more info)

     Building [=======================> ] 175/176: macchina(bin)                                                                                                                                                    
For more information about this error, try `rustc --explain E0308`.
     Building [=======================> ] 175/176: macchina(bin)                                                                                                                                                    
error: could not compile `macchina` (bin "macchina") due to 11 previous errors

System Information You don't have to provide this information if you're not comfortable doing so, but it'll help us solve the issue a lot faster.

grtcdr commented 1 year ago

It looks like another occurence of this.

I'm working on it.

grtcdr commented 1 year ago

Fixed in https://github.com/Macchina-CLI/macchina/commit/089c831a54accd5d59932de2112d242e780c8dc2.

Thank you for bringing this to my attention.