Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alias with no subcommand panics #13814

Closed
DaniPopes opened this issue Apr 28, 2024 · 2 comments · Fixed by #13819
Closed

Alias with no subcommand panics #13814

DaniPopes opened this issue Apr 28, 2024 · 2 comments · Fixed by #13819
Assignees
Labels
A-aliases Area: command aliases A-diagnostics Area: Error and warning messages generated by Cargo itself. C-bug Category: bug E-easy Experience: Easy S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review

Comments

@DaniPopes
Copy link

DaniPopes commented Apr 28, 2024

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]
@DaniPopes DaniPopes added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Apr 28, 2024
@weihanglo
Copy link
Member

Thanks for the bug report.
I believe we could turn this into an error with some more additional contexts.

@rustbot label -S-triage +S-accepted +A-diagnostics +A-aliases +E-easy

@rustbot rustbot added A-aliases Area: command aliases A-diagnostics Area: Error and warning messages generated by Cargo itself. E-easy Experience: Easy S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review and removed S-triage Status: This issue is waiting on initial triage. labels Apr 28, 2024
@heisen-li
Copy link
Contributor

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-aliases Area: command aliases A-diagnostics Area: Error and warning messages generated by Cargo itself. C-bug Category: bug E-easy Experience: Easy S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants