hkoosha / zoha4

Drop down terminal inspired by Tilda - GTK4.
https://zoha.rs
GNU General Public License v3.0
2 stars 0 forks source link

the trait bound `ZohaCfg: From<RawCfg>` is not satisfied #11

Closed RAVENz46 closed 7 months ago

RAVENz46 commented 7 months ago

Hi. I wanna try it on NixOS but I cannot build it with this error. I'm so sorry if it is my fault.

error[E0277]: the trait bound `ZohaCfg: From<RawCfg>` is not satisfied
    --> src/config/cfg.rs:1359:36
     |
1359 |         let cfg: ZohaCfg = raw_cfg.try_into().unwrap();
     |                                    ^^^^^^^^ the trait `From<RawCfg>` is not implemented for `ZohaCfg`
     |
     = note: required for `RawCfg` to implement `Into<ZohaCfg>`
     = note: required for `ZohaCfg` to implement `TryFrom<RawCfg>`
     = note: required for `RawCfg` to implement `TryInto<ZohaCfg>`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `zoha4` (lib test) due to 1 previous error
entire nix build log ``` warning: The interpretation of store paths arguments ending in `.drv` recently changed. If this command is now failing try again with '/nix/store/7ywxzh5if70vrjnh44qp5s29j6xwj2k4-zoha4-0.1.0.drv^*' @nix { "action": "setPhase", "phase": "unpackPhase" } Running phase: unpackPhase unpacking source archive /nix/store/lvs1cy9fjpxljaq78pj2ircc8nmkpbv8-source source root is source Executing cargoSetupPostUnpackHook Finished cargoSetupPostUnpackHook @nix { "action": "setPhase", "phase": "patchPhase" } Running phase: patchPhase Executing cargoSetupPostPatchHook Validating consistency between /build/source/Cargo.lock and /build/cargo-vendor-dir/Cargo.lock Finished cargoSetupPostPatchHook @nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" } Running phase: updateAutotoolsGnuConfigScriptsPhase @nix { "action": "setPhase", "phase": "configurePhase" } Running phase: configurePhase @nix { "action": "setPhase", "phase": "buildPhase" } Running phase: buildPhase Executing cargoBuildHook ++ env CC_X86_64_UNKNOWN_LINUX_GNU=/nix/store/ac1hb5dc2z4biwgy8mjrhlifffkkrvdq-gcc-wrapper-13.2.0/bin/cc CXX_X86_64_UNKNOWN_LINUX_GNU=/nix/store/ac1hb5dc2z4biwgy8mjrhlifffkkrvdq-gcc-wrapper-13.2.0/bin/c++ CARGO_T> Compiling pkg-config v0.3.30 Compiling serde v1.0.197 Compiling equivalent v1.0.1 Compiling hashbrown v0.14.3 Compiling target-lexicon v0.12.14 Compiling heck v0.5.0 Compiling winnow v0.6.6 Compiling smallvec v1.13.2 Compiling version-compare v0.2.0 Compiling libc v0.2.153 Compiling proc-macro2 v1.0.79 Compiling unicode-ident v1.0.12 Compiling autocfg v1.2.0 Compiling memchr v2.7.2 Compiling winnow v0.5.40 Compiling futures-core v0.3.30 Compiling pin-project-lite v0.2.14 Compiling thiserror v1.0.58 Compiling futures-task v0.3.30 Compiling slab v0.4.9 Compiling pin-utils v0.1.0 Compiling futures-channel v0.3.30 Compiling bitflags v2.5.0 Compiling indexmap v2.2.6 Compiling quote v1.0.36 Compiling gio v0.19.4 Compiling version_check v0.9.4 Compiling cfg-expr v0.15.8 Compiling syn v2.0.58 Compiling futures-io v0.3.30 Compiling semver v1.0.22 Compiling syn v1.0.109 Compiling proc-macro-error-attr v1.0.4 Compiling proc-macro-error v1.0.4 Compiling memoffset v0.9.1 Compiling anyhow v1.0.82 Compiling libdbus-sys v0.2.5 Compiling aho-corasick v1.1.3 Compiling rustc_version v0.4.0 Compiling utf8parse v0.2.1 Compiling regex-syntax v0.8.3 Compiling anstyle-parse v0.2.3 Compiling field-offset v0.3.6 Compiling x11 v2.21.0 Compiling io-lifetimes v2.0.3 Compiling anstyle-query v1.0.2 Compiling anstyle v1.0.6 Compiling colorchoice v1.0.0 Compiling is-terminal v0.4.12 Compiling device_query v2.0.0 Compiling log v0.4.21 Compiling strsim v0.11.1 Compiling anstream v0.6.13 Compiling eyre v0.6.12 Compiling termcolor v1.4.1 Compiling clap_lex v0.7.0 Compiling humantime v2.1.0 Compiling option-ext v0.2.0 Compiling dirs-sys v0.4.1 Compiling clap_builder v4.5.2 Compiling dbus v0.9.7 Compiling regex-automata v0.4.6 Compiling indenter v0.3.3 Compiling toml_datetime v0.6.5 Compiling serde_spanned v0.6.5 Compiling once_cell v1.19.0 Compiling lazy_static v1.4.0 Compiling toml_edit v0.22.9 Compiling toml_edit v0.21.1 Compiling dirs v5.0.1 Compiling toml v0.8.12 Compiling futures-macro v0.3.30 Compiling system-deps v6.2.2 Compiling proc-macro-crate v3.1.0 Compiling thiserror-impl v1.0.58 Compiling serde_derive v1.0.197 Compiling regex v1.10.4 Compiling futures-util v0.3.30 Compiling glib-macros v0.19.4 Compiling glib-sys v0.19.0 Compiling gobject-sys v0.19.0 Compiling gio-sys v0.19.0 Compiling gdk-pixbuf-sys v0.19.0 Compiling pango-sys v0.19.0 Compiling cairo-sys-rs v0.19.2 Compiling futures-executor v0.3.30 Compiling gdk4-sys v0.8.1 Compiling graphene-sys v0.19.0 Compiling gsk4-sys v0.8.1 Compiling gtk4-sys v0.8.1 Compiling vte4-sys v0.7.0 Compiling gdk4-wayland-sys v0.8.1 Compiling gdk4-x11-sys v0.8.1 Compiling gtk4-macros v0.8.1 Compiling env_logger v0.10.2 Compiling clap_derive v4.5.4 Compiling dbus-crossroads v0.5.2 Compiling pretty_env_logger v0.5.0 Compiling glib v0.19.4 Compiling clap v4.5.4 Compiling cairo-rs v0.19.4 Compiling graphene-rs v0.19.2 Compiling gdk-pixbuf v0.19.2 Compiling pango v0.19.3 Compiling gdk4 v0.8.1 Compiling gsk4 v0.8.1 Compiling gdk4-wayland v0.8.1 Compiling gdk4-x11 v0.8.1 Compiling gtk4 v0.8.1 Compiling vte4 v0.7.1 Compiling zoha4 v0.1.0 (/build/source) Finished release [optimized] target(s) in 1m 23s Executing cargoInstallPostBuildHook Finished cargoInstallPostBuildHook Finished cargoBuildHook buildPhase completed in 1 minutes 24 seconds @nix { "action": "setPhase", "phase": "checkPhase" } Running phase: checkPhase Executing cargoCheckHook ++ cargo test -j 12 --profile release --target x86_64-unknown-linux-gnu --frozen -- --test-threads=12 Compiling zoha4 v0.1.0 (/build/source) error[E0277]: the trait bound `ZohaCfg: From` is not satisfied --> src/config/cfg.rs:1359:36 | 1359 | let cfg: ZohaCfg = raw_cfg.try_into().unwrap(); | ^^^^^^^^ the trait `From` is not implemented for `ZohaCfg` | = note: required for `RawCfg` to implement `Into` = note: required for `ZohaCfg` to implement `TryFrom` = note: required for `RawCfg` to implement `TryInto` For more information about this error, try `rustc --explain E0277`. error: could not compile `zoha4` (lib test) due to 1 previous error ```
my nix derivation ``` { lib , rustPlatform , fetchFromGitHub , pkg-config , wrapGAppsHook4 , cairo , dbus , gdk-pixbuf , glib , gtk4 , pango , vte-gtk4 , stdenv }: rustPlatform.buildRustPackage rec { pname = "zoha4"; version = "0.1.0"; src = fetchFromGitHub { owner = "hkoosha"; repo = "zoha4"; rev = "v${version}"; hash = "sha256-NaPCc5EfHtmvWf80fziBWYi6oa0jNN+xpDFGSx12uE0="; }; cargoLock = { lockFile = ./Cargo.lock; }; postPatch = '' ln -s ${./Cargo.lock} Cargo.lock ''; nativeBuildInputs = [ pkg-config wrapGAppsHook4 ]; buildInputs = [ cairo dbus gdk-pixbuf glib gtk4 pango vte-gtk4 ]; meta = with lib; { description = "Drop down terminal inspired by Tilda - GTK4"; homepage = "https://github.com/hkoosha/zoha4"; license = licenses.gpl3Only; maintainers = with maintainers; [ ]; mainProgram = "zoha4"; }; } ```
hkoosha commented 7 months ago

Hm... that is strange!

I'll test it on NixOS today and will try to debug it 🤔

Thanks for reporting this.

hkoosha commented 7 months ago

I'm checking this on mobile, so not 100% sure but I think I know what's the problem:

Since this was a personal project, I didn't really add any tests (guilty as charged 🙌) except the one for ZohaCfg, which I later forgot about.

Thinking I've no tests in the project, I never ran cargo test and only did cargo builds (again, guilty as charged).

Now that forgotten test is failing. Fun fact is, that test is not even testing anything. I'll remove it today before EoD.

RAVENz46 commented 7 months ago

I confirm that removing test sections solves the issue. Thanks!

hkoosha commented 7 months ago

@RAVENz46 fix is merged; I'll close the issue, but feel free to re-open if it's still there.

And thanks again for catching this! ❤️