nix-community / nix-index

Quickly locate nix packages with specific files [maintainers=@bennofs @figsoda @raitobezarius]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Panic on "Mismatch between definition and access of `type`. Could not downcast to TypeId

cyntheticfox opened this issue · comments

Mistyped a command and got a panic when nix-index tried to look it up:

thread 'main' panicked at 'Mismatch between definition and access of `type`. Could not downcast to TypeId { t: 2216151522148429770 }, need to downcast to TypeId { t: 11998283441053077895 }
', /build/nix-index-0.1.3-vendor.tar.gz/clap/src/parser/error.rs:30:9
stack backtrace:
   0:     0x55efcb4091ec - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf2ea00d5f3b53d9f
   1:     0x55efcb4349be - core::fmt::write::ha076a7e65c6b1874
   2:     0x55efcb417981 - std::io::Write::write_fmt::h9630bb3b0fe886f5
   3:     0x55efcb41e755 - std::panicking::default_hook::{{closure}}::h64163197f96398c1
   4:     0x55efcb41e3b2 - std::panicking::default_hook::h92625161492e6b48
   5:     0x55efcb41ec71 - std::panicking::rust_panic_with_hook::hfdd7d6bb6788c6c2
   6:     0x55efcb409527 - std::panicking::begin_panic_handler::{{closure}}::he81a60a7ef84ad4a
   7:     0x55efcb409304 - std::sys_common::backtrace::__rust_end_short_backtrace::h62801bf9780239e6
   8:     0x55efcb41e922 - rust_begin_unwind
   9:     0x55efcb25fda3 - core::panicking::panic_fmt::hfd221b9f37504b4a
  10:     0x55efcb27c450 - clap::parser::matches::arg_matches::ArgMatches::remove_many::h29734bc993998409
  11:     0x55efcb263b83 - nix_locate::main::h89cced8c6e98029c
  12:     0x55efcb26bbd3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h09cf637bd8afb941
  13:     0x55efcb26e389 - std::rt::lang_start::{{closure}}::h55e75eb5eaf4db56
  14:     0x55efcb411335 - std::rt::lang_start_internal::h09bcc9fffd987f14
  15:     0x55efcb26b748 - main
  16:     0x7f8046e2924e - __libc_start_call_main
  17:     0x7f8046e29309 - __libc_start_main_alias_1
  18:     0x55efcb25ff95 - _start
  19:                0x0 - <unknown>
bs: command not found
[1]    478631 exit 127   RUST_BACKTRACE=full bs

I think clap must have made major changes to their Derive system in their version bump, but either didn't entirely remove old ones or have them only semi-supported.

In https://github.com/bennofs/nix-index/blob/cc446260753a2e498d9aec6e1e042a1a0355f5ed/src/bin/nix-locate.rs, The Derive statement for type had its final argument adjusted, but looking at https://docs.rs/clap/latest/clap/_derive/_tutorial/index.html#validated-values, it looks to me like they more rewrote than renamed it.

Thanks, this was an oversight when updating to new clap. I should've tested --type, I'll do a 0.1.4 release and push the update to nixpkgs right away.