Skip to content

Internal Compiler Error (maybe a clap.rs issue) #101625

@FedX-sudo

Description

@FedX-sudo

Hi, I was working on a minum-viable clap.rs application when I found the following compiler level error. It occers in several configurations of a clap.rs program. I am running NixOS 22.10, but have also tried it in a containerized Arch Linux with the same result. I have even tried diferent Cargo and Clap versions to no avail. If you want more info, please let me know!

Code

use clap::{ Arg, Command};

fn main() {
    let m = Command::new("BubblePop")
        .arg(Arg::new("exe")
            .short('x')
            .takes_value(true)
            .value_name("exe")
            .required(true)
            .help("The program you wish to run"),
        )
        .get_matches();
    let cmd = m.subcommand_matches("exe").unwrap();
    println!("exe: {:?}", cmd);
}

Meta

rustc --version --verbose:

rustc 1.63.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.63.0
LLVM version: 14.0.6

Error output

   Compiling bubblepop v0.1.0 (/home/fedx/Code.new/bubblepop)
thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `82`,
 right: `1002111927320821928687967599834759150`', compiler/rustc_query_impl/src/on_disk_cache.rs:537:5
stack backtrace:
   0:     0x7ff0b0abbc7c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb16b437de6ab6276
   1:     0x7ff0b0b48f6e - core::fmt::write::h8f8bef23583ee234
   2:     0x7ff0b0ace771 - std::io::Write::write_fmt::h8486efe074824056
   3:     0x7ff0b0ade3ae - std::panicking::default_hook::{{closure}}::hdfa4615b29a34cb8
   4:     0x7ff0b0ade017 - std::panicking::default_hook::h60ffd169fe7df297
   5:     0x7ff0b122f246 - rustc_driver[94b7c8f27e2bcbcb]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:     0x7ff0b0adeb9e - std::panicking::rust_panic_with_hook::hf0183b899953e185
   7:     0x7ff0b0abd077 - std::panicking::begin_panic_handler::{{closure}}::h93eac1c61f0beba3
   8:     0x7ff0b0abc054 - std::sys_common::backtrace::__rust_end_short_backtrace::he4788588c206eaab
   9:     0x7ff0b0ade6c2 - rust_begin_unwind
  10:     0x7ff0b0a8f193 - core::panicking::panic_fmt::h20a31c8e90ca0d37
  11:     0x7ff0b0b48c08 - core::panicking::assert_failed_inner::hf66c161d34b90f62
  12:     0x7ff0b11277bb - core[96ac0df7930e2029]::panicking::assert_failed::<u128, u128>
  13:     0x7ff0b27ee215 - <rustc_query_impl[fd459d9260f0925b]::on_disk_cache::OnDiskCache as rustc_middle[8c52257da44c505]::ty::context::OnDiskCache>::new
  14:     0x7ff0b1352ece - rustc_incremental[609f0ce256b2be6f]::persist::load::load_query_result_cache::<rustc_query_impl[fd459d9260f0925b]::on_disk_cache::OnDiskCache>
  15:     0x7ff0b138d375 - <rustc_interface[14fbaa9386871f84]::queries::Queries>::global_ctxt
  16:     0x7ff0b1267088 - <rustc_interface[14fbaa9386871f84]::interface::Compiler>::enter::<rustc_driver[94b7c8f27e2bcbcb]::run_compiler::{closure#1}::{closure#2}, core[96ac0df7930e2029]::result::Result<core[96ac0df7930e2029]::option::Option<rustc_interface[14fbaa9386871f84]::queries::Linker>, rustc_errors[dc95ec35e6e31d9]::ErrorGuaranteed>>
  17:     0x7ff0b123c693 - rustc_span[7e77982d3a3b6b14]::with_source_map::<core[96ac0df7930e2029]::result::Result<(), rustc_errors[dc95ec35e6e31d9]::ErrorGuaranteed>, rustc_interface[14fbaa9386871f84]::interface::create_compiler_and_run<core[96ac0df7930e2029]::result::Result<(), rustc_errors[dc95ec35e6e31d9]::ErrorGuaranteed>, rustc_driver[94b7c8f27e2bcbcb]::run_compiler::{closure#1}>::{closure#1}>
  18:     0x7ff0b128a09b - std[8e9dabf04e886e9e]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[14fbaa9386871f84]::util::run_in_thread_pool_with_globals<rustc_interface[14fbaa9386871f84]::interface::run_compiler<core[96ac0df7930e2029]::result::Result<(), rustc_errors[dc95ec35e6e31d9]::ErrorGuaranteed>, rustc_driver[94b7c8f27e2bcbcb]::run_compiler::{closure#1}>::{closure#0}, core[96ac0df7930e2029]::result::Result<(), rustc_errors[dc95ec35e6e31d9]::ErrorGuaranteed>>::{closure#0}, core[96ac0df7930e2029]::result::Result<(), rustc_errors[dc95ec35e6e31d9]::ErrorGuaranteed>>
  19:     0x7ff0b128d269 - <<std[8e9dabf04e886e9e]::thread::Builder>::spawn_unchecked_<rustc_interface[14fbaa9386871f84]::util::run_in_thread_pool_with_globals<rustc_interface[14fbaa9386871f84]::interface::run_compiler<core[96ac0df7930e2029]::result::Result<(), rustc_errors[dc95ec35e6e31d9]::ErrorGuaranteed>, rustc_driver[94b7c8f27e2bcbcb]::run_compiler::{closure#1}>::{closure#0}, core[96ac0df7930e2029]::result::Result<(), rustc_errors[dc95ec35e6e31d9]::ErrorGuaranteed>>::{closure#0}, core[96ac0df7930e2029]::result::Result<(), rustc_errors[dc95ec35e6e31d9]::ErrorGuaranteed>>::{closure#1} as core[96ac0df7930e2029]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  20:     0x7ff0b0aedda3 - std::sys::unix::thread::Thread::new::thread_start::hee2dbea4fc5f0323
  21:     0x7ff0b08a4e86 - start_thread
  22:     0x7ff0b092bc60 - __clone3
  23:                0x0 - <unknown>

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.63.0 running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `bubblepop`
Backtrace

   Compiling bubblepop v0.1.0 (/home/fedx/Code.new/bubblepop)
    Finished dev [unoptimized + debuginfo] target(s) in 8.79s
     Running `target/debug/bubblepop -x test`
thread 'main' panicked at 'Argument or group `exe` used where a subcommand name was expected.', /home/fedx/.cargo/registry/src/github.spider-man.dpdns.org-1ecc6299db9ec823/clap-3.2.20/src/parser/matches/arg_matches.rs:1086:14
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: clap::parser::matches::arg_matches::ArgMatches::get_subcommand
             at /home/fedx/.cargo/registry/src/github.spider-man.dpdns.org-1ecc6299db9ec823/clap-3.2.20/src/parser/matches/arg_matches.rs:1358:17
   3: clap::parser::matches::arg_matches::ArgMatches::subcommand_matches
             at /home/fedx/.cargo/registry/src/github.spider-man.dpdns.org-1ecc6299db9ec823/clap-3.2.20/src/parser/matches/arg_matches.rs:1086:9
   4: bubblepop::main
             at ./src/main.rs:14:15
   5: core::ops::function::FnOnce::call_once
             at /build/rustc-1.63.0-src/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions