Skip to content

Conversation

nooma-42
Copy link
Contributor

What does this PR try to resolve?

Related to #14520

This PR introduces auto-completion for the cargo <TAB> option. When a user types cargo <TAB> and presses the TAB key, the system will automatically suggest aliases defined in config.toml

How should we test and review this PR?

To verify this feature, follow these steps:

  1. In the terminal, type cargo <TAB>
  2. Press the TAB key.
  3. You should see aliases suggestions
2025-03-17.4.32.11.mov

@rustbot
Copy link
Collaborator

rustbot commented Mar 17, 2025

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-cli Area: Command-line interface, option parsing, etc. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 17, 2025
@rustbot

This comment has been minimized.

@nooma-42 nooma-42 force-pushed the custom-completer-for-cargo-<TAB>-to-complete-aliases-defined-in-config.toml branch from 6d215f4 to d2dc2f8 Compare March 18, 2025 05:34
@nooma-42
Copy link
Contributor Author

Could you shed some light why would this fail? This seems to me that the compiling output is different? since I'm not working with x86_64 linux, could it be some platform specific error?

failures:

---- basic stdout ----
running `/home/runner/work/cargo/cargo/target/debug/cargo check -Zbuild-std -Zpublic-dependency --target x86_64-unknown-linux-gnu`
running `/home/runner/work/cargo/cargo/target/debug/cargo build -Zbuild-std -Zpublic-dependency --target x86_64-unknown-linux-gnu`
running `/home/runner/work/cargo/cargo/target/debug/cargo run -Zbuild-std -Zpublic-dependency --target x86_64-unknown-linux-gnu`
running `/home/runner/work/cargo/cargo/target/debug/cargo test -Zbuild-std -Zpublic-dependency --target x86_64-unknown-linux-gnu`

thread 'basic' panicked at tests/build-std/main.rs:173:10:

---- expected: tests/build-std/main.rs:161:27
++++ actual:   stderr
   1      - [COMPILING] rustc-std-workspace-std [..]
        1 + [COMPILING] unicode-width v0.1.14
   2    2 | ...
   3    3 | [COMPILING] test v0.0.0 ([..])
   4    4 | [COMPILING] foo v0.0.1 ([ROOT]/foo)
   5    5 | [FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
   6    6 | [RUNNING] unittests src/lib.rs (target/[HOST_TARGET]/debug/deps/foo-[HASH])
   7    7 | [RUNNING] unittests src/main.rs (target/[HOST_TARGET]/debug/deps/foo-[HASH])
   8    8 | [RUNNING] tests/smoke.rs (target/[HOST_TARGET]/debug/deps/smoke-[HASH])
error: test failed, to rerun pass `-p cargo --test build-std`
   9    9 | [DOCTEST] foo

Update with SNAPSHOTS=overwrite

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    basic

test result: FAILED. 6 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in [56](https://github.com/rust-lang/cargo/actions/runs/13917114566/job/38942064437?pr=15319#step:6:57).88s

@weihanglo
Copy link
Member

@nooma-42 I'll look into build-std failure today.

@weihanglo
Copy link
Member

A rebase onto master should fix the CI failure.

@nooma-42 nooma-42 force-pushed the custom-completer-for-cargo-<TAB>-to-complete-aliases-defined-in-config.toml branch from f5da632 to 195a6f9 Compare March 19, 2025 03:40
@rustbot rustbot added A-configuration Area: cargo config files and env vars A-documenting-cargo-itself Area: Cargo's documentation A-workspaces Area: workspaces labels Mar 19, 2025
@nooma-42 nooma-42 force-pushed the custom-completer-for-cargo-<TAB>-to-complete-aliases-defined-in-config.toml branch 2 times, most recently from 74aba4d to c9adff5 Compare March 19, 2025 07:32
@nooma-42 nooma-42 force-pushed the custom-completer-for-cargo-<TAB>-to-complete-aliases-defined-in-config.toml branch from c9adff5 to 7e98310 Compare March 20, 2025 07:04
Copy link
Contributor

@epage epage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@epage epage added this pull request to the merge queue Mar 20, 2025
Merged via the queue into rust-lang:master with commit 307cbfd Mar 20, 2025
21 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 22, 2025
Update cargo

14 commits in 6cf8267012570f63d6b86e85a2ae5627de52df9e..307cbfda3119f06600e43cd38283f4a746fe1f8b
2025-03-14 15:25:36 +0000 to 2025-03-20 20:00:39 +0000
- feat: Add custom completer for cargo &lt;TAB&gt; to complete aliases defined in config.toml (rust-lang/cargo#15319)
- fix(build-dir): Renamed workspace-manifest-path-hash to workspace-path-hash (rust-lang/cargo#15334)
- feat: vcs, color, and message format native completion (rust-lang/cargo#15322)
- Fix `[env]` `relative` description in reference (rust-lang/cargo#15332)
- chore: fix some typos (rust-lang/cargo#15329)
- Cleanup for rustc-link-arg-cdylib (rust-lang/cargo#15326)
- fix(toml): Report '&lt;target&gt;.edition' deprecation to users (rust-lang/cargo#15321)
- test(build-std): address overly-matched snapshot (rust-lang/cargo#15325)
- Added `build.build_dir` templating support (rust-lang/cargo#15236)
- docs: make it clearer that `rust_version` is enforced during compile (rust-lang/cargo#15303)
- feat: Add custom completer for cargo +&lt;TAB&gt; to complete toolchain name (rust-lang/cargo#15301)
- chore: fix some typos (rust-lang/cargo#15316)
- fix: deduplicate crate types in cargo rustc command (rust-lang/cargo#15314)
- docs: mention wrong URLs as a cause of git authentication errors (rust-lang/cargo#15304)

r? ghost
@rustbot rustbot added this to the 1.87.0 milestone Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Area: Command-line interface, option parsing, etc. A-configuration Area: cargo config files and env vars A-documenting-cargo-itself Area: Cargo's documentation A-workspaces Area: workspaces S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants