Skip to content

cargo rustc panics on unknown bin #15493

Closed
@jyn514

Description

@jyn514

Problem

thread 'main' panicked at src/tools/cargo/src/cargo/ops/cargo_compile/unit_generator.rs:302:26:
The number of packages must be at least 1
stack backtrace:
   3: core::option::expect_failed
             at /rustc/13e87909494f2f31bce51bc106e2b629420d1235/library/core/src/option.rs:2049:5
   4: <cargo::ops::cargo_compile::unit_generator::UnitGenerator>::list_rule_targets
   5: <cargo::ops::cargo_compile::unit_generator::UnitGenerator>::generate_root_units
   6: cargo::ops::cargo_compile::create_bcx
   7: cargo::ops::cargo_compile::compile_ws
   8: cargo::ops::cargo_compile::compile_with_exec
   9: cargo::ops::cargo_compile::compile
  10: cargo::commands::rustc::exec
  11: <cargo::cli::Exec>::exec
  12: cargo::main

Steps

  1. cargo new cargo-bug
  2. cd cargo-bug
  3. mkdir src/bin
  4. cargo rustc --bin main

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.88.0-nightly (7918c7eb5 2025-04-27)
release: 1.88.0-nightly
commit-hash: 7918c7eb59614c39f1c4e27e99d557720976bdd7
commit-date: 2025-04-27
host: x86_64-unknown-linux-gnu
libgit2: 1.9.0 (sys:0.20.0 vendored)
libcurl: 8.12.1-DEV (sys:0.4.80+curl-8.12.1 vendored ssl:OpenSSL/3.4.1)
ssl: OpenSSL 3.4.1 11 Feb 2025
os: Pop!_OS 22.4.0 (jammy) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.regression-from-stable-to-betaRegression in beta that previously worked in stable.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions