From ae1c3c21d47d6a4d7f83909bb0ce944d7bb17434 Mon Sep 17 00:00:00 2001 From: NagaChaitanya Vellanki Date: Wed, 15 Mar 2023 14:26:22 -0700 Subject: [PATCH 1/3] Add --ignore-rust-version flag to cargo install --- src/bin/cargo/commands/install.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/cargo/commands/install.rs b/src/bin/cargo/commands/install.rs index 790bfd2d7bc..8197a16900f 100644 --- a/src/bin/cargo/commands/install.rs +++ b/src/bin/cargo/commands/install.rs @@ -80,6 +80,7 @@ pub fn cli() -> Command { .requires("crate") .conflicts_with_all(&["git", "path", "index"]), ) + .arg_ignore_rust_version() .arg_message_format() .arg_timings() .after_help("Run `cargo help install` for more detailed information.\n") From 1c84d8219cf6f29655fdeb8255e6fa91ba4caa2d Mon Sep 17 00:00:00 2001 From: NagaChaitanya Vellanki Date: Wed, 15 Mar 2023 17:32:31 -0700 Subject: [PATCH 2/3] Add documentation for cargo install --ignore-rust-version --- src/doc/man/cargo-install.md | 2 ++ src/doc/man/generated_txt/cargo-install.txt | 5 +++++ src/doc/src/commands/cargo-install.md | 6 ++++++ src/etc/man/cargo-install.1 | 6 ++++++ 4 files changed, 19 insertions(+) diff --git a/src/doc/man/cargo-install.md b/src/doc/man/cargo-install.md index 14c2296c228..31c3d604830 100644 --- a/src/doc/man/cargo-install.md +++ b/src/doc/man/cargo-install.md @@ -179,6 +179,8 @@ See also the `--profile` option for choosing a specific profile by name. {{> options-profile }} +{{> options-ignore-rust-version }} + {{> options-timings }} {{/options}} diff --git a/src/doc/man/generated_txt/cargo-install.txt b/src/doc/man/generated_txt/cargo-install.txt index a285a1b6890..b13c3d78eb1 100644 --- a/src/doc/man/generated_txt/cargo-install.txt +++ b/src/doc/man/generated_txt/cargo-install.txt @@ -215,6 +215,11 @@ OPTIONS for more details on profiles. + --ignore-rust-version + Install the target even if the selected Rust compiler is older than + the required Rust version as configured in the project’s + rust-version field. + --timings=fmts Output information how long each compilation takes, and track concurrency information over time. Accepts an optional diff --git a/src/doc/src/commands/cargo-install.md b/src/doc/src/commands/cargo-install.md index 1601872ed8b..9b8c4084e73 100644 --- a/src/doc/src/commands/cargo-install.md +++ b/src/doc/src/commands/cargo-install.md @@ -248,6 +248,12 @@ See the the reference for more details +
--ignore-rust-version
+
Install the target even if the selected Rust compiler is older than the +required Rust version as configured in the project’s rust-version field.
+ + +
--timings=fmts
Output information how long each compilation takes, and track concurrency information over time. Accepts an optional comma-separated list of output diff --git a/src/etc/man/cargo-install.1 b/src/etc/man/cargo-install.1 index 32b2bf4c95a..49f5ce90d78 100644 --- a/src/etc/man/cargo-install.1 +++ b/src/etc/man/cargo-install.1 @@ -273,6 +273,12 @@ Install with the given profile. See the \fIthe reference\fR for more details on profiles. .RE .sp +\fB\-\-ignore\-rust\-version\fR +.RS 4 +Install the target even if the selected Rust compiler is older than the +required Rust version as configured in the project\[cq]s \fBrust\-version\fR field. +.RE +.sp \fB\-\-timings=\fR\fIfmts\fR .RS 4 Output information how long each compilation takes, and track concurrency From f5c699e75bb833bec8bb09d4488d81a57c9e8274 Mon Sep 17 00:00:00 2001 From: NagaChaitanya Vellanki Date: Thu, 16 Mar 2023 08:36:52 -0700 Subject: [PATCH 3/3] Add --ignore-rust-version to zsh, bash autocompletion --- src/etc/_cargo | 12 +++++++++++- src/etc/cargo.bashcomp.sh | 20 ++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/etc/_cargo b/src/etc/_cargo index df74c53a18f..bdceb10c97f 100644 --- a/src/etc/_cargo +++ b/src/etc/_cargo @@ -94,6 +94,7 @@ _cargo() { '(-p --package)'{-p+,--package=}'[specify package to run benchmarks for]:package:_cargo_package_names' \ '--exclude=[exclude packages from the benchmark]:spec' \ '--no-fail-fast[run all benchmarks regardless of failure]' \ + '--ignore-rust-version[Ignore rust-version specification in packages]' \ '1: :_guard "^-*" "bench name"' \ '*:args:_default' ;; @@ -105,6 +106,7 @@ _cargo() { '(-p --package)'{-p+,--package=}'[specify package to build]:package:_cargo_package_names' \ '--release[build in release mode]' \ '--build-plan[output the build plan in JSON]' \ + '--ignore-rust-version[Ignore rust-version specification in packages]' ;; check | c) @@ -113,6 +115,7 @@ _cargo() { "${command_scope_spec[@]}" \ '(-p --package)'{-p+,--package=}'[specify package to check]:package:_cargo_package_names' \ '--release[check in release mode]' \ + '--ignore-rust-version[Ignore rust-version specification in packages]' ;; clean) @@ -129,6 +132,7 @@ _cargo() { '--open[open docs in browser after the build]' \ '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \ '--release[build artifacts in release mode, with optimizations]' \ + '--ignore-rust-version[Ignore rust-version specification in packages]' ;; fetch) @@ -143,7 +147,8 @@ _cargo() { '--edition-idioms[fix warnings to migrate to the idioms of an edition]' \ '--allow-no-vcs[fix code even if a VCS was not detected]' \ '--allow-dirty[fix code even if the working directory is dirty]' \ - '--allow-staged[fix code even if the working directory has staged changes]' + '--allow-staged[fix code even if the working directory has staged changes]' \ + '--ignore-rust-version[Ignore rust-version specification in packages]' ;; generate-lockfile) @@ -177,6 +182,7 @@ _cargo() { '--tag=[tag to use when installing from git]:tag' \ '--version=[version to install from crates.io]:version' \ '--list[list all installed packages and their versions]' \ + '--ignore-rust-version[Ignore rust-version specification in packages]' \ '*: :_guard "^-*" "crate"' ;; @@ -258,6 +264,7 @@ _cargo() { '--bin=[name of the bin target]:name' \ '(-p --package)'{-p+,--package=}'[specify package with the target to run]:package:_cargo_package_names' \ '--release[build in release mode]' \ + '--ignore-rust-version[Ignore rust-version specification in packages]' \ '*: :_default' ;; @@ -267,6 +274,7 @@ _cargo() { '--profile=[specify profile to build the selected target for]:profile' \ '--release[build artifacts in release mode, with optimizations]' \ "${command_scope_spec[@]}" \ + '--ignore-rust-version[Ignore rust-version specification in packages]' \ '*: : _dispatch rustc rustc -default-' ;; @@ -277,6 +285,7 @@ _cargo() { '(-p --package)'{-p+,--package=}'[specify package to document]:package:_cargo_package_names' \ '--release[build artifacts in release mode, with optimizations]' \ "${command_scope_spec[@]}" \ + '--ignore-rust-version[Ignore rust-version specification in packages]' \ '*: : _dispatch rustdoc rustdoc -default-' ;; @@ -302,6 +311,7 @@ _cargo() { '(--lib --doc --bin --test --bench)--example=[example name]:_cargo_example_names' \ '(--lib --doc --bin --example --bench)--test=[test name]' \ '(--lib --doc --bin --example --test)--bench=[benchmark name]' \ + '--ignore-rust-version[Ignore rust-version specification in packages]' \ '*: :_default' ;; diff --git a/src/etc/cargo.bashcomp.sh b/src/etc/cargo.bashcomp.sh index cb709dccb8b..2867ec56dd5 100644 --- a/src/etc/cargo.bashcomp.sh +++ b/src/etc/cargo.bashcomp.sh @@ -49,21 +49,21 @@ _cargo() local opt___nocmd="$opt_common -V --version --list --explain" local opt__add="$opt_common -p --package --features --default-features --no-default-features $opt_mani --optional --no-optional --rename --dry-run --path --git --branch --tag --rev --registry --dev --build --target" - local opt__bench="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --no-run --no-fail-fast --target-dir" - local opt__build="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --profile --target-dir" + local opt__bench="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --no-run --no-fail-fast --target-dir --ignore-rust-version" + local opt__build="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --profile --target-dir --ignore-rust-version" local opt__b="$opt__build" - local opt__check="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --profile --target-dir" + local opt__check="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --profile --target-dir --ignore-rust-version" local opt__c="$opt__check" local opt__clean="$opt_common $opt_pkg $opt_mani $opt_lock --target --release --doc --target-dir --profile" local opt__clippy="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --profile --target-dir --no-deps --fix" - local opt__doc="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel --message-format --bin --bins --lib --target --open --no-deps --release --document-private-items --target-dir --profile" + local opt__doc="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel --message-format --bin --bins --lib --target --open --no-deps --release --document-private-items --target-dir --profile --ignore-rust-version" local opt__d="$opt__doc" local opt__fetch="$opt_common $opt_mani $opt_lock --target" - local opt__fix="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_parallel $opt_targets $opt_lock --release --target --message-format --broken-code --edition --edition-idioms --allow-no-vcs --allow-dirty --allow-staged --profile --target-dir" + local opt__fix="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_parallel $opt_targets $opt_lock --release --target --message-format --broken-code --edition --edition-idioms --allow-no-vcs --allow-dirty --allow-staged --profile --target-dir --ignore-rust-version" local opt__generate_lockfile="$opt_common $opt_mani $opt_lock" local opt__help="$opt_help" local opt__init="$opt_common $opt_lock --bin --lib --name --vcs --edition --registry" - local opt__install="$opt_common $opt_feat $opt_parallel $opt_lock $opt_force --bin --bins --branch --debug --example --examples --git --list --path --rev --root --tag --version --registry --target --profile --no-track" + local opt__install="$opt_common $opt_feat $opt_parallel $opt_lock $opt_force --bin --bins --branch --debug --example --examples --git --list --path --rev --root --tag --version --registry --target --profile --no-track --ignore-rust-version" local opt__locate_project="$opt_common $opt_mani $opt_lock --message-format --workspace" local opt__login="$opt_common $opt_lock --registry" local opt__metadata="$opt_common $opt_feat $opt_mani $opt_lock --format-version=1 --no-deps --filter-platform" @@ -77,12 +77,12 @@ _cargo() local opt__rm="$opt__remove" local opt__report="$opt_help $opt_verbose $opt_color future-incompat future-incompatibilities" local opt__report__future_incompat="$opt_help $opt_verbose $opt_color $opt_pkg --id" - local opt__run="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel --message-format --target --bin --example --release --target-dir --profile" + local opt__run="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel --message-format --target --bin --example --release --target-dir --profile --ignore-rust-version" local opt__r="$opt__run" - local opt__rustc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets -L --crate-type --extern --message-format --profile --target --release --target-dir" - local opt__rustdoc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --open --target-dir --profile" + local opt__rustc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets -L --crate-type --extern --message-format --profile --target --release --target-dir --ignore-rust-version" + local opt__rustdoc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --target --release --open --target-dir --profile --ignore-rust-version" local opt__search="$opt_common $opt_lock --limit --index --registry" - local opt__test="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --doc --target --no-run --release --no-fail-fast --target-dir --profile" + local opt__test="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock $opt_parallel $opt_targets --message-format --doc --target --no-run --release --no-fail-fast --target-dir --profile --ignore-rust-version" local opt__t="$opt__test" local opt__tree="$opt_common $opt_pkg_spec $opt_feat $opt_mani $opt_lock --target -i --invert --prefix --no-dedupe --duplicates -d --charset -f --format -e --edges" local opt__uninstall="$opt_common $opt_lock $opt_pkg --bin --root"