Skip to content

Alias with no subcommand panics #13814

Closed
@DaniPopes

Description

@DaniPopes

Problem

Cargo panics when using an alias that specifies cargo flags but not a subcommand.

thread 'main' panicked at src/bin/cargo/cli.rs:359:58:
subcommand is required
stack backtrace:
   0: rust_begin_unwind
             at /rustc/4d570eea025a19564429eb52b34ec34e14659f55/library/std/src/panicking.rs:652:5
   1: core::panicking::panic_fmt
             at /rustc/4d570eea025a19564429eb52b34ec34e14659f55/library/core/src/panicking.rs:72:14
   2: core::panicking::panic_display
             at /rustc/4d570eea025a19564429eb52b34ec34e14659f55/library/core/src/panicking.rs:263:5
   3: core::option::expect_failed
             at /rustc/4d570eea025a19564429eb52b34ec34e14659f55/library/core/src/option.rs:1994:5
   4: cargo::cli::expand_aliases
   5: cargo::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Steps

  1. alias.my_alias = "--locked" in ~/.cargo/config.toml
  2. cargo my_alias

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.79.0-nightly (c93926759 2024-04-23)
release: 1.79.0-nightly
commit-hash: c9392675917adc2edab269eea27c222b5359c637
commit-date: 2024-04-23
host: x86_64-unknown-linux-gnu
libgit2: 1.7.2 (sys:0.18.3 vendored)
libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Manjaro 23.1.4 (Vulcan) [64-bit]

Metadata

Metadata

Assignees

Labels

A-aliasesArea: command aliasesA-diagnosticsArea: Error and warning messages generated by Cargo itself.C-bugCategory: bugE-easyExperience: EasyS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions