From dc1519d0d7b818be053cdcdaa0efe3c1fd3ed8bf Mon Sep 17 00:00:00 2001 From: Ifropc Date: Wed, 17 Jul 2024 04:56:51 -0700 Subject: [PATCH 01/12] feat: add new lockfile-path for metadata - Also add necessary tests for the new flag --- src/bin/cargo/commands/metadata.rs | 4 +- src/cargo/core/workspace.rs | 12 ++ src/cargo/ops/lockfile.rs | 25 ++- src/cargo/util/command_prelude.rs | 77 ++++++++- tests/testsuite/lockfile_path.rs | 240 +++++++++++++++++++++++++++++ tests/testsuite/main.rs | 1 + 6 files changed, 349 insertions(+), 10 deletions(-) create mode 100644 tests/testsuite/lockfile_path.rs diff --git a/src/bin/cargo/commands/metadata.rs b/src/bin/cargo/commands/metadata.rs index 83232ef47f2..0b98d50a114 100644 --- a/src/bin/cargo/commands/metadata.rs +++ b/src/bin/cargo/commands/metadata.rs @@ -1,6 +1,7 @@ -use crate::command_prelude::*; use cargo::ops::{self, OutputMetadataOptions}; +use crate::command_prelude::*; + pub fn cli() -> Command { subcommand("metadata") .about( @@ -26,6 +27,7 @@ pub fn cli() -> Command { .arg_silent_suggestion() .arg_features() .arg_manifest_path() + .arg_lockfile_path() .after_help(color_print::cstr!( "Run `cargo help metadata` for more detailed information.\n" )) diff --git a/src/cargo/core/workspace.rs b/src/cargo/core/workspace.rs index 4ac8777bd62..f01ec890282 100644 --- a/src/cargo/core/workspace.rs +++ b/src/cargo/core/workspace.rs @@ -103,6 +103,9 @@ pub struct Workspace<'gctx> { // file. This is set for `cargo install` without `--locked`. ignore_lock: bool, + // Requested path of the lockfile (i.e. passed as the cli flag) + requested_lockfile_path: Option, + /// The resolver behavior specified with the `resolver` field. resolve_behavior: ResolveBehavior, resolve_honors_rust_version: bool, @@ -237,6 +240,7 @@ impl<'gctx> Workspace<'gctx> { require_optional_deps: true, loaded_packages: RefCell::new(HashMap::new()), ignore_lock: false, + requested_lockfile_path: None, resolve_behavior: ResolveBehavior::V1, resolve_honors_rust_version: false, custom_metadata: None, @@ -647,6 +651,14 @@ impl<'gctx> Workspace<'gctx> { self } + pub fn requested_lockfile_path(&self) -> Option<&PathBuf> { + self.requested_lockfile_path.as_ref() + } + + pub fn set_requested_lockfile_path(&mut self, path: Option) { + self.requested_lockfile_path = path; + } + /// Get the lowest-common denominator `package.rust-version` within the workspace, if specified /// anywhere pub fn rust_version(&self) -> Option<&RustVersion> { diff --git a/src/cargo/ops/lockfile.rs b/src/cargo/ops/lockfile.rs index 162cb6031bd..d9c4c5ee097 100644 --- a/src/cargo/ops/lockfile.rs +++ b/src/cargo/ops/lockfile.rs @@ -1,19 +1,20 @@ -use std::io::prelude::*; - use crate::core::{resolver, Resolve, ResolveVersion, Workspace}; use crate::util::errors::CargoResult; use crate::util::Filesystem; +use std::io::prelude::*; use anyhow::Context as _; +pub const LOCKFILE_NAME: &str = "Cargo.lock"; + #[tracing::instrument(skip_all)] pub fn load_pkg_lockfile(ws: &Workspace<'_>) -> CargoResult> { let lock_root = lock_root(ws); - if !lock_root.as_path_unlocked().join("Cargo.lock").exists() { + if !lock_root.as_path_unlocked().join(LOCKFILE_NAME).exists() { return Ok(None); } - let mut f = lock_root.open_ro_shared("Cargo.lock", ws.gctx(), "Cargo.lock file")?; + let mut f = lock_root.open_ro_shared(LOCKFILE_NAME, ws.gctx(), "Cargo.lock file")?; let mut s = String::new(); f.read_to_string(&mut s) @@ -58,7 +59,7 @@ pub fn write_pkg_lockfile(ws: &Workspace<'_>, resolve: &mut Resolve) -> CargoRes "the lock file {} needs to be updated but {} was passed to prevent this\n\ If you want to try to generate the lock file without accessing the network, \ remove the {} flag and use --offline instead.", - lock_root.as_path_unlocked().join("Cargo.lock").display(), + lock_root.as_path_unlocked().join(LOCKFILE_NAME).display(), flag, flag ); @@ -84,7 +85,7 @@ pub fn write_pkg_lockfile(ws: &Workspace<'_>, resolve: &mut Resolve) -> CargoRes // Ok, if that didn't work just write it out lock_root - .open_rw_exclusive_create("Cargo.lock", ws.gctx(), "Cargo.lock file") + .open_rw_exclusive_create(LOCKFILE_NAME, ws.gctx(), "Cargo.lock file") .and_then(|mut f| { f.file().set_len(0)?; f.write_all(out.as_bytes())?; @@ -93,7 +94,7 @@ pub fn write_pkg_lockfile(ws: &Workspace<'_>, resolve: &mut Resolve) -> CargoRes .with_context(|| { format!( "failed to write {}", - lock_root.as_path_unlocked().join("Cargo.lock").display() + lock_root.as_path_unlocked().join(LOCKFILE_NAME).display() ) })?; Ok(true) @@ -105,7 +106,7 @@ fn resolve_to_string_orig( ) -> (Option, String, Filesystem) { // Load the original lock file if it exists. let lock_root = lock_root(ws); - let orig = lock_root.open_ro_shared("Cargo.lock", ws.gctx(), "Cargo.lock file"); + let orig = lock_root.open_ro_shared(LOCKFILE_NAME, ws.gctx(), "Cargo.lock file"); let orig = orig.and_then(|mut f| { let mut s = String::new(); f.read_to_string(&mut s)?; @@ -247,6 +248,14 @@ fn emit_package(dep: &toml::Table, out: &mut String) { } fn lock_root(ws: &Workspace<'_>) -> Filesystem { + if let Some(requested) = ws.requested_lockfile_path() { + return Filesystem::new( + requested + .parent() + .unwrap_or_else(|| unreachable!("Lockfile path can't be root")) + .to_owned(), + ); + } if ws.root_maybe().is_embedded() { ws.target_dir() } else { diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index 96fe3e8f106..8c42f53a88b 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -1,6 +1,7 @@ use crate::core::compiler::{BuildConfig, MessageFormat, TimingOutput}; use crate::core::resolver::CliFeatures; use crate::core::{Edition, Workspace}; +use crate::ops::lockfile::LOCKFILE_NAME; use crate::ops::registry::RegistryOrIndex; use crate::ops::{CompileFilter, CompileOptions, NewOptions, Packages, VersionControl}; use crate::util::important_paths::find_root_manifest_for_wd; @@ -12,13 +13,14 @@ use crate::util::{ print_available_packages, print_available_tests, }; use crate::CargoResult; -use anyhow::bail; +use anyhow::{bail, Context}; use cargo_util::paths; use cargo_util_schemas::manifest::ProfileName; use cargo_util_schemas::manifest::RegistryName; use cargo_util_schemas::manifest::StringOrVec; use clap::builder::UnknownArgumentValueParser; use std::ffi::{OsStr, OsString}; +use std::fs; use std::path::Path; use std::path::PathBuf; @@ -295,6 +297,15 @@ pub trait CommandExt: Sized { ) } + fn arg_lockfile_path(self) -> Self { + self._arg( + opt("lockfile-path", "Path to the Cargo.lock file (unstable)") + .value_name("FILE") + // TODO: seemed to be the best option, but maybe should be something else? + .help_heading(heading::MANIFEST_OPTIONS), + ) + } + fn arg_message_format(self) -> Self { self._arg(multi_opt("message-format", "FMT", "Error format")) } @@ -517,14 +528,20 @@ pub trait ArgMatchesExt { root_manifest(self._value_of("manifest-path").map(Path::new), gctx) } + fn lockfile_path(&self, gctx: &GlobalContext) -> CargoResult> { + lockfile_path(self._value_of("lockfile-path").map(Path::new), gctx) + } + #[tracing::instrument(skip_all)] fn workspace<'a>(&self, gctx: &'a GlobalContext) -> CargoResult> { let root = self.root_manifest(gctx)?; + let lockfile_path = self.lockfile_path(gctx)?; let mut ws = Workspace::new(&root, gctx)?; ws.set_resolve_honors_rust_version(self.honor_rust_version()); if gctx.cli_unstable().avoid_dev_deps { ws.set_require_optional_deps(false); } + ws.set_requested_lockfile_path(lockfile_path); Ok(ws) } @@ -986,6 +1003,64 @@ pub fn root_manifest(manifest_path: Option<&Path>, gctx: &GlobalContext) -> Carg } } +pub fn lockfile_path( + lockfile_path: Option<&Path>, + gctx: &GlobalContext, +) -> CargoResult> { + let path; + + if let Some(lockfile_path) = lockfile_path { + if !gctx.cli_unstable().unstable_options { + bail!("`--lockfile-path` option requires `-Zunstable-options`") + } + + if lockfile_path.is_absolute() { + path = lockfile_path.to_path_buf(); + } else { + path = gctx.cwd().join(lockfile_path); + } + + if !path.ends_with(LOCKFILE_NAME) && !crate::util::toml::is_embedded(&path) { + bail!( + "the lockfile-path must be a path to a {} file", + LOCKFILE_NAME + ) + } + if path.is_dir() { + bail!( + "lockfile path `{}` is a directory but expected a file", + lockfile_path.display() + ) + } + if !path.exists() { + // Root case should already be covered above + let parent_path = lockfile_path + .parent() + .unwrap_or_else(|| unreachable!("Lockfile path can't be root")); + + let exists = parent_path.try_exists().with_context(|| { + format!( + "Failed to fetch lock file's parent path metadata {}", + parent_path.display() + ) + })?; + + if !exists { + fs::create_dir_all(parent_path).with_context(|| { + format!( + "Failed to create lockfile-path parent directory {}", + parent_path.display() + ) + })? + } + } + + return Ok(Some(path)); + } + + Ok(None) +} + #[track_caller] pub fn ignore_unknown(r: Result) -> T { match r { diff --git a/tests/testsuite/lockfile_path.rs b/tests/testsuite/lockfile_path.rs new file mode 100644 index 00000000000..6b59732f96d --- /dev/null +++ b/tests/testsuite/lockfile_path.rs @@ -0,0 +1,240 @@ +//! Tests for `lockfile-path` flag + +use cargo_test_support::paths::CargoPathExt; +use cargo_test_support::{ + basic_bin_manifest, cargo_test, project, symlink_supported, Project, ProjectBuilder, +}; +use snapbox::str; +use std::fs; + +fn basic_project() -> ProjectBuilder { + return project() + .file("Cargo.toml", &basic_bin_manifest("test_foo")) + .file("src/main.rs", "fn main() {}"); +} + +fn run_basic_command(p: &Project, command: &str, lockfile_path_argument: &str) { + p.cargo(command) + .masquerade_as_nightly_cargo(&["unstable-options"]) + .arg("-Zunstable-options") + .arg("--lockfile-path") + .arg(lockfile_path_argument) + .run(); +} + +#[track_caller] +fn assert_lockfile_created(command: &str) { + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = basic_project().build(); + + for _ in 1..=2 { + run_basic_command(&p, command, lockfile_path_argument); + assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(!p.root().join("Cargo.lock").is_file()); + } + + p.root() + .join(lockfile_path_argument) + .parent() + .unwrap() + .rm_rf(); + + run_basic_command(&p, command, lockfile_path_argument); + assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(!p.root().join("Cargo.lock").is_file()); +} + +fn assert_embed(command: &str) { + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let embed = r#"#!/usr/bin/env cargo + +//! ```cargo +//! [dependencies] +//! clap = { version = "4.2", features = ["derive"] } +//! ``` + +use clap::Parser; + +#[derive(Parser, Debug)] +#[clap(version)] +struct Args { + #[clap(short, long, help = "Path to config")] + config: Option, +} + +fn main() { + let args = Args::parse(); + println!("{:?}", args); +}"#; + let p = project() + .file("src/main.rs", &embed) + .build(); + + p.cargo(command) + .masquerade_as_nightly_cargo(&["unstable-options"]) + .arg("-Zunstable-options") + .arg("--lockfile-path") + .arg(lockfile_path_argument) + .arg("--manifest-path") + .arg("src/main.rs") + .arg("-Zscript") + .run(); + + assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(!p.root().join("Cargo.lock").is_file()); +} + +fn assert_lockfile_override(command: &str) { + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = basic_project() + .file("Cargo.lock", "This is an invalid lock file!") + .build(); + + run_basic_command(&p, command, lockfile_path_argument); + + assert!(p.root().join(lockfile_path_argument).is_file()); +} + +fn assert_symlink_in_path(command: &str) { + if !symlink_supported() { + return; + } + + let dst = "dst"; + let src = "somedir/link"; + let lockfile_path_argument = format!("{src}/Cargo.lock"); + + let p = basic_project().symlink_dir(dst, src).build(); + + fs::create_dir(p.root().join("dst")) + .unwrap_or_else(|e| panic!("could not create directory {}", e)); + assert!(p.root().join(src).is_dir()); + + run_basic_command(&p, command, lockfile_path_argument.as_str()); + + assert!(p.root().join(format!("{src}/Cargo.lock")).is_file()); + assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(p.root().join(dst).join("Cargo.lock").is_file()); +} + +fn assert_symlink_lockfile(command: &str) { + if !symlink_supported() { + return; + } + + let lockfile_path_argument = "dst/Cargo.lock"; + let src = "somedir/link"; + let lock_body = r#"# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "test_foo" +version = "0.5.0" +"#; + + let p = basic_project() + .file(lockfile_path_argument, lock_body) + .symlink(lockfile_path_argument, src) + .build(); + + assert!(p.root().join(src).is_file()); + + run_basic_command(&p, command, lockfile_path_argument); + + assert!(!p.root().join("Cargo.lock").is_file()); +} + +fn assert_broken_symlink(command: &str) { + if !symlink_supported() { + return; + } + + let invalid_dst = "invalid_path"; + let src = "somedir/link"; + let lockfile_path_argument = format!("{src}/Cargo.lock"); + + let p = basic_project().symlink_dir(invalid_dst, src).build(); + assert!(!p.root().join(src).is_dir()); + + p.cargo(command) + .masquerade_as_nightly_cargo(&["unstable-options"]) + .arg("-Zunstable-options") + .arg("--lockfile-path") + .arg(lockfile_path_argument) + .with_status(101) + .with_stderr_data(str![[r#" +[ERROR] Failed to create lockfile-path parent directory somedir/link + +Caused by: + File exists (os error 17) + +"#]]) + .run(); +} + +fn assert_loop_symlink(command: &str) { + if !symlink_supported() { + return; + } + + let loop_link = "loop"; + let src = "somedir/link"; + let lockfile_path_argument = format!("{src}/Cargo.lock"); + + let p = basic_project() + .symlink_dir(loop_link, src) + .symlink_dir(src, loop_link) + .build(); + assert!(!p.root().join(src).is_dir()); + + p.cargo(command) + .masquerade_as_nightly_cargo(&["unstable-options"]) + .arg("-Zunstable-options") + .arg("--lockfile-path") + .arg(lockfile_path_argument) + .with_status(101) + .with_stderr_data(str![[r#" +[ERROR] Failed to fetch lock file's parent path metadata somedir/link + +Caused by: + Too many levels of symbolic links (os error 40) + +"#]]) + .run(); +} + +#[cargo_test(nightly, reason = "--lockfile-path is unstable")] +fn metadata_lockfile_created() { + assert_lockfile_created("metadata"); +} + +#[cargo_test(nightly, reason = "--lockfile-path is unstable")] +fn metadata_embed() { + assert_embed("metadata"); +} + +#[cargo_test(nightly, reason = "--lockfile-path is unstable")] +fn metadata_lockfile_override() { + assert_lockfile_override("metadata"); +} + +#[cargo_test(nightly, reason = "--lockfile-path is unstable")] +fn metadata_symlink_in_path() { + assert_symlink_in_path("metadata"); +} + +#[cargo_test(nightly, reason = "--lockfile-path is unstable")] +fn metadata_symlink_lockfile() { + assert_symlink_lockfile("metadata"); +} + +#[cargo_test(nightly, reason = "--lockfile-path is unstable")] +fn metadata_broken_symlink() { + assert_broken_symlink("metadata"); +} + +#[cargo_test(nightly, reason = "--lockfile-path is unstable")] +fn metadata_loop_symlink() { + assert_loop_symlink("metadata"); +} diff --git a/tests/testsuite/main.rs b/tests/testsuite/main.rs index 271d333e2ef..219c37fecef 100644 --- a/tests/testsuite/main.rs +++ b/tests/testsuite/main.rs @@ -111,6 +111,7 @@ mod list_availables; mod local_registry; mod locate_project; mod lockfile_compat; +mod lockfile_path; mod login; mod logout; mod lto; From 1abaa880129411d57ea978fdec9c8ea9ad38ed08 Mon Sep 17 00:00:00 2001 From: Ifropc Date: Fri, 19 Jul 2024 08:05:48 -0700 Subject: [PATCH 02/12] feat: add lockfile-path flag for all requested commands - All commands that support `manifest-path` (except `locate-project`, `verify-project` and `read-manifest`) --- src/bin/cargo/commands/add.rs | 1 + src/bin/cargo/commands/bench.rs | 1 + src/bin/cargo/commands/build.rs | 1 + src/bin/cargo/commands/check.rs | 1 + src/bin/cargo/commands/clean.rs | 1 + src/bin/cargo/commands/doc.rs | 1 + src/bin/cargo/commands/fetch.rs | 1 + src/bin/cargo/commands/fix.rs | 5 +- src/bin/cargo/commands/generate_lockfile.rs | 1 + src/bin/cargo/commands/package.rs | 1 + src/bin/cargo/commands/pkgid.rs | 1 + src/bin/cargo/commands/publish.rs | 1 + src/bin/cargo/commands/remove.rs | 1 + src/bin/cargo/commands/run.rs | 1 + src/bin/cargo/commands/rustc.rs | 1 + src/bin/cargo/commands/rustdoc.rs | 1 + src/bin/cargo/commands/test.rs | 1 + src/bin/cargo/commands/tree.rs | 1 + src/bin/cargo/commands/update.rs | 1 + src/bin/cargo/commands/vendor.rs | 1 + src/cargo/ops/cargo_package.rs | 7 +- src/cargo/ops/fix.rs | 3 + tests/testsuite/lockfile_path.rs | 321 +++++++++++++------- 23 files changed, 243 insertions(+), 112 deletions(-) diff --git a/src/bin/cargo/commands/add.rs b/src/bin/cargo/commands/add.rs index 30956b00479..da821f328bd 100644 --- a/src/bin/cargo/commands/add.rs +++ b/src/bin/cargo/commands/add.rs @@ -87,6 +87,7 @@ Example uses: - Depend on crates with the same name from different registries"), ]) .arg_manifest_path_without_unsupported_path_tip() + .arg_lockfile_path() .arg_package("Package to modify") .arg_ignore_rust_version() .arg_dry_run("Don't actually write the manifest") diff --git a/src/bin/cargo/commands/bench.rs b/src/bin/cargo/commands/bench.rs index c79d7cb350d..1f4c8df80ea 100644 --- a/src/bin/cargo/commands/bench.rs +++ b/src/bin/cargo/commands/bench.rs @@ -50,6 +50,7 @@ pub fn cli() -> Command { .arg_unit_graph() .arg_timings() .arg_manifest_path() + .arg_lockfile_path() .arg_ignore_rust_version() .after_help(color_print::cstr!( "Run `cargo help bench` for more detailed information.\n" diff --git a/src/bin/cargo/commands/build.rs b/src/bin/cargo/commands/build.rs index 26f7af31609..86d477ccac2 100644 --- a/src/bin/cargo/commands/build.rs +++ b/src/bin/cargo/commands/build.rs @@ -39,6 +39,7 @@ pub fn cli() -> Command { .arg_unit_graph() .arg_timings() .arg_manifest_path() + .arg_lockfile_path() .arg_ignore_rust_version() .after_help(color_print::cstr!( "Run `cargo help build` for more detailed information.\n" diff --git a/src/bin/cargo/commands/check.rs b/src/bin/cargo/commands/check.rs index 56f274effba..66f378c3e90 100644 --- a/src/bin/cargo/commands/check.rs +++ b/src/bin/cargo/commands/check.rs @@ -36,6 +36,7 @@ pub fn cli() -> Command { .arg_unit_graph() .arg_timings() .arg_manifest_path() + .arg_lockfile_path() .arg_ignore_rust_version() .after_help(color_print::cstr!( "Run `cargo help check` for more detailed information.\n" diff --git a/src/bin/cargo/commands/clean.rs b/src/bin/cargo/commands/clean.rs index 1764c0bca1c..d9414b4d17d 100644 --- a/src/bin/cargo/commands/clean.rs +++ b/src/bin/cargo/commands/clean.rs @@ -19,6 +19,7 @@ pub fn cli() -> Command { .arg_target_triple("Target triple to clean output for") .arg_target_dir() .arg_manifest_path() + .arg_lockfile_path() .arg_dry_run("Display what would be deleted without deleting anything") .args_conflicts_with_subcommands(true) .subcommand( diff --git a/src/bin/cargo/commands/doc.rs b/src/bin/cargo/commands/doc.rs index 2603b3cb777..6707364d946 100644 --- a/src/bin/cargo/commands/doc.rs +++ b/src/bin/cargo/commands/doc.rs @@ -39,6 +39,7 @@ pub fn cli() -> Command { .arg_unit_graph() .arg_timings() .arg_manifest_path() + .arg_lockfile_path() .arg_ignore_rust_version() .after_help(color_print::cstr!( "Run `cargo help doc` for more detailed information.\n" diff --git a/src/bin/cargo/commands/fetch.rs b/src/bin/cargo/commands/fetch.rs index f60ed61b854..2fdba80baf8 100644 --- a/src/bin/cargo/commands/fetch.rs +++ b/src/bin/cargo/commands/fetch.rs @@ -9,6 +9,7 @@ pub fn cli() -> Command { .arg_silent_suggestion() .arg_target_triple("Fetch dependencies for the target triple") .arg_manifest_path() + .arg_lockfile_path() .after_help(color_print::cstr!( "Run `cargo help fetch` for more detailed information.\n" )) diff --git a/src/bin/cargo/commands/fix.rs b/src/bin/cargo/commands/fix.rs index 8190cf07e95..ae00635caa4 100644 --- a/src/bin/cargo/commands/fix.rs +++ b/src/bin/cargo/commands/fix.rs @@ -1,6 +1,5 @@ use crate::command_prelude::*; -use cargo::core::Workspace; use cargo::ops; pub fn cli() -> Command { @@ -54,6 +53,7 @@ pub fn cli() -> Command { .arg_target_dir() .arg_timings() .arg_manifest_path() + .arg_lockfile_path() .arg_ignore_rust_version() .after_help(color_print::cstr!( "Run `cargo help fix` for more detailed information.\n" @@ -71,8 +71,7 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult { // Unlike other commands default `cargo fix` to all targets to fix as much // code as we can. let root_manifest = args.root_manifest(gctx)?; - let mut ws = Workspace::new(&root_manifest, gctx)?; - ws.set_resolve_honors_rust_version(args.honor_rust_version()); + let ws = args.workspace(gctx)?; let mut opts = args.compile_options(gctx, mode, Some(&ws), ProfileChecking::LegacyTestOnly)?; if !opts.filter.is_specific() { diff --git a/src/bin/cargo/commands/generate_lockfile.rs b/src/bin/cargo/commands/generate_lockfile.rs index a2ddac61dd9..3ad858daaa7 100644 --- a/src/bin/cargo/commands/generate_lockfile.rs +++ b/src/bin/cargo/commands/generate_lockfile.rs @@ -7,6 +7,7 @@ pub fn cli() -> Command { .about("Generate the lockfile for a package") .arg_silent_suggestion() .arg_manifest_path() + .arg_lockfile_path() .arg_ignore_rust_version_with_help( "Ignore `rust-version` specification in packages (unstable)", ) diff --git a/src/bin/cargo/commands/package.rs b/src/bin/cargo/commands/package.rs index 42b3ac3d03d..251fa286ec5 100644 --- a/src/bin/cargo/commands/package.rs +++ b/src/bin/cargo/commands/package.rs @@ -37,6 +37,7 @@ pub fn cli() -> Command { .arg_target_dir() .arg_parallel() .arg_manifest_path() + .arg_lockfile_path() .after_help(color_print::cstr!( "Run `cargo help package` for more detailed information.\n" )) diff --git a/src/bin/cargo/commands/pkgid.rs b/src/bin/cargo/commands/pkgid.rs index 72abbfc0788..5fcf85b8fd9 100644 --- a/src/bin/cargo/commands/pkgid.rs +++ b/src/bin/cargo/commands/pkgid.rs @@ -10,6 +10,7 @@ pub fn cli() -> Command { .arg_silent_suggestion() .arg_package("Argument to get the package ID specifier for") .arg_manifest_path() + .arg_lockfile_path() .after_help(color_print::cstr!( "Run `cargo help pkgid` for more detailed information.\n" )) diff --git a/src/bin/cargo/commands/publish.rs b/src/bin/cargo/commands/publish.rs index 3b497e1ed12..df1c4654ffe 100644 --- a/src/bin/cargo/commands/publish.rs +++ b/src/bin/cargo/commands/publish.rs @@ -24,6 +24,7 @@ pub fn cli() -> Command { .arg_target_triple("Build for the target triple") .arg_target_dir() .arg_manifest_path() + .arg_lockfile_path() .after_help(color_print::cstr!( "Run `cargo help publish` for more detailed information.\n" )) diff --git a/src/bin/cargo/commands/remove.rs b/src/bin/cargo/commands/remove.rs index b5695e59937..e74f53d6442 100644 --- a/src/bin/cargo/commands/remove.rs +++ b/src/bin/cargo/commands/remove.rs @@ -51,6 +51,7 @@ pub fn cli() -> clap::Command { ]) .arg_package("Package to remove from") .arg_manifest_path() + .arg_lockfile_path() .after_help(color_print::cstr!( "Run `cargo help remove` for more detailed information.\n" )) diff --git a/src/bin/cargo/commands/run.rs b/src/bin/cargo/commands/run.rs index 74eb1450bd0..c9e59770a28 100644 --- a/src/bin/cargo/commands/run.rs +++ b/src/bin/cargo/commands/run.rs @@ -38,6 +38,7 @@ pub fn cli() -> Command { .arg_target_triple("Build for the target triple") .arg_target_dir() .arg_manifest_path() + .arg_lockfile_path() .arg_ignore_rust_version() .arg_unit_graph() .arg_timings() diff --git a/src/bin/cargo/commands/rustc.rs b/src/bin/cargo/commands/rustc.rs index 2f52c6b5926..999f8d64c39 100644 --- a/src/bin/cargo/commands/rustc.rs +++ b/src/bin/cargo/commands/rustc.rs @@ -52,6 +52,7 @@ pub fn cli() -> Command { .arg_unit_graph() .arg_timings() .arg_manifest_path() + .arg_lockfile_path() .arg_ignore_rust_version() .after_help(color_print::cstr!( "Run `cargo help rustc` for more detailed information.\n" diff --git a/src/bin/cargo/commands/rustdoc.rs b/src/bin/cargo/commands/rustdoc.rs index 6535ca405c6..f9c290bf5a0 100644 --- a/src/bin/cargo/commands/rustdoc.rs +++ b/src/bin/cargo/commands/rustdoc.rs @@ -45,6 +45,7 @@ pub fn cli() -> Command { .arg_unit_graph() .arg_timings() .arg_manifest_path() + .arg_lockfile_path() .arg_ignore_rust_version() .after_help(color_print::cstr!( "Run `cargo help rustdoc` for more detailed information.\n" diff --git a/src/bin/cargo/commands/test.rs b/src/bin/cargo/commands/test.rs index c2657a78f05..73c3505100c 100644 --- a/src/bin/cargo/commands/test.rs +++ b/src/bin/cargo/commands/test.rs @@ -60,6 +60,7 @@ pub fn cli() -> Command { .arg_unit_graph() .arg_timings() .arg_manifest_path() + .arg_lockfile_path() .arg_ignore_rust_version() .after_help(color_print::cstr!( "Run `cargo help test` for more detailed information.\n\ diff --git a/src/bin/cargo/commands/tree.rs b/src/bin/cargo/commands/tree.rs index 6d83f8e8e95..b0f35370ebc 100644 --- a/src/bin/cargo/commands/tree.rs +++ b/src/bin/cargo/commands/tree.rs @@ -95,6 +95,7 @@ pub fn cli() -> Command { Pass `all` to include all targets.", ) .arg_manifest_path() + .arg_lockfile_path() .after_help(color_print::cstr!( "Run `cargo help tree` for more detailed information.\n" )) diff --git a/src/bin/cargo/commands/update.rs b/src/bin/cargo/commands/update.rs index 492be07c783..4c19bcb270d 100644 --- a/src/bin/cargo/commands/update.rs +++ b/src/bin/cargo/commands/update.rs @@ -49,6 +49,7 @@ pub fn cli() -> Command { .help_heading(heading::PACKAGE_SELECTION), ) .arg_manifest_path() + .arg_lockfile_path() .arg_ignore_rust_version_with_help( "Ignore `rust-version` specification in packages (unstable)", ) diff --git a/src/bin/cargo/commands/vendor.rs b/src/bin/cargo/commands/vendor.rs index efa1f1bb7b6..96b30676732 100644 --- a/src/bin/cargo/commands/vendor.rs +++ b/src/bin/cargo/commands/vendor.rs @@ -37,6 +37,7 @@ pub fn cli() -> Command { .arg(unsupported("only-git-deps")) .arg(unsupported("disallow-duplicates")) .arg_manifest_path() + .arg_lockfile_path() .after_help(color_print::cstr!( "Run `cargo help vendor` for more detailed information.\n" )) diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index 459e780f32f..cb14dabefa4 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -248,7 +248,12 @@ pub fn package(ws: &Workspace<'_>, opts: &PackageOpts<'_>) -> CargoResult ProjectBuilder { +const VALID_LOCKFILE: &str = r#"# Test lockfile +version = 3 + +[[package]] +name = "test_foo" +version = "0.5.0" +"#; + +const LIB_TOML: &str = r#" + [package] + name = "test_bar" + version = "0.1.0" + edition = "2021" + "#; + +fn make_basic_project() -> ProjectBuilder { return project() .file("Cargo.toml", &basic_bin_manifest("test_foo")) .file("src/main.rs", "fn main() {}"); } -fn run_basic_command(p: &Project, command: &str, lockfile_path_argument: &str) { - p.cargo(command) +fn make_basic_command(execs: &mut Execs, lockfile_path_argument: String) -> &mut Execs { + return execs .masquerade_as_nightly_cargo(&["unstable-options"]) .arg("-Zunstable-options") .arg("--lockfile-path") - .arg(lockfile_path_argument) - .run(); + .arg(lockfile_path_argument); } -#[track_caller] -fn assert_lockfile_created(command: &str) { - let lockfile_path_argument = "mylockfile/Cargo.lock"; - let p = basic_project().build(); +fn lockfile_must_exist(command: &str) -> bool { + return command == "pkgid" || command == "publish"; +} - for _ in 1..=2 { - run_basic_command(&p, command, lockfile_path_argument); - assert!(p.root().join(lockfile_path_argument).is_file()); - assert!(!p.root().join("Cargo.lock").is_file()); +fn assert_lockfile_created( + command: &str, + make_execs: impl Fn(&mut Execs, String) -> &mut Execs, + make_project: impl FnOnce() -> ProjectBuilder, +) { + if lockfile_must_exist(command) { + return; } - p.root() - .join(lockfile_path_argument) - .parent() - .unwrap() - .rm_rf(); + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = make_project().build(); + let registry = RegistryBuilder::new().http_api().http_index().build(); - run_basic_command(&p, command, lockfile_path_argument); - assert!(p.root().join(lockfile_path_argument).is_file()); + make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) + .replace_crates_io(registry.index_url()) + .run(); assert!(!p.root().join("Cargo.lock").is_file()); + assert!(p.root().join(lockfile_path_argument).is_file()); } -fn assert_embed(command: &str) { +fn assert_lockfile_read( + command: &str, + make_execs: impl Fn(&mut Execs, String) -> &mut Execs, + make_project: impl FnOnce() -> ProjectBuilder, +) { let lockfile_path_argument = "mylockfile/Cargo.lock"; - let embed = r#"#!/usr/bin/env cargo - -//! ```cargo -//! [dependencies] -//! clap = { version = "4.2", features = ["derive"] } -//! ``` - -use clap::Parser; - -#[derive(Parser, Debug)] -#[clap(version)] -struct Args { - #[clap(short, long, help = "Path to config")] - config: Option, -} - -fn main() { - let args = Args::parse(); - println!("{:?}", args); -}"#; - let p = project() - .file("src/main.rs", &embed) + let p = make_project() + .file("mylockfile/Cargo.lock", VALID_LOCKFILE) .build(); + let registry = RegistryBuilder::new().http_api().http_index().build(); - p.cargo(command) - .masquerade_as_nightly_cargo(&["unstable-options"]) - .arg("-Zunstable-options") - .arg("--lockfile-path") - .arg(lockfile_path_argument) - .arg("--manifest-path") - .arg("src/main.rs") - .arg("-Zscript") + make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) + .replace_crates_io(registry.index_url()) .run(); - assert!(p.root().join(lockfile_path_argument).is_file()); assert!(!p.root().join("Cargo.lock").is_file()); + assert!(p.root().join(lockfile_path_argument).is_file()); } -fn assert_lockfile_override(command: &str) { +fn assert_lockfile_override( + command: &str, + make_execs: impl Fn(&mut Execs, String) -> &mut Execs, + make_project: impl FnOnce() -> ProjectBuilder, +) { + if lockfile_must_exist(command) { + return; + } + let lockfile_path_argument = "mylockfile/Cargo.lock"; - let p = basic_project() + let p = make_project() .file("Cargo.lock", "This is an invalid lock file!") .build(); + let registry = RegistryBuilder::new().http_api().http_index().build(); - run_basic_command(&p, command, lockfile_path_argument); + make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) + .replace_crates_io(registry.index_url()) + .run(); assert!(p.root().join(lockfile_path_argument).is_file()); } -fn assert_symlink_in_path(command: &str) { - if !symlink_supported() { +fn assert_symlink_in_path( + command: &str, + make_execs: impl Fn(&mut Execs, String) -> &mut Execs, + make_project: impl FnOnce() -> ProjectBuilder, +) { + if !symlink_supported() || lockfile_must_exist(command) { return; } @@ -104,48 +118,55 @@ fn assert_symlink_in_path(command: &str) { let src = "somedir/link"; let lockfile_path_argument = format!("{src}/Cargo.lock"); - let p = basic_project().symlink_dir(dst, src).build(); + let p = make_project().symlink_dir(dst, src).build(); + let registry = RegistryBuilder::new().http_api().http_index().build(); fs::create_dir(p.root().join("dst")) .unwrap_or_else(|e| panic!("could not create directory {}", e)); assert!(p.root().join(src).is_dir()); - run_basic_command(&p, command, lockfile_path_argument.as_str()); + make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) + .replace_crates_io(registry.index_url()) + .run(); assert!(p.root().join(format!("{src}/Cargo.lock")).is_file()); assert!(p.root().join(lockfile_path_argument).is_file()); assert!(p.root().join(dst).join("Cargo.lock").is_file()); } -fn assert_symlink_lockfile(command: &str) { +fn assert_symlink_lockfile( + command: &str, + make_execs: impl Fn(&mut Execs, String) -> &mut Execs, + make_project: impl FnOnce() -> ProjectBuilder, +) { if !symlink_supported() { return; } let lockfile_path_argument = "dst/Cargo.lock"; let src = "somedir/link"; - let lock_body = r#"# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 + let lock_body = VALID_LOCKFILE; -[[package]] -name = "test_foo" -version = "0.5.0" -"#; - - let p = basic_project() + let p = make_project() .file(lockfile_path_argument, lock_body) .symlink(lockfile_path_argument, src) .build(); + let registry = RegistryBuilder::new().http_api().http_index().build(); assert!(p.root().join(src).is_file()); - run_basic_command(&p, command, lockfile_path_argument); + make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) + .replace_crates_io(registry.index_url()) + .run(); assert!(!p.root().join("Cargo.lock").is_file()); } -fn assert_broken_symlink(command: &str) { +fn assert_broken_symlink( + command: &str, + make_execs: impl Fn(&mut Execs, String) -> &mut Execs, + make_project: impl FnOnce() -> ProjectBuilder, +) { if !symlink_supported() { return; } @@ -154,14 +175,11 @@ fn assert_broken_symlink(command: &str) { let src = "somedir/link"; let lockfile_path_argument = format!("{src}/Cargo.lock"); - let p = basic_project().symlink_dir(invalid_dst, src).build(); + let p = make_project().symlink_dir(invalid_dst, src).build(); assert!(!p.root().join(src).is_dir()); + let registry = RegistryBuilder::new().http_api().http_index().build(); - p.cargo(command) - .masquerade_as_nightly_cargo(&["unstable-options"]) - .arg("-Zunstable-options") - .arg("--lockfile-path") - .arg(lockfile_path_argument) + make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) .with_status(101) .with_stderr_data(str![[r#" [ERROR] Failed to create lockfile-path parent directory somedir/link @@ -170,10 +188,15 @@ Caused by: File exists (os error 17) "#]]) + .replace_crates_io(registry.index_url()) .run(); } -fn assert_loop_symlink(command: &str) { +fn assert_loop_symlink( + command: &str, + make_execs: impl Fn(&mut Execs, String) -> &mut Execs, + make_project: impl FnOnce() -> ProjectBuilder, +) { if !symlink_supported() { return; } @@ -182,17 +205,14 @@ fn assert_loop_symlink(command: &str) { let src = "somedir/link"; let lockfile_path_argument = format!("{src}/Cargo.lock"); - let p = basic_project() + let p = make_project() .symlink_dir(loop_link, src) .symlink_dir(src, loop_link) .build(); assert!(!p.root().join(src).is_dir()); + let registry = RegistryBuilder::new().http_api().http_index().build(); - p.cargo(command) - .masquerade_as_nightly_cargo(&["unstable-options"]) - .arg("-Zunstable-options") - .arg("--lockfile-path") - .arg(lockfile_path_argument) + make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) .with_status(101) .with_stderr_data(str![[r#" [ERROR] Failed to fetch lock file's parent path metadata somedir/link @@ -201,40 +221,125 @@ Caused by: Too many levels of symbolic links (os error 40) "#]]) + .replace_crates_io(registry.index_url()) .run(); } -#[cargo_test(nightly, reason = "--lockfile-path is unstable")] -fn metadata_lockfile_created() { - assert_lockfile_created("metadata"); +///////////////////// +//// Generic tests +///////////////////// + +macro_rules! tests { + ($name: ident, $cmd_name:expr, $make_command:expr, $setup_test:expr) => { + #[cfg(test)] + mod $name { + use super::*; + + #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + fn test_lockfile_created() { + assert_lockfile_created($cmd_name, $make_command, $setup_test); + } + + #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + fn test_lockfile_read() { + assert_lockfile_read($cmd_name, $make_command, $setup_test); + } + + #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + fn test_lockfile_override() { + assert_lockfile_override($cmd_name, $make_command, $setup_test); + } + + #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + fn test_symlink_in_path() { + assert_symlink_in_path($cmd_name, $make_command, $setup_test); + } + + #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + fn test_symlink_lockfile() { + assert_symlink_lockfile($cmd_name, $make_command, $setup_test); + } + + #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + fn test_broken_symlink() { + assert_broken_symlink($cmd_name, $make_command, $setup_test); + } + + #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + fn test_loop_symlink() { + assert_loop_symlink($cmd_name, $make_command, $setup_test); + } + } + }; + + ($name: ident, $cmd_name:expr) => { + tests!($name, $cmd_name, make_basic_command, make_basic_project); + }; } -#[cargo_test(nightly, reason = "--lockfile-path is unstable")] -fn metadata_embed() { - assert_embed("metadata"); +fn make_add_command(execs: &mut Execs, lockfile_path_argument: String) -> &mut Execs { + return make_basic_command(execs, lockfile_path_argument) + .arg("--path") + .arg("../bar"); } -#[cargo_test(nightly, reason = "--lockfile-path is unstable")] -fn metadata_lockfile_override() { - assert_lockfile_override("metadata"); +fn make_add_project() -> ProjectBuilder { + return make_basic_project() + .file("../bar/Cargo.toml", LIB_TOML) + .file("../bar/src/main.rs", "fn main() {}"); } -#[cargo_test(nightly, reason = "--lockfile-path is unstable")] -fn metadata_symlink_in_path() { - assert_symlink_in_path("metadata"); +fn make_clean_command(execs: &mut Execs, lockfile_path_argument: String) -> &mut Execs { + return make_basic_command(execs, lockfile_path_argument) + .arg("--package") + .arg("test_foo"); } -#[cargo_test(nightly, reason = "--lockfile-path is unstable")] -fn metadata_symlink_lockfile() { - assert_symlink_lockfile("metadata"); +fn make_fix_command(execs: &mut Execs, lockfile_path_argument: String) -> &mut Execs { + return make_basic_command(execs, lockfile_path_argument) + .arg("--package") + .arg("test_foo") + .arg("--allow-no-vcs"); } -#[cargo_test(nightly, reason = "--lockfile-path is unstable")] -fn metadata_broken_symlink() { - assert_broken_symlink("metadata"); +fn make_remove_project() -> ProjectBuilder { + let mut manifest = basic_bin_manifest("test_foo"); + manifest.push_str( + r#"# +[dependencies] +test_bar = { version = "0.1.0", path = "../bar" } +"#, + ); + + return project() + .file("Cargo.toml", &manifest) + .file("src/main.rs", "fn main() {}") + .file("../bar/Cargo.toml", LIB_TOML) + .file("../bar/src/main.rs", "fn main() {}"); } -#[cargo_test(nightly, reason = "--lockfile-path is unstable")] -fn metadata_loop_symlink() { - assert_loop_symlink("metadata"); +fn make_remove_command(execs: &mut Execs, lockfile_path_argument: String) -> &mut Execs { + return make_basic_command(execs, lockfile_path_argument).arg("test_bar"); } + +tests!(add, "add", make_add_command, make_add_project); +tests!(bench, "bench"); +tests!(build, "build"); +tests!(check, "check"); +tests!(clean, "clean", make_clean_command, make_basic_project); +tests!(doc, "doc"); +tests!(fetch, "fetch"); +tests!(fix, "fix", make_fix_command, make_basic_project); +tests!(generate_lockfile, "generate-lockfile"); +tests!(metadata, "metadata"); +// tests!(package, "package"); // TODO: check why lockfile is not generated +tests!(pkgid, "pkgid"); +tests!(publish, "publish"); +tests!(remove, "remove", make_remove_command, make_remove_project); +tests!(run, "run"); +tests!(rustc, "rustc"); +tests!(rustdoc, "rustdoc"); +tests!(test, "test"); +tests!(tree, "tree"); +tests!(update, "update"); +tests!(vendor, "vendor"); From b05373de8125e47b5960db4ce3d4bbf83f270403 Mon Sep 17 00:00:00 2001 From: Ifropc Date: Mon, 29 Jul 2024 22:06:01 -0700 Subject: [PATCH 03/12] test: add extra test for package command --- tests/testsuite/lockfile_path.rs | 71 +++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 5 deletions(-) diff --git a/tests/testsuite/lockfile_path.rs b/tests/testsuite/lockfile_path.rs index 7f08c1b41ce..c52ce8f597a 100644 --- a/tests/testsuite/lockfile_path.rs +++ b/tests/testsuite/lockfile_path.rs @@ -4,11 +4,10 @@ use std::fs; use snapbox::str; -use cargo_test_support::paths::CargoPathExt; use cargo_test_support::registry::RegistryBuilder; use cargo_test_support::{ - basic_bin_manifest, basic_lib_manifest, cargo_test, paths, project, symlink_supported, Execs, - Project, ProjectBuilder, + basic_bin_manifest, cargo_test, project, symlink_supported, Execs, + ProjectBuilder, }; const VALID_LOCKFILE: &str = r#"# Test lockfile @@ -41,7 +40,7 @@ fn make_basic_command(execs: &mut Execs, lockfile_path_argument: String) -> &mut } fn lockfile_must_exist(command: &str) -> bool { - return command == "pkgid" || command == "publish"; + return command == "pkgid" || command == "publish" || command == "package"; } fn assert_lockfile_created( @@ -332,7 +331,7 @@ tests!(fetch, "fetch"); tests!(fix, "fix", make_fix_command, make_basic_project); tests!(generate_lockfile, "generate-lockfile"); tests!(metadata, "metadata"); -// tests!(package, "package"); // TODO: check why lockfile is not generated +tests!(package, "package"); tests!(pkgid, "pkgid"); tests!(publish, "publish"); tests!(remove, "remove", make_remove_command, make_remove_project); @@ -343,3 +342,65 @@ tests!(test, "test"); tests!(tree, "tree"); tests!(update, "update"); tests!(vendor, "vendor"); + +#[cfg(test)] +mod package_extra { + use std::fs; + use cargo_test_support::{cargo_test, project}; + use crate::lockfile_path::{make_basic_command}; + + #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + fn assert_respect_pinned_version_from_lockfile_path() { + const PINNED_VERSION: &str = r#"# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "hello" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b94f16c310ebbd9efcca5a5a17131d70bd454876f2af007f3da211afadff4fc" + +[[package]] +name = "test_foo" +version = "0.5.0" +dependencies = [ + "hello", +] +"#; + const TOML: &str = r#"# +[package] + +name = "test_foo" +version = "0.5.0" +authors = ["wycats@example.com"] +edition = "2015" + +[[bin]] + +name = "test_foo" + +[dependencies] +hello = "1.0.0" +"#; + + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = project() + .file("Cargo.toml", TOML) + .file("src/main.rs", "fn main() {}") + .file("mylockfile/Cargo.lock", PINNED_VERSION) + .build(); + + make_basic_command(&mut p.cargo("package"), lockfile_path_argument.to_string()).run(); + + assert!(!p.root().join("Cargo.lock").is_file()); + assert!(p.root().join(lockfile_path_argument).is_file()); + + assert!(p.root().join("target/package/test_foo-0.5.0/Cargo.lock").is_file()); + + let path = p.root().join("target/package/test_foo-0.5.0/Cargo.lock"); + let contents = fs::read_to_string(path).unwrap(); + + assert_eq!(contents, PINNED_VERSION); + } +} From c25dcf00df9834a068ed0e48b4d58530b4ef3eef Mon Sep 17 00:00:00 2001 From: Ifropc Date: Tue, 30 Jul 2024 21:20:17 -0700 Subject: [PATCH 04/12] doc: add docs for lockfile-path --- src/doc/man/cargo-add.md | 2 + src/doc/man/cargo-bench.md | 2 + src/doc/man/cargo-build.md | 2 + src/doc/man/cargo-check.md | 2 + src/doc/man/cargo-clean.md | 2 + src/doc/man/cargo-doc.md | 2 + src/doc/man/cargo-fetch.md | 2 + src/doc/man/cargo-fix.md | 2 + src/doc/man/cargo-generate-lockfile.md | 2 + src/doc/man/cargo-metadata.md | 2 + src/doc/man/cargo-package.md | 2 + src/doc/man/cargo-pkgid.md | 2 + src/doc/man/cargo-publish.md | 2 + src/doc/man/cargo-remove.md | 2 + src/doc/man/cargo-run.md | 2 + src/doc/man/cargo-rustc.md | 2 + src/doc/man/cargo-rustdoc.md | 2 + src/doc/man/cargo-test.md | 2 + src/doc/man/cargo-tree.md | 1 + src/doc/man/cargo-update.md | 2 + src/doc/man/cargo-vendor.md | 2 + src/doc/man/generated_txt/cargo-add.txt | 15 +++ src/doc/man/generated_txt/cargo-bench.txt | 15 +++ src/doc/man/generated_txt/cargo-build.txt | 15 +++ src/doc/man/generated_txt/cargo-check.txt | 15 +++ src/doc/man/generated_txt/cargo-clean.txt | 15 +++ src/doc/man/generated_txt/cargo-doc.txt | 15 +++ src/doc/man/generated_txt/cargo-fetch.txt | 15 +++ src/doc/man/generated_txt/cargo-fix.txt | 15 +++ .../generated_txt/cargo-generate-lockfile.txt | 15 +++ src/doc/man/generated_txt/cargo-metadata.txt | 15 +++ src/doc/man/generated_txt/cargo-package.txt | 15 +++ src/doc/man/generated_txt/cargo-pkgid.txt | 15 +++ src/doc/man/generated_txt/cargo-publish.txt | 15 +++ src/doc/man/generated_txt/cargo-remove.txt | 15 +++ src/doc/man/generated_txt/cargo-run.txt | 15 +++ src/doc/man/generated_txt/cargo-rustc.txt | 15 +++ src/doc/man/generated_txt/cargo-rustdoc.txt | 15 +++ src/doc/man/generated_txt/cargo-test.txt | 15 +++ src/doc/man/generated_txt/cargo-tree.txt | 15 +++ src/doc/man/generated_txt/cargo-update.txt | 15 +++ src/doc/man/generated_txt/cargo-vendor.txt | 15 +++ src/doc/man/includes/options-lockfile-path.md | 12 ++ src/doc/src/commands/cargo-add.md | 12 ++ src/doc/src/commands/cargo-bench.md | 12 ++ src/doc/src/commands/cargo-build.md | 12 ++ src/doc/src/commands/cargo-check.md | 12 ++ src/doc/src/commands/cargo-clean.md | 12 ++ src/doc/src/commands/cargo-doc.md | 12 ++ src/doc/src/commands/cargo-fetch.md | 12 ++ src/doc/src/commands/cargo-fix.md | 12 ++ .../src/commands/cargo-generate-lockfile.md | 12 ++ src/doc/src/commands/cargo-metadata.md | 12 ++ src/doc/src/commands/cargo-package.md | 12 ++ src/doc/src/commands/cargo-pkgid.md | 12 ++ src/doc/src/commands/cargo-publish.md | 12 ++ src/doc/src/commands/cargo-remove.md | 12 ++ src/doc/src/commands/cargo-run.md | 12 ++ src/doc/src/commands/cargo-rustc.md | 12 ++ src/doc/src/commands/cargo-rustdoc.md | 12 ++ src/doc/src/commands/cargo-test.md | 12 ++ src/doc/src/commands/cargo-tree.md | 11 ++ src/doc/src/commands/cargo-update.md | 12 ++ src/doc/src/commands/cargo-vendor.md | 12 ++ src/etc/man/cargo-add.1 | 14 +++ src/etc/man/cargo-bench.1 | 14 +++ src/etc/man/cargo-build.1 | 14 +++ src/etc/man/cargo-check.1 | 14 +++ src/etc/man/cargo-clean.1 | 14 +++ src/etc/man/cargo-doc.1 | 14 +++ src/etc/man/cargo-fetch.1 | 14 +++ src/etc/man/cargo-fix.1 | 14 +++ src/etc/man/cargo-generate-lockfile.1 | 14 +++ src/etc/man/cargo-metadata.1 | 14 +++ src/etc/man/cargo-package.1 | 14 +++ src/etc/man/cargo-pkgid.1 | 14 +++ src/etc/man/cargo-publish.1 | 14 +++ src/etc/man/cargo-remove.1 | 14 +++ src/etc/man/cargo-run.1 | 14 +++ src/etc/man/cargo-rustc.1 | 14 +++ src/etc/man/cargo-rustdoc.1 | 14 +++ src/etc/man/cargo-test.1 | 14 +++ src/etc/man/cargo-tree.1 | 14 +++ src/etc/man/cargo-update.1 | 14 +++ src/etc/man/cargo-vendor.1 | 14 +++ .../testsuite/cargo_add/help/stdout.term.svg | 108 +++++++++--------- .../cargo_bench/help/stdout.term.svg | 18 +-- .../cargo_build/help/stdout.term.svg | 18 +-- .../cargo_check/help/stdout.term.svg | 18 +-- .../cargo_clean/help/stdout.term.svg | 16 +-- .../testsuite/cargo_doc/help/stdout.term.svg | 18 +-- .../cargo_fetch/help/stdout.term.svg | 16 +-- .../testsuite/cargo_fix/help/stdout.term.svg | 18 +-- .../help/stdout.term.svg | 18 +-- .../cargo_metadata/help/stdout.term.svg | 16 +-- .../cargo_package/help/stdout.term.svg | 16 +-- .../cargo_pkgid/help/stdout.term.svg | 16 +-- .../cargo_publish/help/stdout.term.svg | 16 +-- .../cargo_remove/help/stdout.term.svg | 16 +-- .../testsuite/cargo_run/help/stdout.term.svg | 18 +-- .../cargo_rustc/help/stdout.term.svg | 18 +-- .../cargo_rustdoc/help/stdout.term.svg | 18 +-- .../testsuite/cargo_test/help/stdout.term.svg | 20 ++-- .../testsuite/cargo_tree/help/stdout.term.svg | 16 +-- .../cargo_update/help/stdout.term.svg | 18 +-- .../cargo_vendor/help/stdout.term.svg | 16 +-- tests/testsuite/lockfile_path.rs | 24 ++-- 107 files changed, 1175 insertions(+), 214 deletions(-) create mode 100644 src/doc/man/includes/options-lockfile-path.md diff --git a/src/doc/man/cargo-add.md b/src/doc/man/cargo-add.md index 6d388cb5417..1c0b736af90 100644 --- a/src/doc/man/cargo-add.md +++ b/src/doc/man/cargo-add.md @@ -160,6 +160,8 @@ Add dependencies to only the specified package. {{> options-ignore-rust-version }} {{> options-locked }} + +{{> options-lockfile-path }} {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-bench.md b/src/doc/man/cargo-bench.md index cd54fcee404..9e8ce249074 100644 --- a/src/doc/man/cargo-bench.md +++ b/src/doc/man/cargo-bench.md @@ -146,6 +146,8 @@ passing `--nocapture` to the benchmark binaries: {{> options-ignore-rust-version }} {{> options-locked }} + +{{> options-lockfile-path }} {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-build.md b/src/doc/man/cargo-build.md index 7c704314ca4..bf4fbc34e64 100644 --- a/src/doc/man/cargo-build.md +++ b/src/doc/man/cargo-build.md @@ -87,6 +87,8 @@ See for more information. {{> options-ignore-rust-version }} {{> options-locked }} + +{{> options-lockfile-path }} {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-check.md b/src/doc/man/cargo-check.md index 9af606fda3d..0a846c4e92f 100644 --- a/src/doc/man/cargo-check.md +++ b/src/doc/man/cargo-check.md @@ -70,6 +70,8 @@ they have `required-features` that are missing. {{> options-ignore-rust-version }} {{> options-locked }} + +{{> options-lockfile-path }} {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-clean.md b/src/doc/man/cargo-clean.md index ee920b22369..bc8fdc2ba5d 100644 --- a/src/doc/man/cargo-clean.md +++ b/src/doc/man/cargo-clean.md @@ -72,6 +72,8 @@ Remove all artifacts in the directory with the given profile name. {{> options-manifest-path }} {{> options-locked }} + +{{> options-lockfile-path }} {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-doc.md b/src/doc/man/cargo-doc.md index 3d036024d42..d5431df5d60 100644 --- a/src/doc/man/cargo-doc.md +++ b/src/doc/man/cargo-doc.md @@ -104,6 +104,8 @@ and supports common Unix glob patterns. {{> options-ignore-rust-version }} {{> options-locked }} + +{{> options-lockfile-path }} {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-fetch.md b/src/doc/man/cargo-fetch.md index b8a0eb66620..22a833f81bf 100644 --- a/src/doc/man/cargo-fetch.md +++ b/src/doc/man/cargo-fetch.md @@ -48,6 +48,8 @@ you plan to use Cargo without a network with the `--offline` flag. {{> options-manifest-path }} {{> options-locked }} + +{{> options-lockfile-path }} {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-fix.md b/src/doc/man/cargo-fix.md index af0dc3f214a..2c25720db48 100644 --- a/src/doc/man/cargo-fix.md +++ b/src/doc/man/cargo-fix.md @@ -150,6 +150,8 @@ When no target selection options are given, `cargo fix` will fix all targets {{> options-ignore-rust-version }} {{> options-locked }} + +{{> options-lockfile-path }} {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-generate-lockfile.md b/src/doc/man/cargo-generate-lockfile.md index 956cc58dc20..63c17849c81 100644 --- a/src/doc/man/cargo-generate-lockfile.md +++ b/src/doc/man/cargo-generate-lockfile.md @@ -33,6 +33,8 @@ lockfile and has more options for controlling update behavior. {{> options-ignore-rust-version }} {{> options-locked }} + +{{> options-lockfile-path }} {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-metadata.md b/src/doc/man/cargo-metadata.md index f95ba7c5eec..0205a61e865 100644 --- a/src/doc/man/cargo-metadata.md +++ b/src/doc/man/cargo-metadata.md @@ -378,6 +378,8 @@ reproduction of the information within `Cargo.toml`. {{> options-manifest-path }} {{> options-locked }} + +{{> options-lockfile-path }} {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-package.md b/src/doc/man/cargo-package.md index 7443c20fd0c..3d2fd1fbb6d 100644 --- a/src/doc/man/cargo-package.md +++ b/src/doc/man/cargo-package.md @@ -128,6 +128,8 @@ published to this registry. {{> options-locked }} +{{> options-lockfile-path }} + {{/options}} ### Miscellaneous Options diff --git a/src/doc/man/cargo-pkgid.md b/src/doc/man/cargo-pkgid.md index 54cb9f3912b..28a6ea13808 100644 --- a/src/doc/man/cargo-pkgid.md +++ b/src/doc/man/cargo-pkgid.md @@ -63,6 +63,8 @@ Get the package ID for the given package instead of the current package. {{> options-locked }} +{{> options-lockfile-path }} + {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-publish.md b/src/doc/man/cargo-publish.md index c5e64db80de..fa4c823ea09 100644 --- a/src/doc/man/cargo-publish.md +++ b/src/doc/man/cargo-publish.md @@ -90,6 +90,8 @@ which defaults to `crates-io`. {{> options-locked }} +{{> options-lockfile-path }} + {{/options}} ### Miscellaneous Options diff --git a/src/doc/man/cargo-remove.md b/src/doc/man/cargo-remove.md index 0bdb04ac63c..87bacb5b491 100644 --- a/src/doc/man/cargo-remove.md +++ b/src/doc/man/cargo-remove.md @@ -59,6 +59,8 @@ Don't actually write to the manifest. {{> options-manifest-path }} {{> options-locked }} + +{{> options-lockfile-path }} {{/options}} ### Package Selection diff --git a/src/doc/man/cargo-run.md b/src/doc/man/cargo-run.md index d32236c1efe..c5d37790e5d 100644 --- a/src/doc/man/cargo-run.md +++ b/src/doc/man/cargo-run.md @@ -87,6 +87,8 @@ Run the specified example. {{> options-locked }} +{{> options-lockfile-path }} + {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-rustc.md b/src/doc/man/cargo-rustc.md index 7a3f5760834..15238ea09d3 100644 --- a/src/doc/man/cargo-rustc.md +++ b/src/doc/man/cargo-rustc.md @@ -112,6 +112,8 @@ This flag only works when building a `lib` or `example` library target. {{> options-locked }} +{{> options-lockfile-path }} + {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-rustdoc.md b/src/doc/man/cargo-rustdoc.md index 393f7c8b491..5a354d2d1d6 100644 --- a/src/doc/man/cargo-rustdoc.md +++ b/src/doc/man/cargo-rustdoc.md @@ -93,6 +93,8 @@ if its name is the same as the lib target. Binaries are skipped if they have {{> options-ignore-rust-version }} {{> options-locked }} + +{{> options-lockfile-path }} {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-test.md b/src/doc/man/cargo-test.md index fa4c998e927..93663f9cabf 100644 --- a/src/doc/man/cargo-test.md +++ b/src/doc/man/cargo-test.md @@ -172,6 +172,8 @@ results readable. Test output can be recovered (e.g., for debugging) by passing {{> options-locked }} +{{> options-lockfile-path }} + {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-tree.md b/src/doc/man/cargo-tree.md index f8773430c16..ce99b761e7d 100644 --- a/src/doc/man/cargo-tree.md +++ b/src/doc/man/cargo-tree.md @@ -186,6 +186,7 @@ Sets how each line is displayed. The _prefix_ value can be one of: {{> options-locked }} +{{> options-lockfile-path }} {{/options}} {{> section-features }} diff --git a/src/doc/man/cargo-update.md b/src/doc/man/cargo-update.md index e0ad8ff5352..8e7a9be5a76 100644 --- a/src/doc/man/cargo-update.md +++ b/src/doc/man/cargo-update.md @@ -97,6 +97,8 @@ Displays what would be updated, but doesn't actually write the lockfile. {{> options-locked }} +{{> options-lockfile-path }} + {{/options}} {{> section-options-common }} diff --git a/src/doc/man/cargo-vendor.md b/src/doc/man/cargo-vendor.md index 8f0ea952113..464437b044f 100644 --- a/src/doc/man/cargo-vendor.md +++ b/src/doc/man/cargo-vendor.md @@ -66,6 +66,8 @@ only a subset of the packages have changed. {{> options-locked }} +{{> options-lockfile-path }} + {{/options}} ### Display Options diff --git a/src/doc/man/generated_txt/cargo-add.txt b/src/doc/man/generated_txt/cargo-add.txt index b4f006b9e17..a9628eb0145 100644 --- a/src/doc/man/generated_txt/cargo-add.txt +++ b/src/doc/man/generated_txt/cargo-add.txt @@ -197,6 +197,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-bench.txt b/src/doc/man/generated_txt/cargo-bench.txt index ae26fae333c..0770525e73b 100644 --- a/src/doc/man/generated_txt/cargo-bench.txt +++ b/src/doc/man/generated_txt/cargo-bench.txt @@ -368,6 +368,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-build.txt b/src/doc/man/generated_txt/cargo-build.txt index 316c068d0b5..f3a461de50c 100644 --- a/src/doc/man/generated_txt/cargo-build.txt +++ b/src/doc/man/generated_txt/cargo-build.txt @@ -302,6 +302,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-check.txt b/src/doc/man/generated_txt/cargo-check.txt index 844f101784d..5b8c81ca933 100644 --- a/src/doc/man/generated_txt/cargo-check.txt +++ b/src/doc/man/generated_txt/cargo-check.txt @@ -287,6 +287,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-clean.txt b/src/doc/man/generated_txt/cargo-clean.txt index 066a70352a3..b0a803342ab 100644 --- a/src/doc/man/generated_txt/cargo-clean.txt +++ b/src/doc/man/generated_txt/cargo-clean.txt @@ -123,6 +123,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-doc.txt b/src/doc/man/generated_txt/cargo-doc.txt index 2f90b945852..0aef3201e1b 100644 --- a/src/doc/man/generated_txt/cargo-doc.txt +++ b/src/doc/man/generated_txt/cargo-doc.txt @@ -258,6 +258,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-fetch.txt b/src/doc/man/generated_txt/cargo-fetch.txt index 63fa205a3c5..263fb2155a2 100644 --- a/src/doc/man/generated_txt/cargo-fetch.txt +++ b/src/doc/man/generated_txt/cargo-fetch.txt @@ -102,6 +102,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-fix.txt b/src/doc/man/generated_txt/cargo-fix.txt index c458ce5a277..9f510183b14 100644 --- a/src/doc/man/generated_txt/cargo-fix.txt +++ b/src/doc/man/generated_txt/cargo-fix.txt @@ -360,6 +360,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-generate-lockfile.txt b/src/doc/man/generated_txt/cargo-generate-lockfile.txt index 7c925d38475..504aca13e9e 100644 --- a/src/doc/man/generated_txt/cargo-generate-lockfile.txt +++ b/src/doc/man/generated_txt/cargo-generate-lockfile.txt @@ -81,6 +81,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-metadata.txt b/src/doc/man/generated_txt/cargo-metadata.txt index 9785e005701..5e7ba5748c9 100644 --- a/src/doc/man/generated_txt/cargo-metadata.txt +++ b/src/doc/man/generated_txt/cargo-metadata.txt @@ -438,6 +438,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-package.txt b/src/doc/man/generated_txt/cargo-package.txt index 39c317c63e2..be73a749363 100644 --- a/src/doc/man/generated_txt/cargo-package.txt +++ b/src/doc/man/generated_txt/cargo-package.txt @@ -212,6 +212,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Miscellaneous Options -j N, --jobs N Number of parallel jobs to run. May also be specified with the diff --git a/src/doc/man/generated_txt/cargo-pkgid.txt b/src/doc/man/generated_txt/cargo-pkgid.txt index 3123dcad20b..b9f6bbf861c 100644 --- a/src/doc/man/generated_txt/cargo-pkgid.txt +++ b/src/doc/man/generated_txt/cargo-pkgid.txt @@ -116,6 +116,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-publish.txt b/src/doc/man/generated_txt/cargo-publish.txt index d0b32a1582d..e9a82c5fdde 100644 --- a/src/doc/man/generated_txt/cargo-publish.txt +++ b/src/doc/man/generated_txt/cargo-publish.txt @@ -160,6 +160,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Miscellaneous Options -j N, --jobs N Number of parallel jobs to run. May also be specified with the diff --git a/src/doc/man/generated_txt/cargo-remove.txt b/src/doc/man/generated_txt/cargo-remove.txt index 9d8c14afcc9..691557a168c 100644 --- a/src/doc/man/generated_txt/cargo-remove.txt +++ b/src/doc/man/generated_txt/cargo-remove.txt @@ -93,6 +93,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Package Selection -p spec…, --package spec… Package to remove from. diff --git a/src/doc/man/generated_txt/cargo-run.txt b/src/doc/man/generated_txt/cargo-run.txt index 6cea9d3a661..9a644b3ef05 100644 --- a/src/doc/man/generated_txt/cargo-run.txt +++ b/src/doc/man/generated_txt/cargo-run.txt @@ -206,6 +206,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-rustc.txt b/src/doc/man/generated_txt/cargo-rustc.txt index 86ef3114013..7f52a368659 100644 --- a/src/doc/man/generated_txt/cargo-rustc.txt +++ b/src/doc/man/generated_txt/cargo-rustc.txt @@ -304,6 +304,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-rustdoc.txt b/src/doc/man/generated_txt/cargo-rustdoc.txt index f93a59c79e9..6829e19ca27 100644 --- a/src/doc/man/generated_txt/cargo-rustdoc.txt +++ b/src/doc/man/generated_txt/cargo-rustdoc.txt @@ -274,6 +274,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-test.txt b/src/doc/man/generated_txt/cargo-test.txt index 1b97d3d7dff..eca7bdc8870 100644 --- a/src/doc/man/generated_txt/cargo-test.txt +++ b/src/doc/man/generated_txt/cargo-test.txt @@ -394,6 +394,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-tree.txt b/src/doc/man/generated_txt/cargo-tree.txt index 4037e7f0c5c..ed690bebdc3 100644 --- a/src/doc/man/generated_txt/cargo-tree.txt +++ b/src/doc/man/generated_txt/cargo-tree.txt @@ -243,6 +243,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Feature Selection The feature flags allow you to control which features are enabled. When no feature options are given, the default feature is activated for every diff --git a/src/doc/man/generated_txt/cargo-update.txt b/src/doc/man/generated_txt/cargo-update.txt index 1e3500481ad..0d36e2347b8 100644 --- a/src/doc/man/generated_txt/cargo-update.txt +++ b/src/doc/man/generated_txt/cargo-update.txt @@ -140,6 +140,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Common Options +toolchain If Cargo has been installed with rustup, and the first argument to diff --git a/src/doc/man/generated_txt/cargo-vendor.txt b/src/doc/man/generated_txt/cargo-vendor.txt index 771e75326d6..8979505f997 100644 --- a/src/doc/man/generated_txt/cargo-vendor.txt +++ b/src/doc/man/generated_txt/cargo-vendor.txt @@ -85,6 +85,21 @@ OPTIONS --frozen Equivalent to specifying both --locked and --offline. + --lockfile-path PATH + Changes the path of the lockfile from the default (./Cargo.lock) to + PATH. PATH must end with Cargo.lock (e.g. --lockfile-path + /tmp/temporary-lockfile/Cargo.lock). Note that providing + --lockfile-path will ignore existing default lockfile + (./Cargo.lock), if exists, and instead will either use PATH lockfile + (or write a new lockfile into the provided path if it doesn’t + exist). This flag can be used to run most commands in read-only + directories, writing lockfile into the provided PATH. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #5707 + ). + Display Options -v, --verbose Use verbose output. May be specified twice for “very verbose” diff --git a/src/doc/man/includes/options-lockfile-path.md b/src/doc/man/includes/options-lockfile-path.md new file mode 100644 index 00000000000..6e96a926144 --- /dev/null +++ b/src/doc/man/includes/options-lockfile-path.md @@ -0,0 +1,12 @@ +{{#option "`--lockfile-path` _PATH_"}} +Changes the path of the lockfile from the default (`./Cargo.lock`) to _PATH_. _PATH_ must end with +`Cargo.lock` (e.g. `--lockfile-path /tmp/temporary-lockfile/Cargo.lock`). Note that providing +`--lockfile-path` will ignore existing default lockfile (`./Cargo.lock`), if exists, and instead will +either use _PATH_ lockfile (or write a new lockfile into the provided path if it doesn't exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided _PATH_. + +This option is only available on the [nightly +channel](https://doc.rust-lang.org/book/appendix-07-nightly-rust.html) and +requires the `-Z unstable-options` flag to enable (see +[#5707](https://github.com/rust-lang/cargo/issues/5707)). +{{/option}} \ No newline at end of file diff --git a/src/doc/src/commands/cargo-add.md b/src/doc/src/commands/cargo-add.md index 0411bdd5c30..80145be38d1 100644 --- a/src/doc/src/commands/cargo-add.md +++ b/src/doc/src/commands/cargo-add.md @@ -215,6 +215,18 @@ offline.

--frozen
Equivalent to specifying both --locked and --offline.
+ +
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ ### Common Options diff --git a/src/doc/src/commands/cargo-bench.md b/src/doc/src/commands/cargo-bench.md index d48e164e956..9e8815e7539 100644 --- a/src/doc/src/commands/cargo-bench.md +++ b/src/doc/src/commands/cargo-bench.md @@ -404,6 +404,18 @@ offline.

--frozen
Equivalent to specifying both --locked and --offline.
+ +
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ ### Common Options diff --git a/src/doc/src/commands/cargo-build.md b/src/doc/src/commands/cargo-build.md index d0be79bbd0f..1e2a2211057 100644 --- a/src/doc/src/commands/cargo-build.md +++ b/src/doc/src/commands/cargo-build.md @@ -335,6 +335,18 @@ offline.

--frozen
Equivalent to specifying both --locked and --offline.
+ +
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ ### Common Options diff --git a/src/doc/src/commands/cargo-check.md b/src/doc/src/commands/cargo-check.md index 2db53d9dcd4..7d972620452 100644 --- a/src/doc/src/commands/cargo-check.md +++ b/src/doc/src/commands/cargo-check.md @@ -317,6 +317,18 @@ offline.

--frozen
Equivalent to specifying both --locked and --offline.
+ +
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ ### Common Options diff --git a/src/doc/src/commands/cargo-clean.md b/src/doc/src/commands/cargo-clean.md index aa4e0eb46e3..9e58cbe7307 100644 --- a/src/doc/src/commands/cargo-clean.md +++ b/src/doc/src/commands/cargo-clean.md @@ -138,6 +138,18 @@ offline.

--frozen
Equivalent to specifying both --locked and --offline.
+ +
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ ### Common Options diff --git a/src/doc/src/commands/cargo-doc.md b/src/doc/src/commands/cargo-doc.md index a57389e8a2b..a05fd45c671 100644 --- a/src/doc/src/commands/cargo-doc.md +++ b/src/doc/src/commands/cargo-doc.md @@ -292,6 +292,18 @@ offline.

--frozen
Equivalent to specifying both --locked and --offline.
+ +
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ ### Common Options diff --git a/src/doc/src/commands/cargo-fetch.md b/src/doc/src/commands/cargo-fetch.md index 694a4a2f0ca..224db2baf08 100644 --- a/src/doc/src/commands/cargo-fetch.md +++ b/src/doc/src/commands/cargo-fetch.md @@ -105,6 +105,18 @@ if there might be a newer version as indicated in the local copy of the index.--frozen
Equivalent to specifying both --locked and --offline.
+ +
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ ### Common Options diff --git a/src/doc/src/commands/cargo-fix.md b/src/doc/src/commands/cargo-fix.md index 6e3faa01b29..653a4acb1bc 100644 --- a/src/doc/src/commands/cargo-fix.md +++ b/src/doc/src/commands/cargo-fix.md @@ -397,6 +397,18 @@ offline.

--frozen
Equivalent to specifying both --locked and --offline.
+ +
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ ### Common Options diff --git a/src/doc/src/commands/cargo-generate-lockfile.md b/src/doc/src/commands/cargo-generate-lockfile.md index a87e86a6295..776f97ff2a4 100644 --- a/src/doc/src/commands/cargo-generate-lockfile.md +++ b/src/doc/src/commands/cargo-generate-lockfile.md @@ -90,6 +90,18 @@ offline.

--frozen
Equivalent to specifying both --locked and --offline.
+ +
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ ### Common Options diff --git a/src/doc/src/commands/cargo-metadata.md b/src/doc/src/commands/cargo-metadata.md index 3326c44a1ef..5bca0fe1c0f 100644 --- a/src/doc/src/commands/cargo-metadata.md +++ b/src/doc/src/commands/cargo-metadata.md @@ -458,6 +458,18 @@ offline.

--frozen
Equivalent to specifying both --locked and --offline.
+ +
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ ### Common Options diff --git a/src/doc/src/commands/cargo-package.md b/src/doc/src/commands/cargo-package.md index 765281f479c..ed091a12751 100644 --- a/src/doc/src/commands/cargo-package.md +++ b/src/doc/src/commands/cargo-package.md @@ -233,6 +233,18 @@ offline.

Equivalent to specifying both --locked and --offline.
+
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ + ### Miscellaneous Options diff --git a/src/doc/src/commands/cargo-pkgid.md b/src/doc/src/commands/cargo-pkgid.md index e392985f1f5..241a852b42a 100644 --- a/src/doc/src/commands/cargo-pkgid.md +++ b/src/doc/src/commands/cargo-pkgid.md @@ -119,6 +119,18 @@ offline.

Equivalent to specifying both --locked and --offline.
+
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ + ### Common Options diff --git a/src/doc/src/commands/cargo-publish.md b/src/doc/src/commands/cargo-publish.md index 17d917b7ca5..4607fc589a1 100644 --- a/src/doc/src/commands/cargo-publish.md +++ b/src/doc/src/commands/cargo-publish.md @@ -180,6 +180,18 @@ offline.

Equivalent to specifying both --locked and --offline.
+
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ + ### Miscellaneous Options diff --git a/src/doc/src/commands/cargo-remove.md b/src/doc/src/commands/cargo-remove.md index afbcbf590eb..de92575437f 100644 --- a/src/doc/src/commands/cargo-remove.md +++ b/src/doc/src/commands/cargo-remove.md @@ -109,6 +109,18 @@ offline.

--frozen
Equivalent to specifying both --locked and --offline.
+ +
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ ### Package Selection diff --git a/src/doc/src/commands/cargo-run.md b/src/doc/src/commands/cargo-run.md index 4ea9ef2f8af..e68f5500197 100644 --- a/src/doc/src/commands/cargo-run.md +++ b/src/doc/src/commands/cargo-run.md @@ -238,6 +238,18 @@ offline.

Equivalent to specifying both --locked and --offline.
+
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ + ### Common Options diff --git a/src/doc/src/commands/cargo-rustc.md b/src/doc/src/commands/cargo-rustc.md index 08d2479e3da..8a5bee5daab 100644 --- a/src/doc/src/commands/cargo-rustc.md +++ b/src/doc/src/commands/cargo-rustc.md @@ -332,6 +332,18 @@ offline.

Equivalent to specifying both --locked and --offline.
+
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ + ### Common Options diff --git a/src/doc/src/commands/cargo-rustdoc.md b/src/doc/src/commands/cargo-rustdoc.md index f6c2ac4ce3c..5ec25b92498 100644 --- a/src/doc/src/commands/cargo-rustdoc.md +++ b/src/doc/src/commands/cargo-rustdoc.md @@ -312,6 +312,18 @@ offline.

--frozen
Equivalent to specifying both --locked and --offline.
+ +
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ ### Common Options diff --git a/src/doc/src/commands/cargo-test.md b/src/doc/src/commands/cargo-test.md index 0ea9255f9ce..ba9277594ae 100644 --- a/src/doc/src/commands/cargo-test.md +++ b/src/doc/src/commands/cargo-test.md @@ -434,6 +434,18 @@ offline.

Equivalent to specifying both --locked and --offline.
+
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ + ### Common Options diff --git a/src/doc/src/commands/cargo-tree.md b/src/doc/src/commands/cargo-tree.md index a596a9b9882..41e6d4dbbff 100644 --- a/src/doc/src/commands/cargo-tree.md +++ b/src/doc/src/commands/cargo-tree.md @@ -251,6 +251,17 @@ offline.

Equivalent to specifying both --locked and --offline.
+
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ ### Feature Selection diff --git a/src/doc/src/commands/cargo-update.md b/src/doc/src/commands/cargo-update.md index 3c7eb59e7f1..2b3a6458d22 100644 --- a/src/doc/src/commands/cargo-update.md +++ b/src/doc/src/commands/cargo-update.md @@ -150,6 +150,18 @@ offline.

Equivalent to specifying both --locked and --offline.
+
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ + ### Common Options diff --git a/src/doc/src/commands/cargo-vendor.md b/src/doc/src/commands/cargo-vendor.md index 587da266ee1..2e8ca08cd81 100644 --- a/src/doc/src/commands/cargo-vendor.md +++ b/src/doc/src/commands/cargo-vendor.md @@ -97,6 +97,18 @@ offline.

Equivalent to specifying both --locked and --offline.
+
--lockfile-path PATH
+
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing +--lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#5707).

+ + ### Display Options diff --git a/src/etc/man/cargo-add.1 b/src/etc/man/cargo-add.1 index ed8859da37f..20fbed027f2 100644 --- a/src/etc/man/cargo-add.1 +++ b/src/etc/man/cargo-add.1 @@ -254,6 +254,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-bench.1 b/src/etc/man/cargo-bench.1 index a9c3ba00387..ae19351f147 100644 --- a/src/etc/man/cargo-bench.1 +++ b/src/etc/man/cargo-bench.1 @@ -454,6 +454,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-build.1 b/src/etc/man/cargo-build.1 index 23e49a15e16..77ffc5a2c14 100644 --- a/src/etc/man/cargo-build.1 +++ b/src/etc/man/cargo-build.1 @@ -372,6 +372,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-check.1 b/src/etc/man/cargo-check.1 index 50dd9e37f09..2d9422ea8ac 100644 --- a/src/etc/man/cargo-check.1 +++ b/src/etc/man/cargo-check.1 @@ -353,6 +353,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-clean.1 b/src/etc/man/cargo-clean.1 index 00f47ad91f5..8b5a483bbb8 100644 --- a/src/etc/man/cargo-clean.1 +++ b/src/etc/man/cargo-clean.1 @@ -153,6 +153,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-doc.1 b/src/etc/man/cargo-doc.1 index 789a736f27b..e704976dfd9 100644 --- a/src/etc/man/cargo-doc.1 +++ b/src/etc/man/cargo-doc.1 @@ -320,6 +320,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-fetch.1 b/src/etc/man/cargo-fetch.1 index 6687506f46a..340330d586d 100644 --- a/src/etc/man/cargo-fetch.1 +++ b/src/etc/man/cargo-fetch.1 @@ -119,6 +119,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-fix.1 b/src/etc/man/cargo-fix.1 index 0b94291bb3e..897ea32cb17 100644 --- a/src/etc/man/cargo-fix.1 +++ b/src/etc/man/cargo-fix.1 @@ -448,6 +448,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-generate-lockfile.1 b/src/etc/man/cargo-generate-lockfile.1 index 732c805a73d..235d81871cf 100644 --- a/src/etc/man/cargo-generate-lockfile.1 +++ b/src/etc/man/cargo-generate-lockfile.1 @@ -105,6 +105,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-metadata.1 b/src/etc/man/cargo-metadata.1 index 1357ad1f5d1..bdb15057680 100644 --- a/src/etc/man/cargo-metadata.1 +++ b/src/etc/man/cargo-metadata.1 @@ -476,6 +476,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-package.1 b/src/etc/man/cargo-package.1 index 8530e5454ca..de7e71f9160 100644 --- a/src/etc/man/cargo-package.1 +++ b/src/etc/man/cargo-package.1 @@ -260,6 +260,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Miscellaneous Options" .sp \fB\-j\fR \fIN\fR, diff --git a/src/etc/man/cargo-pkgid.1 b/src/etc/man/cargo-pkgid.1 index f8b7724bd58..b840275268e 100644 --- a/src/etc/man/cargo-pkgid.1 +++ b/src/etc/man/cargo-pkgid.1 @@ -159,6 +159,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-publish.1 b/src/etc/man/cargo-publish.1 index 8a65416f7dd..4c3ddb66550 100644 --- a/src/etc/man/cargo-publish.1 +++ b/src/etc/man/cargo-publish.1 @@ -192,6 +192,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Miscellaneous Options" .sp \fB\-j\fR \fIN\fR, diff --git a/src/etc/man/cargo-remove.1 b/src/etc/man/cargo-remove.1 index 12f1dcfe808..a2fe5ee1211 100644 --- a/src/etc/man/cargo-remove.1 +++ b/src/etc/man/cargo-remove.1 @@ -119,6 +119,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Package Selection" .sp \fB\-p\fR \fIspec\fR\[u2026], diff --git a/src/etc/man/cargo-run.1 b/src/etc/man/cargo-run.1 index 654322fb971..dc4757ba26e 100644 --- a/src/etc/man/cargo-run.1 +++ b/src/etc/man/cargo-run.1 @@ -257,6 +257,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-rustc.1 b/src/etc/man/cargo-rustc.1 index cd07c6a32d9..f26973815e4 100644 --- a/src/etc/man/cargo-rustc.1 +++ b/src/etc/man/cargo-rustc.1 @@ -371,6 +371,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-rustdoc.1 b/src/etc/man/cargo-rustdoc.1 index f89a6f7de82..ee07bb6a7fc 100644 --- a/src/etc/man/cargo-rustdoc.1 +++ b/src/etc/man/cargo-rustdoc.1 @@ -339,6 +339,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-test.1 b/src/etc/man/cargo-test.1 index 84b7ef1927e..504b3b78838 100644 --- a/src/etc/man/cargo-test.1 +++ b/src/etc/man/cargo-test.1 @@ -481,6 +481,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-tree.1 b/src/etc/man/cargo-tree.1 index 9c08491c8b9..be17c79480b 100644 --- a/src/etc/man/cargo-tree.1 +++ b/src/etc/man/cargo-tree.1 @@ -304,6 +304,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Feature Selection" The feature flags allow you to control which features are enabled. When no feature options are given, the \fBdefault\fR feature is activated for every diff --git a/src/etc/man/cargo-update.1 b/src/etc/man/cargo-update.1 index c682e05fc40..83975c2fc0b 100644 --- a/src/etc/man/cargo-update.1 +++ b/src/etc/man/cargo-update.1 @@ -181,6 +181,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Common Options" .sp \fB+\fR\fItoolchain\fR diff --git a/src/etc/man/cargo-vendor.1 b/src/etc/man/cargo-vendor.1 index eae728deaf7..66b842d0100 100644 --- a/src/etc/man/cargo-vendor.1 +++ b/src/etc/man/cargo-vendor.1 @@ -100,6 +100,20 @@ May also be specified with the \fBnet.offline\fR \fIconfig value\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#5707\fR ). +.RE .SS "Display Options" .sp \fB\-v\fR, diff --git a/tests/testsuite/cargo_add/help/stdout.term.svg b/tests/testsuite/cargo_add/help/stdout.term.svg index 2e1cacd322a..e7bbb88b0e0 100644 --- a/tests/testsuite/cargo_add/help/stdout.term.svg +++ b/tests/testsuite/cargo_add/help/stdout.term.svg @@ -1,4 +1,4 @@ - +
--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-bench.md b/src/doc/src/commands/cargo-bench.md index 9e8815e7539..9365c1a8b7c 100644 --- a/src/doc/src/commands/cargo-bench.md +++ b/src/doc/src/commands/cargo-bench.md @@ -406,9 +406,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-build.md b/src/doc/src/commands/cargo-build.md index 1e2a2211057..6e8e018eb0b 100644 --- a/src/doc/src/commands/cargo-build.md +++ b/src/doc/src/commands/cargo-build.md @@ -337,9 +337,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-check.md b/src/doc/src/commands/cargo-check.md index 7d972620452..38a5972fddd 100644 --- a/src/doc/src/commands/cargo-check.md +++ b/src/doc/src/commands/cargo-check.md @@ -319,9 +319,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-clean.md b/src/doc/src/commands/cargo-clean.md index 9e58cbe7307..9ebaa5a3d1d 100644 --- a/src/doc/src/commands/cargo-clean.md +++ b/src/doc/src/commands/cargo-clean.md @@ -140,9 +140,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-doc.md b/src/doc/src/commands/cargo-doc.md index a05fd45c671..3bc6d5e0c48 100644 --- a/src/doc/src/commands/cargo-doc.md +++ b/src/doc/src/commands/cargo-doc.md @@ -294,9 +294,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-fetch.md b/src/doc/src/commands/cargo-fetch.md index 224db2baf08..70c15706eb3 100644 --- a/src/doc/src/commands/cargo-fetch.md +++ b/src/doc/src/commands/cargo-fetch.md @@ -107,9 +107,9 @@ if there might be a newer version as indicated in the local copy of the index.--lockfile-path PATH -

Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-fix.md b/src/doc/src/commands/cargo-fix.md index 653a4acb1bc..f73a2e3efb0 100644 --- a/src/doc/src/commands/cargo-fix.md +++ b/src/doc/src/commands/cargo-fix.md @@ -399,9 +399,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-generate-lockfile.md b/src/doc/src/commands/cargo-generate-lockfile.md index 776f97ff2a4..2f2b69ea455 100644 --- a/src/doc/src/commands/cargo-generate-lockfile.md +++ b/src/doc/src/commands/cargo-generate-lockfile.md @@ -92,9 +92,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-metadata.md b/src/doc/src/commands/cargo-metadata.md index 5bca0fe1c0f..eba982bd3bc 100644 --- a/src/doc/src/commands/cargo-metadata.md +++ b/src/doc/src/commands/cargo-metadata.md @@ -460,9 +460,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-package.md b/src/doc/src/commands/cargo-package.md index ed091a12751..908eccd9171 100644 --- a/src/doc/src/commands/cargo-package.md +++ b/src/doc/src/commands/cargo-package.md @@ -234,9 +234,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-pkgid.md b/src/doc/src/commands/cargo-pkgid.md index 241a852b42a..ffa756ceb91 100644 --- a/src/doc/src/commands/cargo-pkgid.md +++ b/src/doc/src/commands/cargo-pkgid.md @@ -120,9 +120,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-publish.md b/src/doc/src/commands/cargo-publish.md index 4607fc589a1..c198ad1df74 100644 --- a/src/doc/src/commands/cargo-publish.md +++ b/src/doc/src/commands/cargo-publish.md @@ -181,9 +181,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-remove.md b/src/doc/src/commands/cargo-remove.md index de92575437f..b7242a499be 100644 --- a/src/doc/src/commands/cargo-remove.md +++ b/src/doc/src/commands/cargo-remove.md @@ -111,9 +111,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-run.md b/src/doc/src/commands/cargo-run.md index e68f5500197..a2033bfbd3f 100644 --- a/src/doc/src/commands/cargo-run.md +++ b/src/doc/src/commands/cargo-run.md @@ -239,9 +239,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-rustc.md b/src/doc/src/commands/cargo-rustc.md index 8a5bee5daab..9dca2bd9ce8 100644 --- a/src/doc/src/commands/cargo-rustc.md +++ b/src/doc/src/commands/cargo-rustc.md @@ -333,9 +333,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-rustdoc.md b/src/doc/src/commands/cargo-rustdoc.md index 5ec25b92498..ed7d8aae693 100644 --- a/src/doc/src/commands/cargo-rustdoc.md +++ b/src/doc/src/commands/cargo-rustdoc.md @@ -314,9 +314,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-test.md b/src/doc/src/commands/cargo-test.md index ba9277594ae..09d7bc469a8 100644 --- a/src/doc/src/commands/cargo-test.md +++ b/src/doc/src/commands/cargo-test.md @@ -435,9 +435,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-tree.md b/src/doc/src/commands/cargo-tree.md index 41e6d4dbbff..63305007c65 100644 --- a/src/doc/src/commands/cargo-tree.md +++ b/src/doc/src/commands/cargo-tree.md @@ -252,9 +252,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-update.md b/src/doc/src/commands/cargo-update.md index 2b3a6458d22..96168d0db06 100644 --- a/src/doc/src/commands/cargo-update.md +++ b/src/doc/src/commands/cargo-update.md @@ -151,9 +151,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/doc/src/commands/cargo-vendor.md b/src/doc/src/commands/cargo-vendor.md index 2e8ca08cd81..59c1490fd5b 100644 --- a/src/doc/src/commands/cargo-vendor.md +++ b/src/doc/src/commands/cargo-vendor.md @@ -98,9 +98,9 @@ offline.

--lockfile-path PATH
-
Changes the path of the lockfile from the default (./Cargo.lock) to PATH. PATH must end with +
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (./Cargo.lock), if exists, and instead will +--lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly diff --git a/src/etc/man/cargo-add.1 b/src/etc/man/cargo-add.1 index 20fbed027f2..f323bd1939d 100644 --- a/src/etc/man/cargo-add.1 +++ b/src/etc/man/cargo-add.1 @@ -257,9 +257,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-bench.1 b/src/etc/man/cargo-bench.1 index ae19351f147..65afe0a18bf 100644 --- a/src/etc/man/cargo-bench.1 +++ b/src/etc/man/cargo-bench.1 @@ -457,9 +457,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-build.1 b/src/etc/man/cargo-build.1 index 77ffc5a2c14..dbb63a3c4c0 100644 --- a/src/etc/man/cargo-build.1 +++ b/src/etc/man/cargo-build.1 @@ -375,9 +375,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-check.1 b/src/etc/man/cargo-check.1 index 2d9422ea8ac..64560343090 100644 --- a/src/etc/man/cargo-check.1 +++ b/src/etc/man/cargo-check.1 @@ -356,9 +356,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-clean.1 b/src/etc/man/cargo-clean.1 index 8b5a483bbb8..90ee194c115 100644 --- a/src/etc/man/cargo-clean.1 +++ b/src/etc/man/cargo-clean.1 @@ -156,9 +156,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-doc.1 b/src/etc/man/cargo-doc.1 index e704976dfd9..55440b9eff9 100644 --- a/src/etc/man/cargo-doc.1 +++ b/src/etc/man/cargo-doc.1 @@ -323,9 +323,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-fetch.1 b/src/etc/man/cargo-fetch.1 index 340330d586d..18f6d915188 100644 --- a/src/etc/man/cargo-fetch.1 +++ b/src/etc/man/cargo-fetch.1 @@ -122,9 +122,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-fix.1 b/src/etc/man/cargo-fix.1 index 897ea32cb17..cc640089efd 100644 --- a/src/etc/man/cargo-fix.1 +++ b/src/etc/man/cargo-fix.1 @@ -451,9 +451,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-generate-lockfile.1 b/src/etc/man/cargo-generate-lockfile.1 index 235d81871cf..11a0c4e34bb 100644 --- a/src/etc/man/cargo-generate-lockfile.1 +++ b/src/etc/man/cargo-generate-lockfile.1 @@ -108,9 +108,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-metadata.1 b/src/etc/man/cargo-metadata.1 index bdb15057680..b4e33f94fd6 100644 --- a/src/etc/man/cargo-metadata.1 +++ b/src/etc/man/cargo-metadata.1 @@ -479,9 +479,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-package.1 b/src/etc/man/cargo-package.1 index de7e71f9160..edf5e5ce5af 100644 --- a/src/etc/man/cargo-package.1 +++ b/src/etc/man/cargo-package.1 @@ -263,9 +263,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-pkgid.1 b/src/etc/man/cargo-pkgid.1 index b840275268e..bb64de45d2f 100644 --- a/src/etc/man/cargo-pkgid.1 +++ b/src/etc/man/cargo-pkgid.1 @@ -162,9 +162,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-publish.1 b/src/etc/man/cargo-publish.1 index 4c3ddb66550..772554e7f48 100644 --- a/src/etc/man/cargo-publish.1 +++ b/src/etc/man/cargo-publish.1 @@ -195,9 +195,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-remove.1 b/src/etc/man/cargo-remove.1 index a2fe5ee1211..a8eebf19b68 100644 --- a/src/etc/man/cargo-remove.1 +++ b/src/etc/man/cargo-remove.1 @@ -122,9 +122,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-run.1 b/src/etc/man/cargo-run.1 index dc4757ba26e..d59b3311185 100644 --- a/src/etc/man/cargo-run.1 +++ b/src/etc/man/cargo-run.1 @@ -260,9 +260,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-rustc.1 b/src/etc/man/cargo-rustc.1 index f26973815e4..aeb8a1320f9 100644 --- a/src/etc/man/cargo-rustc.1 +++ b/src/etc/man/cargo-rustc.1 @@ -374,9 +374,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-rustdoc.1 b/src/etc/man/cargo-rustdoc.1 index ee07bb6a7fc..f64f13794c4 100644 --- a/src/etc/man/cargo-rustdoc.1 +++ b/src/etc/man/cargo-rustdoc.1 @@ -342,9 +342,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-test.1 b/src/etc/man/cargo-test.1 index 504b3b78838..ec97199fa0c 100644 --- a/src/etc/man/cargo-test.1 +++ b/src/etc/man/cargo-test.1 @@ -484,9 +484,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-tree.1 b/src/etc/man/cargo-tree.1 index be17c79480b..4c37a8dbdfb 100644 --- a/src/etc/man/cargo-tree.1 +++ b/src/etc/man/cargo-tree.1 @@ -307,9 +307,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-update.1 b/src/etc/man/cargo-update.1 index 83975c2fc0b..6ce4bab9cea 100644 --- a/src/etc/man/cargo-update.1 +++ b/src/etc/man/cargo-update.1 @@ -184,9 +184,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/src/etc/man/cargo-vendor.1 b/src/etc/man/cargo-vendor.1 index 66b842d0100..adfac6f30fd 100644 --- a/src/etc/man/cargo-vendor.1 +++ b/src/etc/man/cargo-vendor.1 @@ -103,9 +103,9 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .sp \fB\-\-lockfile\-path\fR \fIPATH\fR .RS 4 -Changes the path of the lockfile from the default (\fB\&./Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with +Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB\&./Cargo.lock\fR), if exists, and instead will +\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp diff --git a/tests/testsuite/cargo_add/help/stdout.term.svg b/tests/testsuite/cargo_add/help/stdout.term.svg index e7bbb88b0e0..1d128a95a81 100644 --- a/tests/testsuite/cargo_add/help/stdout.term.svg +++ b/tests/testsuite/cargo_add/help/stdout.term.svg @@ -175,7 +175,7 @@ --lockfile-path <FILE> - Path to the Cargo.lock file (unstable) + Path to Cargo.lock (unstable) diff --git a/tests/testsuite/cargo_bench/help/stdout.term.svg b/tests/testsuite/cargo_bench/help/stdout.term.svg index aeb164170e4..7546e2aec34 100644 --- a/tests/testsuite/cargo_bench/help/stdout.term.svg +++ b/tests/testsuite/cargo_bench/help/stdout.term.svg @@ -125,7 +125,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_build/help/stdout.term.svg b/tests/testsuite/cargo_build/help/stdout.term.svg index 510415c7f57..645f3256d75 100644 --- a/tests/testsuite/cargo_build/help/stdout.term.svg +++ b/tests/testsuite/cargo_build/help/stdout.term.svg @@ -123,7 +123,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_check/help/stdout.term.svg b/tests/testsuite/cargo_check/help/stdout.term.svg index 942c1221355..08b445ba028 100644 --- a/tests/testsuite/cargo_check/help/stdout.term.svg +++ b/tests/testsuite/cargo_check/help/stdout.term.svg @@ -119,7 +119,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_clean/help/stdout.term.svg b/tests/testsuite/cargo_clean/help/stdout.term.svg index e36e923e2e6..d7e2f0998c6 100644 --- a/tests/testsuite/cargo_clean/help/stdout.term.svg +++ b/tests/testsuite/cargo_clean/help/stdout.term.svg @@ -69,7 +69,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_doc/help/stdout.term.svg b/tests/testsuite/cargo_doc/help/stdout.term.svg index adc08e419c7..2a6633141eb 100644 --- a/tests/testsuite/cargo_doc/help/stdout.term.svg +++ b/tests/testsuite/cargo_doc/help/stdout.term.svg @@ -113,7 +113,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_fetch/help/stdout.term.svg b/tests/testsuite/cargo_fetch/help/stdout.term.svg index 93d1aac5793..1c574938563 100644 --- a/tests/testsuite/cargo_fetch/help/stdout.term.svg +++ b/tests/testsuite/cargo_fetch/help/stdout.term.svg @@ -53,7 +53,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_fix/help/stdout.term.svg b/tests/testsuite/cargo_fix/help/stdout.term.svg index ebae84e173f..631790027d5 100644 --- a/tests/testsuite/cargo_fix/help/stdout.term.svg +++ b/tests/testsuite/cargo_fix/help/stdout.term.svg @@ -127,7 +127,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_generate_lockfile/help/stdout.term.svg b/tests/testsuite/cargo_generate_lockfile/help/stdout.term.svg index 0477f52e64d..86dabeea0e8 100644 --- a/tests/testsuite/cargo_generate_lockfile/help/stdout.term.svg +++ b/tests/testsuite/cargo_generate_lockfile/help/stdout.term.svg @@ -47,7 +47,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages (unstable) diff --git a/tests/testsuite/cargo_metadata/help/stdout.term.svg b/tests/testsuite/cargo_metadata/help/stdout.term.svg index d555a2044bf..adf9af931bc 100644 --- a/tests/testsuite/cargo_metadata/help/stdout.term.svg +++ b/tests/testsuite/cargo_metadata/help/stdout.term.svg @@ -69,7 +69,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_package/help/stdout.term.svg b/tests/testsuite/cargo_package/help/stdout.term.svg index d5d2c615703..4df56c16ec9 100644 --- a/tests/testsuite/cargo_package/help/stdout.term.svg +++ b/tests/testsuite/cargo_package/help/stdout.term.svg @@ -91,7 +91,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_pkgid/help/stdout.term.svg b/tests/testsuite/cargo_pkgid/help/stdout.term.svg index 3c2ae19abef..2c7f51b9d3c 100644 --- a/tests/testsuite/cargo_pkgid/help/stdout.term.svg +++ b/tests/testsuite/cargo_pkgid/help/stdout.term.svg @@ -59,7 +59,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_publish/help/stdout.term.svg b/tests/testsuite/cargo_publish/help/stdout.term.svg index 3e6672c7731..1798919f181 100644 --- a/tests/testsuite/cargo_publish/help/stdout.term.svg +++ b/tests/testsuite/cargo_publish/help/stdout.term.svg @@ -87,7 +87,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_remove/help/stdout.term.svg b/tests/testsuite/cargo_remove/help/stdout.term.svg index a9221b52bd4..7103b973bb3 100644 --- a/tests/testsuite/cargo_remove/help/stdout.term.svg +++ b/tests/testsuite/cargo_remove/help/stdout.term.svg @@ -71,7 +71,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_run/help/stdout.term.svg b/tests/testsuite/cargo_run/help/stdout.term.svg index 296b7ba7d6c..0161d5b8bcc 100644 --- a/tests/testsuite/cargo_run/help/stdout.term.svg +++ b/tests/testsuite/cargo_run/help/stdout.term.svg @@ -101,7 +101,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_rustc/help/stdout.term.svg b/tests/testsuite/cargo_rustc/help/stdout.term.svg index 63e4aeb8a14..51c837074b7 100644 --- a/tests/testsuite/cargo_rustc/help/stdout.term.svg +++ b/tests/testsuite/cargo_rustc/help/stdout.term.svg @@ -123,7 +123,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_rustdoc/help/stdout.term.svg b/tests/testsuite/cargo_rustdoc/help/stdout.term.svg index 123a67a0092..edd94c817f8 100644 --- a/tests/testsuite/cargo_rustdoc/help/stdout.term.svg +++ b/tests/testsuite/cargo_rustdoc/help/stdout.term.svg @@ -121,7 +121,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_test/help/stdout.term.svg b/tests/testsuite/cargo_test/help/stdout.term.svg index b619c569786..66e56fbdee7 100644 --- a/tests/testsuite/cargo_test/help/stdout.term.svg +++ b/tests/testsuite/cargo_test/help/stdout.term.svg @@ -131,7 +131,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_tree/help/stdout.term.svg b/tests/testsuite/cargo_tree/help/stdout.term.svg index df51118670b..9fad79aefa8 100644 --- a/tests/testsuite/cargo_tree/help/stdout.term.svg +++ b/tests/testsuite/cargo_tree/help/stdout.term.svg @@ -97,7 +97,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_update/help/stdout.term.svg b/tests/testsuite/cargo_update/help/stdout.term.svg index 4e7d6f54add..0323fa6a2bc 100644 --- a/tests/testsuite/cargo_update/help/stdout.term.svg +++ b/tests/testsuite/cargo_update/help/stdout.term.svg @@ -63,7 +63,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages (unstable) diff --git a/tests/testsuite/cargo_vendor/help/stdout.term.svg b/tests/testsuite/cargo_vendor/help/stdout.term.svg index e5030ac02ba..06ebe0cfb06 100644 --- a/tests/testsuite/cargo_vendor/help/stdout.term.svg +++ b/tests/testsuite/cargo_vendor/help/stdout.term.svg @@ -63,7 +63,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to the Cargo.lock file (unstable) + --lockfile-path <FILE> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/lockfile_path.rs b/tests/testsuite/lockfile_path.rs index 0f45ab2c608..470672ca22c 100644 --- a/tests/testsuite/lockfile_path.rs +++ b/tests/testsuite/lockfile_path.rs @@ -181,15 +181,16 @@ fn assert_broken_symlink( "Cannot create a file when that file already exists. (os error 183)" }; - make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) .with_status(101) .with_stderr_data(&format!( - r#"[ERROR] Failed to create lockfile-path parent directory somedir/link + r#"[ERROR] failed to create directory `somedir/link` Caused by: {} -"#, err_msg)) +"#, + err_msg + )) .replace_crates_io(registry.index_url()) .run(); } @@ -215,21 +216,21 @@ fn assert_loop_symlink( let registry = RegistryBuilder::new().http_api().http_index().build(); let err_msg = if cfg!(windows) { - "The name of the file cannot be resolved by the system. (os error 1921)" - } else if cfg!(target_os = "macos") { - "Too many levels of symbolic links (os error 62)" + "Cannot create a file when that file already exists. (os error 183)" } else { - "Too many levels of symbolic links (os error 40)" + "File exists (os error 17)" }; make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) .with_status(101) .with_stderr_data(&format!( - r#"[ERROR] Failed to fetch lock file's parent path metadata somedir/link + r#"[ERROR] failed to create directory `somedir/link` Caused by: {} -"#, err_msg)) +"#, + err_msg + )) .replace_crates_io(registry.index_url()) .run(); } From bf7e2dcc1d92987fdcb1d1666c3ae048cde1ea4d Mon Sep 17 00:00:00 2001 From: Ifropc Date: Sat, 3 Aug 2024 14:45:41 -0700 Subject: [PATCH 07/12] feat: lockfile path refactoring --- src/bin/cargo/commands/fix.rs | 11 ++++++++++- src/cargo/core/workspace.rs | 2 +- src/cargo/ops/lockfile.rs | 3 ++- src/cargo/util/command_prelude.rs | 7 ++----- src/doc/man/generated_txt/cargo-add.txt | 10 +++++----- src/doc/man/generated_txt/cargo-bench.txt | 10 +++++----- src/doc/man/generated_txt/cargo-build.txt | 10 +++++----- src/doc/man/generated_txt/cargo-check.txt | 10 +++++----- src/doc/man/generated_txt/cargo-clean.txt | 10 +++++----- src/doc/man/generated_txt/cargo-doc.txt | 10 +++++----- src/doc/man/generated_txt/cargo-fetch.txt | 10 +++++----- src/doc/man/generated_txt/cargo-fix.txt | 10 +++++----- src/doc/man/generated_txt/cargo-generate-lockfile.txt | 10 +++++----- src/doc/man/generated_txt/cargo-metadata.txt | 10 +++++----- src/doc/man/generated_txt/cargo-package.txt | 10 +++++----- src/doc/man/generated_txt/cargo-pkgid.txt | 10 +++++----- src/doc/man/generated_txt/cargo-publish.txt | 10 +++++----- src/doc/man/generated_txt/cargo-remove.txt | 10 +++++----- src/doc/man/generated_txt/cargo-run.txt | 10 +++++----- src/doc/man/generated_txt/cargo-rustc.txt | 10 +++++----- src/doc/man/generated_txt/cargo-rustdoc.txt | 10 +++++----- src/doc/man/generated_txt/cargo-test.txt | 10 +++++----- src/doc/man/generated_txt/cargo-tree.txt | 10 +++++----- src/doc/man/generated_txt/cargo-update.txt | 10 +++++----- src/doc/man/generated_txt/cargo-vendor.txt | 10 +++++----- src/doc/man/includes/options-lockfile-path.md | 4 ++-- src/doc/src/commands/cargo-add.md | 4 ++-- src/doc/src/commands/cargo-bench.md | 4 ++-- src/doc/src/commands/cargo-build.md | 4 ++-- src/doc/src/commands/cargo-check.md | 4 ++-- src/doc/src/commands/cargo-clean.md | 4 ++-- src/doc/src/commands/cargo-doc.md | 4 ++-- src/doc/src/commands/cargo-fetch.md | 4 ++-- src/doc/src/commands/cargo-fix.md | 4 ++-- src/doc/src/commands/cargo-generate-lockfile.md | 4 ++-- src/doc/src/commands/cargo-metadata.md | 4 ++-- src/doc/src/commands/cargo-package.md | 4 ++-- src/doc/src/commands/cargo-pkgid.md | 4 ++-- src/doc/src/commands/cargo-publish.md | 4 ++-- src/doc/src/commands/cargo-remove.md | 4 ++-- src/doc/src/commands/cargo-run.md | 4 ++-- src/doc/src/commands/cargo-rustc.md | 4 ++-- src/doc/src/commands/cargo-rustdoc.md | 4 ++-- src/doc/src/commands/cargo-test.md | 4 ++-- src/doc/src/commands/cargo-tree.md | 4 ++-- src/doc/src/commands/cargo-update.md | 4 ++-- src/doc/src/commands/cargo-vendor.md | 4 ++-- src/etc/man/cargo-add.1 | 4 ++-- src/etc/man/cargo-bench.1 | 4 ++-- src/etc/man/cargo-build.1 | 4 ++-- src/etc/man/cargo-check.1 | 4 ++-- src/etc/man/cargo-clean.1 | 4 ++-- src/etc/man/cargo-doc.1 | 4 ++-- src/etc/man/cargo-fetch.1 | 4 ++-- src/etc/man/cargo-fix.1 | 4 ++-- src/etc/man/cargo-generate-lockfile.1 | 4 ++-- src/etc/man/cargo-metadata.1 | 4 ++-- src/etc/man/cargo-package.1 | 4 ++-- src/etc/man/cargo-pkgid.1 | 4 ++-- src/etc/man/cargo-publish.1 | 4 ++-- src/etc/man/cargo-remove.1 | 4 ++-- src/etc/man/cargo-run.1 | 4 ++-- src/etc/man/cargo-rustc.1 | 4 ++-- src/etc/man/cargo-rustdoc.1 | 4 ++-- src/etc/man/cargo-test.1 | 4 ++-- src/etc/man/cargo-tree.1 | 4 ++-- src/etc/man/cargo-update.1 | 4 ++-- src/etc/man/cargo-vendor.1 | 4 ++-- tests/testsuite/cargo_add/help/stdout.term.svg | 2 +- tests/testsuite/cargo_bench/help/stdout.term.svg | 2 +- tests/testsuite/cargo_build/help/stdout.term.svg | 2 +- tests/testsuite/cargo_check/help/stdout.term.svg | 2 +- tests/testsuite/cargo_clean/help/stdout.term.svg | 2 +- tests/testsuite/cargo_doc/help/stdout.term.svg | 2 +- tests/testsuite/cargo_fetch/help/stdout.term.svg | 2 +- tests/testsuite/cargo_fix/help/stdout.term.svg | 2 +- .../cargo_generate_lockfile/help/stdout.term.svg | 2 +- tests/testsuite/cargo_metadata/help/stdout.term.svg | 2 +- tests/testsuite/cargo_package/help/stdout.term.svg | 2 +- tests/testsuite/cargo_pkgid/help/stdout.term.svg | 2 +- tests/testsuite/cargo_publish/help/stdout.term.svg | 2 +- tests/testsuite/cargo_remove/help/stdout.term.svg | 2 +- tests/testsuite/cargo_run/help/stdout.term.svg | 2 +- tests/testsuite/cargo_rustc/help/stdout.term.svg | 2 +- tests/testsuite/cargo_rustdoc/help/stdout.term.svg | 2 +- tests/testsuite/cargo_test/help/stdout.term.svg | 2 +- tests/testsuite/cargo_tree/help/stdout.term.svg | 2 +- tests/testsuite/cargo_update/help/stdout.term.svg | 2 +- tests/testsuite/cargo_vendor/help/stdout.term.svg | 2 +- 89 files changed, 227 insertions(+), 220 deletions(-) diff --git a/src/bin/cargo/commands/fix.rs b/src/bin/cargo/commands/fix.rs index ae00635caa4..2491548eb9c 100644 --- a/src/bin/cargo/commands/fix.rs +++ b/src/bin/cargo/commands/fix.rs @@ -1,4 +1,6 @@ use crate::command_prelude::*; +use cargo::core::Workspace; +use std::path::Path; use cargo::ops; @@ -71,7 +73,14 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult { // Unlike other commands default `cargo fix` to all targets to fix as much // code as we can. let root_manifest = args.root_manifest(gctx)?; - let ws = args.workspace(gctx)?; + + // Can't use workspace() to avoid using -Zavoid-dev-deps (if passed) + let mut ws = Workspace::new(&root_manifest, gctx)?; + ws.set_resolve_honors_rust_version(args.honor_rust_version()); + let lockfile_path = + lockfile_path(args.get_one::("lockfile-path").map(Path::new), gctx)?; + ws.set_requested_lockfile_path(lockfile_path); + let mut opts = args.compile_options(gctx, mode, Some(&ws), ProfileChecking::LegacyTestOnly)?; if !opts.filter.is_specific() { diff --git a/src/cargo/core/workspace.rs b/src/cargo/core/workspace.rs index f01ec890282..c254baafcdf 100644 --- a/src/cargo/core/workspace.rs +++ b/src/cargo/core/workspace.rs @@ -103,7 +103,7 @@ pub struct Workspace<'gctx> { // file. This is set for `cargo install` without `--locked`. ignore_lock: bool, - // Requested path of the lockfile (i.e. passed as the cli flag) + /// Requested path of the lockfile (i.e. passed as the cli flag) requested_lockfile_path: Option, /// The resolver behavior specified with the `resolver` field. diff --git a/src/cargo/ops/lockfile.rs b/src/cargo/ops/lockfile.rs index d9c4c5ee097..51bdffab6c6 100644 --- a/src/cargo/ops/lockfile.rs +++ b/src/cargo/ops/lockfile.rs @@ -1,7 +1,8 @@ +use std::io::prelude::*; + use crate::core::{resolver, Resolve, ResolveVersion, Workspace}; use crate::util::errors::CargoResult; use crate::util::Filesystem; -use std::io::prelude::*; use anyhow::Context as _; diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index bc19e436591..33c57b7b57d 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -299,7 +299,7 @@ pub trait CommandExt: Sized { fn arg_lockfile_path(self) -> Self { self._arg( opt("lockfile-path", "Path to Cargo.lock (unstable)") - .value_name("FILE") + .value_name("PATH") .help_heading(heading::MANIFEST_OPTIONS), ) } @@ -1015,10 +1015,7 @@ pub fn lockfile_path( let path = gctx.cwd().join(lockfile_path); if !path.ends_with(LOCKFILE_NAME) && !crate::util::toml::is_embedded(&path) { - bail!( - "the lockfile-path must be a path to a {} file", - LOCKFILE_NAME - ) + bail!("the lockfile-path must be a path to a {LOCKFILE_NAME} file") } if path.is_dir() { bail!( diff --git a/src/doc/man/generated_txt/cargo-add.txt b/src/doc/man/generated_txt/cargo-add.txt index 9b0658d26f7..f37496d749c 100644 --- a/src/doc/man/generated_txt/cargo-add.txt +++ b/src/doc/man/generated_txt/cargo-add.txt @@ -201,11 +201,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-bench.txt b/src/doc/man/generated_txt/cargo-bench.txt index 6ea7f65cc4e..ea29cb40732 100644 --- a/src/doc/man/generated_txt/cargo-bench.txt +++ b/src/doc/man/generated_txt/cargo-bench.txt @@ -372,11 +372,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-build.txt b/src/doc/man/generated_txt/cargo-build.txt index 6d0c1a6d89b..b405d010b87 100644 --- a/src/doc/man/generated_txt/cargo-build.txt +++ b/src/doc/man/generated_txt/cargo-build.txt @@ -306,11 +306,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-check.txt b/src/doc/man/generated_txt/cargo-check.txt index 251caba7a3c..abd3b806ce4 100644 --- a/src/doc/man/generated_txt/cargo-check.txt +++ b/src/doc/man/generated_txt/cargo-check.txt @@ -291,11 +291,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-clean.txt b/src/doc/man/generated_txt/cargo-clean.txt index 266bc747574..b8ac07fe899 100644 --- a/src/doc/man/generated_txt/cargo-clean.txt +++ b/src/doc/man/generated_txt/cargo-clean.txt @@ -127,11 +127,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-doc.txt b/src/doc/man/generated_txt/cargo-doc.txt index da30d3a078e..f6dde3580f2 100644 --- a/src/doc/man/generated_txt/cargo-doc.txt +++ b/src/doc/man/generated_txt/cargo-doc.txt @@ -262,11 +262,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-fetch.txt b/src/doc/man/generated_txt/cargo-fetch.txt index 7d3fce92a86..58611ee8d5e 100644 --- a/src/doc/man/generated_txt/cargo-fetch.txt +++ b/src/doc/man/generated_txt/cargo-fetch.txt @@ -106,11 +106,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-fix.txt b/src/doc/man/generated_txt/cargo-fix.txt index dec4b8c0f79..13f9a181fe2 100644 --- a/src/doc/man/generated_txt/cargo-fix.txt +++ b/src/doc/man/generated_txt/cargo-fix.txt @@ -364,11 +364,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-generate-lockfile.txt b/src/doc/man/generated_txt/cargo-generate-lockfile.txt index 98c9f680754..7e251ba0afc 100644 --- a/src/doc/man/generated_txt/cargo-generate-lockfile.txt +++ b/src/doc/man/generated_txt/cargo-generate-lockfile.txt @@ -85,11 +85,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-metadata.txt b/src/doc/man/generated_txt/cargo-metadata.txt index 5f228d3e35b..5500387c59d 100644 --- a/src/doc/man/generated_txt/cargo-metadata.txt +++ b/src/doc/man/generated_txt/cargo-metadata.txt @@ -442,11 +442,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-package.txt b/src/doc/man/generated_txt/cargo-package.txt index d85ecd4194d..6d1020b2eac 100644 --- a/src/doc/man/generated_txt/cargo-package.txt +++ b/src/doc/man/generated_txt/cargo-package.txt @@ -216,11 +216,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-pkgid.txt b/src/doc/man/generated_txt/cargo-pkgid.txt index 3f632c79c0f..c4396491941 100644 --- a/src/doc/man/generated_txt/cargo-pkgid.txt +++ b/src/doc/man/generated_txt/cargo-pkgid.txt @@ -120,11 +120,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-publish.txt b/src/doc/man/generated_txt/cargo-publish.txt index c83d3775454..a78e8a473e8 100644 --- a/src/doc/man/generated_txt/cargo-publish.txt +++ b/src/doc/man/generated_txt/cargo-publish.txt @@ -164,11 +164,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-remove.txt b/src/doc/man/generated_txt/cargo-remove.txt index 38c5c7c5274..7a0dac18dcd 100644 --- a/src/doc/man/generated_txt/cargo-remove.txt +++ b/src/doc/man/generated_txt/cargo-remove.txt @@ -97,11 +97,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-run.txt b/src/doc/man/generated_txt/cargo-run.txt index fb4f10a9400..b39116489a1 100644 --- a/src/doc/man/generated_txt/cargo-run.txt +++ b/src/doc/man/generated_txt/cargo-run.txt @@ -210,11 +210,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-rustc.txt b/src/doc/man/generated_txt/cargo-rustc.txt index 98b7e2ff848..d608d54f827 100644 --- a/src/doc/man/generated_txt/cargo-rustc.txt +++ b/src/doc/man/generated_txt/cargo-rustc.txt @@ -308,11 +308,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-rustdoc.txt b/src/doc/man/generated_txt/cargo-rustdoc.txt index 683353397e9..5ce2de988ba 100644 --- a/src/doc/man/generated_txt/cargo-rustdoc.txt +++ b/src/doc/man/generated_txt/cargo-rustdoc.txt @@ -278,11 +278,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-test.txt b/src/doc/man/generated_txt/cargo-test.txt index 194f9b1d8a1..b14b754b985 100644 --- a/src/doc/man/generated_txt/cargo-test.txt +++ b/src/doc/man/generated_txt/cargo-test.txt @@ -398,11 +398,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-tree.txt b/src/doc/man/generated_txt/cargo-tree.txt index 56ad479c4f3..f78c9ce8e69 100644 --- a/src/doc/man/generated_txt/cargo-tree.txt +++ b/src/doc/man/generated_txt/cargo-tree.txt @@ -247,11 +247,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-update.txt b/src/doc/man/generated_txt/cargo-update.txt index 56e9d894a17..95293b1ae39 100644 --- a/src/doc/man/generated_txt/cargo-update.txt +++ b/src/doc/man/generated_txt/cargo-update.txt @@ -144,11 +144,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/generated_txt/cargo-vendor.txt b/src/doc/man/generated_txt/cargo-vendor.txt index c8eb0d193c7..e43b02fa1a0 100644 --- a/src/doc/man/generated_txt/cargo-vendor.txt +++ b/src/doc/man/generated_txt/cargo-vendor.txt @@ -89,11 +89,11 @@ OPTIONS Changes the path of the lockfile from the default (/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that - providing --lockfile-path will ignore existing default lockfile - (/Cargo.lock), if exists, and instead will either - use PATH lockfile (or write a new lockfile into the provided path if - it doesn’t exist). This flag can be used to run most commands in - read-only directories, writing lockfile into the provided PATH. + providing --lockfile-path will ignore existing lockfile at the + default path, and instead will either use the lockfile from PATH, or + write a new lockfile into the provided PATH if it doesn’t exist. + This flag can be used to run most commands in read-only directories, + writing lockfile into the provided PATH. This option is only available on the nightly channel and diff --git a/src/doc/man/includes/options-lockfile-path.md b/src/doc/man/includes/options-lockfile-path.md index 2ec0d30e3d2..993b9884ec8 100644 --- a/src/doc/man/includes/options-lockfile-path.md +++ b/src/doc/man/includes/options-lockfile-path.md @@ -1,8 +1,8 @@ {{#option "`--lockfile-path` _PATH_"}} Changes the path of the lockfile from the default (`/Cargo.lock`) to _PATH_. _PATH_ must end with `Cargo.lock` (e.g. `--lockfile-path /tmp/temporary-lockfile/Cargo.lock`). Note that providing -`--lockfile-path` will ignore existing default lockfile (`/Cargo.lock`), if exists, and instead will -either use _PATH_ lockfile (or write a new lockfile into the provided path if it doesn't exist). +`--lockfile-path` will ignore existing lockfile at the default path, and instead will +either use the lockfile from _PATH_, or write a new lockfile into the provided _PATH_ if it doesn't exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided _PATH_. This option is only available on the [nightly diff --git a/src/doc/src/commands/cargo-add.md b/src/doc/src/commands/cargo-add.md index f9f3c0ce01f..443db3a8b33 100644 --- a/src/doc/src/commands/cargo-add.md +++ b/src/doc/src/commands/cargo-add.md @@ -219,8 +219,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-bench.md b/src/doc/src/commands/cargo-bench.md index 9365c1a8b7c..b23127fb98a 100644 --- a/src/doc/src/commands/cargo-bench.md +++ b/src/doc/src/commands/cargo-bench.md @@ -408,8 +408,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-build.md b/src/doc/src/commands/cargo-build.md index 6e8e018eb0b..a8fe5f58623 100644 --- a/src/doc/src/commands/cargo-build.md +++ b/src/doc/src/commands/cargo-build.md @@ -339,8 +339,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-check.md b/src/doc/src/commands/cargo-check.md index 38a5972fddd..41fa6b73131 100644 --- a/src/doc/src/commands/cargo-check.md +++ b/src/doc/src/commands/cargo-check.md @@ -321,8 +321,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-clean.md b/src/doc/src/commands/cargo-clean.md index 9ebaa5a3d1d..72ae58c9577 100644 --- a/src/doc/src/commands/cargo-clean.md +++ b/src/doc/src/commands/cargo-clean.md @@ -142,8 +142,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-doc.md b/src/doc/src/commands/cargo-doc.md index 3bc6d5e0c48..041c171975b 100644 --- a/src/doc/src/commands/cargo-doc.md +++ b/src/doc/src/commands/cargo-doc.md @@ -296,8 +296,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-fetch.md b/src/doc/src/commands/cargo-fetch.md index 70c15706eb3..782fdab355a 100644 --- a/src/doc/src/commands/cargo-fetch.md +++ b/src/doc/src/commands/cargo-fetch.md @@ -109,8 +109,8 @@ if there might be a newer version as indicated in the local copy of the index.--lockfile-path PATH

Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-fix.md b/src/doc/src/commands/cargo-fix.md index f73a2e3efb0..8937692393b 100644 --- a/src/doc/src/commands/cargo-fix.md +++ b/src/doc/src/commands/cargo-fix.md @@ -401,8 +401,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-generate-lockfile.md b/src/doc/src/commands/cargo-generate-lockfile.md index 2f2b69ea455..a361cabf02b 100644 --- a/src/doc/src/commands/cargo-generate-lockfile.md +++ b/src/doc/src/commands/cargo-generate-lockfile.md @@ -94,8 +94,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-metadata.md b/src/doc/src/commands/cargo-metadata.md index eba982bd3bc..4d09d6c3df1 100644 --- a/src/doc/src/commands/cargo-metadata.md +++ b/src/doc/src/commands/cargo-metadata.md @@ -462,8 +462,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-package.md b/src/doc/src/commands/cargo-package.md index 908eccd9171..c8a13f8eb23 100644 --- a/src/doc/src/commands/cargo-package.md +++ b/src/doc/src/commands/cargo-package.md @@ -236,8 +236,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-pkgid.md b/src/doc/src/commands/cargo-pkgid.md index ffa756ceb91..c531864d3b9 100644 --- a/src/doc/src/commands/cargo-pkgid.md +++ b/src/doc/src/commands/cargo-pkgid.md @@ -122,8 +122,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-publish.md b/src/doc/src/commands/cargo-publish.md index c198ad1df74..dacdfc8fd26 100644 --- a/src/doc/src/commands/cargo-publish.md +++ b/src/doc/src/commands/cargo-publish.md @@ -183,8 +183,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-remove.md b/src/doc/src/commands/cargo-remove.md index b7242a499be..95e827b7c41 100644 --- a/src/doc/src/commands/cargo-remove.md +++ b/src/doc/src/commands/cargo-remove.md @@ -113,8 +113,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-run.md b/src/doc/src/commands/cargo-run.md index a2033bfbd3f..408008106e4 100644 --- a/src/doc/src/commands/cargo-run.md +++ b/src/doc/src/commands/cargo-run.md @@ -241,8 +241,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-rustc.md b/src/doc/src/commands/cargo-rustc.md index 9dca2bd9ce8..494cb3ccd34 100644 --- a/src/doc/src/commands/cargo-rustc.md +++ b/src/doc/src/commands/cargo-rustc.md @@ -335,8 +335,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-rustdoc.md b/src/doc/src/commands/cargo-rustdoc.md index ed7d8aae693..cd6ec47a8a5 100644 --- a/src/doc/src/commands/cargo-rustdoc.md +++ b/src/doc/src/commands/cargo-rustdoc.md @@ -316,8 +316,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-test.md b/src/doc/src/commands/cargo-test.md index 09d7bc469a8..3e3304948b3 100644 --- a/src/doc/src/commands/cargo-test.md +++ b/src/doc/src/commands/cargo-test.md @@ -437,8 +437,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-tree.md b/src/doc/src/commands/cargo-tree.md index 63305007c65..4c1ae3d646a 100644 --- a/src/doc/src/commands/cargo-tree.md +++ b/src/doc/src/commands/cargo-tree.md @@ -254,8 +254,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-update.md b/src/doc/src/commands/cargo-update.md index 96168d0db06..54d17a3df2b 100644 --- a/src/doc/src/commands/cargo-update.md +++ b/src/doc/src/commands/cargo-update.md @@ -153,8 +153,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/doc/src/commands/cargo-vendor.md b/src/doc/src/commands/cargo-vendor.md index 59c1490fd5b..3ec1ffeef0b 100644 --- a/src/doc/src/commands/cargo-vendor.md +++ b/src/doc/src/commands/cargo-vendor.md @@ -100,8 +100,8 @@ offline.

--lockfile-path PATH
Changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). Note that providing ---lockfile-path will ignore existing default lockfile (<workspace_root>/Cargo.lock), if exists, and instead will -either use PATH lockfile (or write a new lockfile into the provided path if it doesn’t exist). +--lockfile-path will ignore existing lockfile at the default path, and instead will +either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn’t exist. This flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.

This option is only available on the nightly channel and diff --git a/src/etc/man/cargo-add.1 b/src/etc/man/cargo-add.1 index f323bd1939d..d5db51f1547 100644 --- a/src/etc/man/cargo-add.1 +++ b/src/etc/man/cargo-add.1 @@ -259,8 +259,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-bench.1 b/src/etc/man/cargo-bench.1 index 65afe0a18bf..df71be5174f 100644 --- a/src/etc/man/cargo-bench.1 +++ b/src/etc/man/cargo-bench.1 @@ -459,8 +459,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-build.1 b/src/etc/man/cargo-build.1 index dbb63a3c4c0..0eaa6085a71 100644 --- a/src/etc/man/cargo-build.1 +++ b/src/etc/man/cargo-build.1 @@ -377,8 +377,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-check.1 b/src/etc/man/cargo-check.1 index 64560343090..9d595bac4ce 100644 --- a/src/etc/man/cargo-check.1 +++ b/src/etc/man/cargo-check.1 @@ -358,8 +358,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-clean.1 b/src/etc/man/cargo-clean.1 index 90ee194c115..63fa9a4ecc2 100644 --- a/src/etc/man/cargo-clean.1 +++ b/src/etc/man/cargo-clean.1 @@ -158,8 +158,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-doc.1 b/src/etc/man/cargo-doc.1 index 55440b9eff9..89bc9f661b7 100644 --- a/src/etc/man/cargo-doc.1 +++ b/src/etc/man/cargo-doc.1 @@ -325,8 +325,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-fetch.1 b/src/etc/man/cargo-fetch.1 index 18f6d915188..403b2195db4 100644 --- a/src/etc/man/cargo-fetch.1 +++ b/src/etc/man/cargo-fetch.1 @@ -124,8 +124,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-fix.1 b/src/etc/man/cargo-fix.1 index cc640089efd..61ac3186343 100644 --- a/src/etc/man/cargo-fix.1 +++ b/src/etc/man/cargo-fix.1 @@ -453,8 +453,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-generate-lockfile.1 b/src/etc/man/cargo-generate-lockfile.1 index 11a0c4e34bb..3a9f2bdf1a2 100644 --- a/src/etc/man/cargo-generate-lockfile.1 +++ b/src/etc/man/cargo-generate-lockfile.1 @@ -110,8 +110,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-metadata.1 b/src/etc/man/cargo-metadata.1 index b4e33f94fd6..e2269935d59 100644 --- a/src/etc/man/cargo-metadata.1 +++ b/src/etc/man/cargo-metadata.1 @@ -481,8 +481,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-package.1 b/src/etc/man/cargo-package.1 index edf5e5ce5af..1ac506c08fa 100644 --- a/src/etc/man/cargo-package.1 +++ b/src/etc/man/cargo-package.1 @@ -265,8 +265,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-pkgid.1 b/src/etc/man/cargo-pkgid.1 index bb64de45d2f..6d6da78e35d 100644 --- a/src/etc/man/cargo-pkgid.1 +++ b/src/etc/man/cargo-pkgid.1 @@ -164,8 +164,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-publish.1 b/src/etc/man/cargo-publish.1 index 772554e7f48..0fd1c9e864e 100644 --- a/src/etc/man/cargo-publish.1 +++ b/src/etc/man/cargo-publish.1 @@ -197,8 +197,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-remove.1 b/src/etc/man/cargo-remove.1 index a8eebf19b68..1b90e2abb2d 100644 --- a/src/etc/man/cargo-remove.1 +++ b/src/etc/man/cargo-remove.1 @@ -124,8 +124,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-run.1 b/src/etc/man/cargo-run.1 index d59b3311185..3794fe15928 100644 --- a/src/etc/man/cargo-run.1 +++ b/src/etc/man/cargo-run.1 @@ -262,8 +262,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-rustc.1 b/src/etc/man/cargo-rustc.1 index aeb8a1320f9..f5f18568375 100644 --- a/src/etc/man/cargo-rustc.1 +++ b/src/etc/man/cargo-rustc.1 @@ -376,8 +376,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-rustdoc.1 b/src/etc/man/cargo-rustdoc.1 index f64f13794c4..b6393f8bb24 100644 --- a/src/etc/man/cargo-rustdoc.1 +++ b/src/etc/man/cargo-rustdoc.1 @@ -344,8 +344,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-test.1 b/src/etc/man/cargo-test.1 index ec97199fa0c..945d90fb29b 100644 --- a/src/etc/man/cargo-test.1 +++ b/src/etc/man/cargo-test.1 @@ -486,8 +486,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-tree.1 b/src/etc/man/cargo-tree.1 index 4c37a8dbdfb..365ad15eb59 100644 --- a/src/etc/man/cargo-tree.1 +++ b/src/etc/man/cargo-tree.1 @@ -309,8 +309,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-update.1 b/src/etc/man/cargo-update.1 index 6ce4bab9cea..cf20758fc20 100644 --- a/src/etc/man/cargo-update.1 +++ b/src/etc/man/cargo-update.1 @@ -186,8 +186,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/src/etc/man/cargo-vendor.1 b/src/etc/man/cargo-vendor.1 index adfac6f30fd..af7369f13d7 100644 --- a/src/etc/man/cargo-vendor.1 +++ b/src/etc/man/cargo-vendor.1 @@ -105,8 +105,8 @@ Equivalent to specifying both \fB\-\-locked\fR and \fB\-\-offline\fR\&. .RS 4 Changes the path of the lockfile from the default (\fB/Cargo.lock\fR) to \fIPATH\fR\&. \fIPATH\fR must end with \fBCargo.lock\fR (e.g. \fB\-\-lockfile\-path /tmp/temporary\-lockfile/Cargo.lock\fR). Note that providing -\fB\-\-lockfile\-path\fR will ignore existing default lockfile (\fB/Cargo.lock\fR), if exists, and instead will -either use \fIPATH\fR lockfile (or write a new lockfile into the provided path if it doesn\[cq]t exist). +\fB\-\-lockfile\-path\fR will ignore existing lockfile at the default path, and instead will +either use the lockfile from \fIPATH\fR, or write a new lockfile into the provided \fIPATH\fR if it doesn\[cq]t exist. This flag can be used to run most commands in read\-only directories, writing lockfile into the provided \fIPATH\fR\&. .sp This option is only available on the \fInightly diff --git a/tests/testsuite/cargo_add/help/stdout.term.svg b/tests/testsuite/cargo_add/help/stdout.term.svg index 1d128a95a81..9335d606113 100644 --- a/tests/testsuite/cargo_add/help/stdout.term.svg +++ b/tests/testsuite/cargo_add/help/stdout.term.svg @@ -173,7 +173,7 @@ - --lockfile-path <FILE> + --lockfile-path <PATH> Path to Cargo.lock (unstable) diff --git a/tests/testsuite/cargo_bench/help/stdout.term.svg b/tests/testsuite/cargo_bench/help/stdout.term.svg index 7546e2aec34..0e4c8514740 100644 --- a/tests/testsuite/cargo_bench/help/stdout.term.svg +++ b/tests/testsuite/cargo_bench/help/stdout.term.svg @@ -125,7 +125,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_build/help/stdout.term.svg b/tests/testsuite/cargo_build/help/stdout.term.svg index 645f3256d75..2ebb3e82e08 100644 --- a/tests/testsuite/cargo_build/help/stdout.term.svg +++ b/tests/testsuite/cargo_build/help/stdout.term.svg @@ -123,7 +123,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_check/help/stdout.term.svg b/tests/testsuite/cargo_check/help/stdout.term.svg index 08b445ba028..8da619d3cc3 100644 --- a/tests/testsuite/cargo_check/help/stdout.term.svg +++ b/tests/testsuite/cargo_check/help/stdout.term.svg @@ -119,7 +119,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_clean/help/stdout.term.svg b/tests/testsuite/cargo_clean/help/stdout.term.svg index d7e2f0998c6..760ea23fdc6 100644 --- a/tests/testsuite/cargo_clean/help/stdout.term.svg +++ b/tests/testsuite/cargo_clean/help/stdout.term.svg @@ -69,7 +69,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_doc/help/stdout.term.svg b/tests/testsuite/cargo_doc/help/stdout.term.svg index 2a6633141eb..5afb25b3e24 100644 --- a/tests/testsuite/cargo_doc/help/stdout.term.svg +++ b/tests/testsuite/cargo_doc/help/stdout.term.svg @@ -113,7 +113,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_fetch/help/stdout.term.svg b/tests/testsuite/cargo_fetch/help/stdout.term.svg index 1c574938563..5382eeb966a 100644 --- a/tests/testsuite/cargo_fetch/help/stdout.term.svg +++ b/tests/testsuite/cargo_fetch/help/stdout.term.svg @@ -53,7 +53,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_fix/help/stdout.term.svg b/tests/testsuite/cargo_fix/help/stdout.term.svg index 631790027d5..a6cc617811d 100644 --- a/tests/testsuite/cargo_fix/help/stdout.term.svg +++ b/tests/testsuite/cargo_fix/help/stdout.term.svg @@ -127,7 +127,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_generate_lockfile/help/stdout.term.svg b/tests/testsuite/cargo_generate_lockfile/help/stdout.term.svg index 86dabeea0e8..eb2bc648c1a 100644 --- a/tests/testsuite/cargo_generate_lockfile/help/stdout.term.svg +++ b/tests/testsuite/cargo_generate_lockfile/help/stdout.term.svg @@ -47,7 +47,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages (unstable) diff --git a/tests/testsuite/cargo_metadata/help/stdout.term.svg b/tests/testsuite/cargo_metadata/help/stdout.term.svg index adf9af931bc..d4a373d1106 100644 --- a/tests/testsuite/cargo_metadata/help/stdout.term.svg +++ b/tests/testsuite/cargo_metadata/help/stdout.term.svg @@ -69,7 +69,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_package/help/stdout.term.svg b/tests/testsuite/cargo_package/help/stdout.term.svg index 4df56c16ec9..2d4d5c43ce7 100644 --- a/tests/testsuite/cargo_package/help/stdout.term.svg +++ b/tests/testsuite/cargo_package/help/stdout.term.svg @@ -91,7 +91,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_pkgid/help/stdout.term.svg b/tests/testsuite/cargo_pkgid/help/stdout.term.svg index 2c7f51b9d3c..6ba0cd42113 100644 --- a/tests/testsuite/cargo_pkgid/help/stdout.term.svg +++ b/tests/testsuite/cargo_pkgid/help/stdout.term.svg @@ -59,7 +59,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_publish/help/stdout.term.svg b/tests/testsuite/cargo_publish/help/stdout.term.svg index 1798919f181..0a371de0868 100644 --- a/tests/testsuite/cargo_publish/help/stdout.term.svg +++ b/tests/testsuite/cargo_publish/help/stdout.term.svg @@ -87,7 +87,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_remove/help/stdout.term.svg b/tests/testsuite/cargo_remove/help/stdout.term.svg index 7103b973bb3..163112728fe 100644 --- a/tests/testsuite/cargo_remove/help/stdout.term.svg +++ b/tests/testsuite/cargo_remove/help/stdout.term.svg @@ -71,7 +71,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_run/help/stdout.term.svg b/tests/testsuite/cargo_run/help/stdout.term.svg index 0161d5b8bcc..0e849717cd2 100644 --- a/tests/testsuite/cargo_run/help/stdout.term.svg +++ b/tests/testsuite/cargo_run/help/stdout.term.svg @@ -101,7 +101,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_rustc/help/stdout.term.svg b/tests/testsuite/cargo_rustc/help/stdout.term.svg index 51c837074b7..a2dc2c153f2 100644 --- a/tests/testsuite/cargo_rustc/help/stdout.term.svg +++ b/tests/testsuite/cargo_rustc/help/stdout.term.svg @@ -123,7 +123,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_rustdoc/help/stdout.term.svg b/tests/testsuite/cargo_rustdoc/help/stdout.term.svg index edd94c817f8..f59182d0d85 100644 --- a/tests/testsuite/cargo_rustdoc/help/stdout.term.svg +++ b/tests/testsuite/cargo_rustdoc/help/stdout.term.svg @@ -121,7 +121,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_test/help/stdout.term.svg b/tests/testsuite/cargo_test/help/stdout.term.svg index 66e56fbdee7..4b9ee5e039c 100644 --- a/tests/testsuite/cargo_test/help/stdout.term.svg +++ b/tests/testsuite/cargo_test/help/stdout.term.svg @@ -131,7 +131,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages diff --git a/tests/testsuite/cargo_tree/help/stdout.term.svg b/tests/testsuite/cargo_tree/help/stdout.term.svg index 9fad79aefa8..3956acd30b1 100644 --- a/tests/testsuite/cargo_tree/help/stdout.term.svg +++ b/tests/testsuite/cargo_tree/help/stdout.term.svg @@ -97,7 +97,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged diff --git a/tests/testsuite/cargo_update/help/stdout.term.svg b/tests/testsuite/cargo_update/help/stdout.term.svg index 0323fa6a2bc..c1af52b7c66 100644 --- a/tests/testsuite/cargo_update/help/stdout.term.svg +++ b/tests/testsuite/cargo_update/help/stdout.term.svg @@ -63,7 +63,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --ignore-rust-version Ignore `rust-version` specification in packages (unstable) diff --git a/tests/testsuite/cargo_vendor/help/stdout.term.svg b/tests/testsuite/cargo_vendor/help/stdout.term.svg index 06ebe0cfb06..4b196c12380 100644 --- a/tests/testsuite/cargo_vendor/help/stdout.term.svg +++ b/tests/testsuite/cargo_vendor/help/stdout.term.svg @@ -63,7 +63,7 @@ --manifest-path <PATH> Path to Cargo.toml - --lockfile-path <FILE> Path to Cargo.lock (unstable) + --lockfile-path <PATH> Path to Cargo.lock (unstable) --locked Assert that `Cargo.lock` will remain unchanged From 132ba16779eb2c28d43796a82160ce02348158d1 Mon Sep 17 00:00:00 2001 From: Ifropc Date: Sat, 3 Aug 2024 17:16:45 -0700 Subject: [PATCH 08/12] refactoring: move lock_root into worspace --- src/bin/cargo/commands/fix.rs | 3 ++- src/cargo/core/workspace.rs | 20 ++++++++++++++++++-- src/cargo/ops/cargo_package.rs | 10 +++++----- src/cargo/ops/fix.rs | 5 +++-- src/cargo/ops/lockfile.rs | 20 ++------------------ 5 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/bin/cargo/commands/fix.rs b/src/bin/cargo/commands/fix.rs index 2491548eb9c..443d120d47e 100644 --- a/src/bin/cargo/commands/fix.rs +++ b/src/bin/cargo/commands/fix.rs @@ -79,7 +79,7 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult { ws.set_resolve_honors_rust_version(args.honor_rust_version()); let lockfile_path = lockfile_path(args.get_one::("lockfile-path").map(Path::new), gctx)?; - ws.set_requested_lockfile_path(lockfile_path); + ws.set_requested_lockfile_path(lockfile_path.clone()); let mut opts = args.compile_options(gctx, mode, Some(&ws), ProfileChecking::LegacyTestOnly)?; @@ -92,6 +92,7 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult { gctx, &ws, &root_manifest, + lockfile_path, &mut ops::FixOptions { edition: args.flag("edition"), idioms: args.flag("edition-idioms"), diff --git a/src/cargo/core/workspace.rs b/src/cargo/core/workspace.rs index c254baafcdf..2391d8d603c 100644 --- a/src/cargo/core/workspace.rs +++ b/src/cargo/core/workspace.rs @@ -651,8 +651,24 @@ impl<'gctx> Workspace<'gctx> { self } - pub fn requested_lockfile_path(&self) -> Option<&PathBuf> { - self.requested_lockfile_path.as_ref() + pub fn lock_root(&self) -> Filesystem { + if let Some(requested) = self.requested_lockfile_path.as_ref() { + return Filesystem::new( + requested + .parent() + .unwrap_or_else(|| unreachable!("Lockfile path can't be root")) + .to_owned(), + ); + } + return self.default_lock_root(); + } + + fn default_lock_root(&self) -> Filesystem { + if self.root_maybe().is_embedded() { + self.target_dir() + } else { + Filesystem::new(self.root().to_owned()) + } } pub fn set_requested_lockfile_path(&mut self, path: Option) { diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index cb14dabefa4..f879f764101 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -6,6 +6,7 @@ use std::path::{Path, PathBuf}; use std::sync::Arc; use std::task::Poll; +use super::RegistryOrIndex; use crate::core::compiler::{BuildConfig, CompileMode, DefaultExecutor, Executor}; use crate::core::dependency::DepKind; use crate::core::manifest::Target; @@ -13,6 +14,7 @@ use crate::core::resolver::CliFeatures; use crate::core::resolver::HasDevUnits; use crate::core::{Feature, PackageIdSpecQuery, Shell, Verbosity, Workspace}; use crate::core::{Package, PackageId, PackageSet, Resolve, SourceId}; +use crate::ops::lockfile::LOCKFILE_NAME; use crate::sources::registry::index::{IndexPackage, RegistryDependency}; use crate::sources::{PathSource, SourceConfigMap, CRATES_IO_REGISTRY}; use crate::util::cache_lock::CacheLockMode; @@ -32,8 +34,6 @@ use tar::{Archive, Builder, EntryType, Header, HeaderMode}; use tracing::debug; use unicase::Ascii as UncasedAscii; -use super::RegistryOrIndex; - #[derive(Clone)] pub struct PackageOpts<'gctx> { pub gctx: &'gctx GlobalContext, @@ -248,10 +248,10 @@ pub fn package(ws: &Workspace<'_>, opts: &PackageOpts<'_>) -> CargoResult, root_manifest: &Path, + requested_lockfile_path: Option, opts: &mut FixOptions, ) -> CargoResult<()> { check_version_control(gctx, opts)?; @@ -121,8 +122,8 @@ pub fn fix( } let mut ws = Workspace::new(&root_manifest, gctx)?; ws.set_resolve_honors_rust_version(Some(original_ws.resolve_honors_rust_version())); - if let Some(p) = original_ws.requested_lockfile_path() { - ws.set_requested_lockfile_path(Some(p.clone())) + if let Some(p) = requested_lockfile_path { + ws.set_requested_lockfile_path(Some(p)) } // Spin up our lock server, which our subprocesses will use to synchronize fixes. diff --git a/src/cargo/ops/lockfile.rs b/src/cargo/ops/lockfile.rs index 51bdffab6c6..42a0d61b39d 100644 --- a/src/cargo/ops/lockfile.rs +++ b/src/cargo/ops/lockfile.rs @@ -10,7 +10,7 @@ pub const LOCKFILE_NAME: &str = "Cargo.lock"; #[tracing::instrument(skip_all)] pub fn load_pkg_lockfile(ws: &Workspace<'_>) -> CargoResult> { - let lock_root = lock_root(ws); + let lock_root = ws.lock_root(); if !lock_root.as_path_unlocked().join(LOCKFILE_NAME).exists() { return Ok(None); } @@ -106,7 +106,7 @@ fn resolve_to_string_orig( resolve: &Resolve, ) -> (Option, String, Filesystem) { // Load the original lock file if it exists. - let lock_root = lock_root(ws); + let lock_root = ws.lock_root(); let orig = lock_root.open_ro_shared(LOCKFILE_NAME, ws.gctx(), "Cargo.lock file"); let orig = orig.and_then(|mut f| { let mut s = String::new(); @@ -247,19 +247,3 @@ fn emit_package(dep: &toml::Table, out: &mut String) { out.push_str(&format!("replace = {}\n\n", &dep["replace"])); } } - -fn lock_root(ws: &Workspace<'_>) -> Filesystem { - if let Some(requested) = ws.requested_lockfile_path() { - return Filesystem::new( - requested - .parent() - .unwrap_or_else(|| unreachable!("Lockfile path can't be root")) - .to_owned(), - ); - } - if ws.root_maybe().is_embedded() { - ws.target_dir() - } else { - Filesystem::new(ws.root().to_owned()) - } -} From d18c60d44fc371f1b8d207775a8e33803810c80d Mon Sep 17 00:00:00 2001 From: Ifropc Date: Thu, 8 Aug 2024 23:12:31 -0700 Subject: [PATCH 09/12] feat lockfile-path and related tests refactoring --- src/bin/cargo/commands/fix.rs | 6 +- src/cargo/core/workspace.rs | 5 +- src/cargo/ops/fix.rs | 6 +- src/cargo/util/command_prelude.rs | 2 +- tests/testsuite/lockfile_path.rs | 183 ++++++++++++++++++------------ 5 files changed, 121 insertions(+), 81 deletions(-) diff --git a/src/bin/cargo/commands/fix.rs b/src/bin/cargo/commands/fix.rs index 443d120d47e..e44980d1330 100644 --- a/src/bin/cargo/commands/fix.rs +++ b/src/bin/cargo/commands/fix.rs @@ -1,6 +1,5 @@ use crate::command_prelude::*; use cargo::core::Workspace; -use std::path::Path; use cargo::ops; @@ -77,8 +76,7 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult { // Can't use workspace() to avoid using -Zavoid-dev-deps (if passed) let mut ws = Workspace::new(&root_manifest, gctx)?; ws.set_resolve_honors_rust_version(args.honor_rust_version()); - let lockfile_path = - lockfile_path(args.get_one::("lockfile-path").map(Path::new), gctx)?; + let lockfile_path = args.lockfile_path(gctx)?; ws.set_requested_lockfile_path(lockfile_path.clone()); let mut opts = args.compile_options(gctx, mode, Some(&ws), ProfileChecking::LegacyTestOnly)?; @@ -92,7 +90,6 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult { gctx, &ws, &root_manifest, - lockfile_path, &mut ops::FixOptions { edition: args.flag("edition"), idioms: args.flag("edition-idioms"), @@ -101,6 +98,7 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult { allow_no_vcs: args.flag("allow-no-vcs"), allow_staged: args.flag("allow-staged"), broken_code: args.flag("broken-code"), + requested_lockfile_path: lockfile_path, }, )?; Ok(()) diff --git a/src/cargo/core/workspace.rs b/src/cargo/core/workspace.rs index 2391d8d603c..6f1770b0f72 100644 --- a/src/cargo/core/workspace.rs +++ b/src/cargo/core/workspace.rs @@ -651,16 +651,17 @@ impl<'gctx> Workspace<'gctx> { self } + /// Returns the directory where the lockfile is in. pub fn lock_root(&self) -> Filesystem { if let Some(requested) = self.requested_lockfile_path.as_ref() { return Filesystem::new( requested .parent() - .unwrap_or_else(|| unreachable!("Lockfile path can't be root")) + .expect("Lockfile path can't be root") .to_owned(), ); } - return self.default_lock_root(); + self.default_lock_root() } fn default_lock_root(&self) -> Filesystem { diff --git a/src/cargo/ops/fix.rs b/src/cargo/ops/fix.rs index 2b39190c547..6890c44be72 100644 --- a/src/cargo/ops/fix.rs +++ b/src/cargo/ops/fix.rs @@ -97,13 +97,13 @@ pub struct FixOptions { pub allow_no_vcs: bool, pub allow_staged: bool, pub broken_code: bool, + pub requested_lockfile_path: Option, } pub fn fix( gctx: &GlobalContext, original_ws: &Workspace<'_>, root_manifest: &Path, - requested_lockfile_path: Option, opts: &mut FixOptions, ) -> CargoResult<()> { check_version_control(gctx, opts)?; @@ -122,9 +122,7 @@ pub fn fix( } let mut ws = Workspace::new(&root_manifest, gctx)?; ws.set_resolve_honors_rust_version(Some(original_ws.resolve_honors_rust_version())); - if let Some(p) = requested_lockfile_path { - ws.set_requested_lockfile_path(Some(p)) - } + ws.set_requested_lockfile_path(opts.requested_lockfile_path.clone()); // Spin up our lock server, which our subprocesses will use to synchronize fixes. let lock_server = LockServer::new()?; diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index 33c57b7b57d..6dc8a5fffa7 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -1014,7 +1014,7 @@ pub fn lockfile_path( let path = gctx.cwd().join(lockfile_path); - if !path.ends_with(LOCKFILE_NAME) && !crate::util::toml::is_embedded(&path) { + if !path.ends_with(LOCKFILE_NAME) { bail!("the lockfile-path must be a path to a {LOCKFILE_NAME} file") } if path.is_dir() { diff --git a/tests/testsuite/lockfile_path.rs b/tests/testsuite/lockfile_path.rs index 470672ca22c..b52b14a7b09 100644 --- a/tests/testsuite/lockfile_path.rs +++ b/tests/testsuite/lockfile_path.rs @@ -1,11 +1,11 @@ //! Tests for `lockfile-path` flag -use std::fs; - use cargo_test_support::registry::RegistryBuilder; use cargo_test_support::{ basic_bin_manifest, cargo_test, project, symlink_supported, Execs, ProjectBuilder, }; +use snapbox::str; +use std::fs; const VALID_LOCKFILE: &str = r#"# Test lockfile version = 3 @@ -30,7 +30,7 @@ fn make_basic_project() -> ProjectBuilder { fn make_basic_command(execs: &mut Execs, lockfile_path_argument: String) -> &mut Execs { return execs - .masquerade_as_nightly_cargo(&["unstable-options"]) + .masquerade_as_nightly_cargo(&["lockfile-path"]) .arg("-Zunstable-options") .arg("--lockfile-path") .arg(lockfile_path_argument); @@ -40,9 +40,9 @@ fn lockfile_must_exist(command: &str) -> bool { return command == "pkgid" || command == "publish" || command == "package"; } -fn assert_lockfile_created( +fn lockfile_created( command: &str, - make_execs: impl Fn(&mut Execs, String) -> &mut Execs, + make_execs: &dyn Fn(&mut Execs, String) -> &mut Execs, make_project: impl FnOnce() -> ProjectBuilder, ) { if lockfile_must_exist(command) { @@ -56,13 +56,13 @@ fn assert_lockfile_created( make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) .replace_crates_io(registry.index_url()) .run(); - assert!(!p.root().join("Cargo.lock").is_file()); + assert!(!p.root().join("Cargo.lock").exists()); assert!(p.root().join(lockfile_path_argument).is_file()); } -fn assert_lockfile_read( +fn lockfile_read( command: &str, - make_execs: impl Fn(&mut Execs, String) -> &mut Execs, + make_execs: &dyn Fn(&mut Execs, String) -> &mut Execs, make_project: impl FnOnce() -> ProjectBuilder, ) { let lockfile_path_argument = "mylockfile/Cargo.lock"; @@ -75,13 +75,13 @@ fn assert_lockfile_read( .replace_crates_io(registry.index_url()) .run(); - assert!(!p.root().join("Cargo.lock").is_file()); + assert!(!p.root().join("Cargo.lock").exists()); assert!(p.root().join(lockfile_path_argument).is_file()); } -fn assert_lockfile_override( +fn lockfile_override( command: &str, - make_execs: impl Fn(&mut Execs, String) -> &mut Execs, + make_execs: &dyn Fn(&mut Execs, String) -> &mut Execs, make_project: impl FnOnce() -> ProjectBuilder, ) { if lockfile_must_exist(command) { @@ -101,9 +101,9 @@ fn assert_lockfile_override( assert!(p.root().join(lockfile_path_argument).is_file()); } -fn assert_symlink_in_path( +fn symlink_in_path( command: &str, - make_execs: impl Fn(&mut Execs, String) -> &mut Execs, + make_execs: &dyn Fn(&mut Execs, String) -> &mut Execs, make_project: impl FnOnce() -> ProjectBuilder, ) { if !symlink_supported() || lockfile_must_exist(command) { @@ -130,9 +130,9 @@ fn assert_symlink_in_path( assert!(p.root().join(dst).join("Cargo.lock").is_file()); } -fn assert_symlink_lockfile( +fn symlink_lockfile( command: &str, - make_execs: impl Fn(&mut Execs, String) -> &mut Execs, + make_execs: &dyn Fn(&mut Execs, String) -> &mut Execs, make_project: impl FnOnce() -> ProjectBuilder, ) { if !symlink_supported() { @@ -155,12 +155,12 @@ fn assert_symlink_lockfile( .replace_crates_io(registry.index_url()) .run(); - assert!(!p.root().join("Cargo.lock").is_file()); + assert!(!p.root().join("Cargo.lock").exists()); } -fn assert_broken_symlink( +fn broken_symlink( command: &str, - make_execs: impl Fn(&mut Execs, String) -> &mut Execs, + make_execs: &dyn Fn(&mut Execs, String) -> &mut Execs, make_project: impl FnOnce() -> ProjectBuilder, ) { if !symlink_supported() { @@ -176,28 +176,29 @@ fn assert_broken_symlink( let registry = RegistryBuilder::new().http_api().http_index().build(); let err_msg = if !cfg!(windows) { - "File exists (os error 17)" + str![[r#"[ERROR] failed to create directory `somedir/link` + +Caused by: + File exists (os error 17) +"#]] } else { - "Cannot create a file when that file already exists. (os error 183)" + str![[r#"[ERROR] failed to create directory `somedir/link` + +Caused by: + Cannot create a file when that file already exists. (os error 183) +"#]] }; make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) .with_status(101) - .with_stderr_data(&format!( - r#"[ERROR] failed to create directory `somedir/link` - -Caused by: - {} -"#, - err_msg - )) + .with_stderr_data(err_msg) .replace_crates_io(registry.index_url()) .run(); } -fn assert_loop_symlink( +fn loop_symlink( command: &str, - make_execs: impl Fn(&mut Execs, String) -> &mut Execs, + make_execs: &dyn Fn(&mut Execs, String) -> &mut Execs, make_project: impl FnOnce() -> ProjectBuilder, ) { if !symlink_supported() { @@ -215,22 +216,23 @@ fn assert_loop_symlink( assert!(!p.root().join(src).is_dir()); let registry = RegistryBuilder::new().http_api().http_index().build(); - let err_msg = if cfg!(windows) { - "Cannot create a file when that file already exists. (os error 183)" + let err_msg = if !cfg!(windows) { + str![[r#"[ERROR] failed to create directory `somedir/link` + +Caused by: + "Cannot create a file when that file already exists. (os error 183)" +"#]] } else { - "File exists (os error 17)" + str![[r#"[ERROR] failed to create directory `somedir/link` + +Caused by: + "File exists (os error 17)" +"#]] }; make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) .with_status(101) - .with_stderr_data(&format!( - r#"[ERROR] failed to create directory `somedir/link` - -Caused by: - {} -"#, - err_msg - )) + .with_stderr_data(err_msg) .replace_crates_io(registry.index_url()) .run(); } @@ -245,45 +247,45 @@ macro_rules! tests { mod $name { use super::*; - #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + #[cargo_test] fn test_lockfile_created() { - assert_lockfile_created($cmd_name, $make_command, $setup_test); + lockfile_created($cmd_name, $make_command, $setup_test); } - #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + #[cargo_test] fn test_lockfile_read() { - assert_lockfile_read($cmd_name, $make_command, $setup_test); + lockfile_read($cmd_name, $make_command, $setup_test); } - #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + #[cargo_test] fn test_lockfile_override() { - assert_lockfile_override($cmd_name, $make_command, $setup_test); + lockfile_override($cmd_name, $make_command, $setup_test); } - #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + #[cargo_test] fn test_symlink_in_path() { - assert_symlink_in_path($cmd_name, $make_command, $setup_test); + symlink_in_path($cmd_name, $make_command, $setup_test); } - #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + #[cargo_test] fn test_symlink_lockfile() { - assert_symlink_lockfile($cmd_name, $make_command, $setup_test); + symlink_lockfile($cmd_name, $make_command, $setup_test); } - #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + #[cargo_test] fn test_broken_symlink() { - assert_broken_symlink($cmd_name, $make_command, $setup_test); + broken_symlink($cmd_name, $make_command, $setup_test); } - #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + #[cargo_test] fn test_loop_symlink() { - assert_loop_symlink($cmd_name, $make_command, $setup_test); + loop_symlink($cmd_name, $make_command, $setup_test); } } }; ($name: ident, $cmd_name:expr) => { - tests!($name, $cmd_name, make_basic_command, make_basic_project); + tests!($name, $cmd_name, &make_basic_command, make_basic_project); }; } @@ -313,13 +315,21 @@ fn make_fix_command(execs: &mut Execs, lockfile_path_argument: String) -> &mut E } fn make_remove_project() -> ProjectBuilder { - let mut manifest = basic_bin_manifest("test_foo"); - manifest.push_str( - r#"# -[dependencies] -test_bar = { version = "0.1.0", path = "../bar" } -"#, - ); + let manifest = r#" + [package] + + name = "foo" + version = "0.5.0" + authors = ["wycats@example.com"] + edition = "2015" + + [[bin]] + + name = "foo" + + [dependencies] + test_bar = { version = "0.1.0", path = "../bar" } + "#; return project() .file("Cargo.toml", &manifest) @@ -332,20 +342,20 @@ fn make_remove_command(execs: &mut Execs, lockfile_path_argument: String) -> &mu return make_basic_command(execs, lockfile_path_argument).arg("test_bar"); } -tests!(add, "add", make_add_command, make_add_project); +tests!(add, "add", &make_add_command, make_add_project); tests!(bench, "bench"); tests!(build, "build"); tests!(check, "check"); -tests!(clean, "clean", make_clean_command, make_basic_project); +tests!(clean, "clean", &make_clean_command, make_basic_project); tests!(doc, "doc"); tests!(fetch, "fetch"); -tests!(fix, "fix", make_fix_command, make_basic_project); +tests!(fix, "fix", &make_fix_command, make_basic_project); tests!(generate_lockfile, "generate-lockfile"); tests!(metadata, "metadata"); tests!(package, "package"); tests!(pkgid, "pkgid"); tests!(publish, "publish"); -tests!(remove, "remove", make_remove_command, make_remove_project); +tests!(remove, "remove", &make_remove_command, make_remove_project); tests!(run, "run"); tests!(rustc, "rustc"); tests!(rustdoc, "rustdoc"); @@ -357,10 +367,11 @@ tests!(vendor, "vendor"); #[cfg(test)] mod package_extra { use crate::lockfile_path::make_basic_command; + use cargo_test_support::compare::assert_e2e; use cargo_test_support::{cargo_test, project}; use std::fs; - #[cargo_test(nightly, reason = "--lockfile-path is unstable")] + #[cargo_test] fn assert_respect_pinned_version_from_lockfile_path() { const PINNED_VERSION: &str = r#"# This file is automatically @generated by Cargo. # It is not intended for manual editing. @@ -404,7 +415,7 @@ hello = "1.0.0" make_basic_command(&mut p.cargo("package"), lockfile_path_argument.to_string()).run(); - assert!(!p.root().join("Cargo.lock").is_file()); + assert!(!p.root().join("Cargo.lock").exists()); assert!(p.root().join(lockfile_path_argument).is_file()); assert!(p @@ -415,6 +426,38 @@ hello = "1.0.0" let path = p.root().join("target/package/test_foo-0.5.0/Cargo.lock"); let contents = fs::read_to_string(path).unwrap(); - assert_eq!(contents, PINNED_VERSION); + assert_e2e().eq(contents, PINNED_VERSION); + } + + #[cargo_test] + fn run_embed() { + const ECHO_SCRIPT: &str = r#"#!/usr/bin/env cargo + +fn main() { + let mut args = std::env::args_os(); + let bin = args.next().unwrap().to_str().unwrap().to_owned(); + let args = args.collect::>(); + println!("bin: {bin}"); + println!("args: {args:?}"); +} + +#[test] +fn test () {} +"#; + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = project().file("src/main.rs", ECHO_SCRIPT).build(); + + p.cargo("run") + .masquerade_as_nightly_cargo(&["lockfile-path"]) + .arg("-Zunstable-options") + .arg("-Zscript") + .arg("--lockfile-path") + .arg(lockfile_path_argument) + .arg("--manifest-path") + .arg("src/main.rs") + .run(); + + assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(!p.root().join("Cargo.lock").exists()); } } From c1ace2ad814dd9ec2b73b5310c9f3637d67b9096 Mon Sep 17 00:00:00 2001 From: Ifropc Date: Tue, 13 Aug 2024 22:21:02 -0700 Subject: [PATCH 10/12] lockfile path tests refactoring --- tests/testsuite/lockfile_path.rs | 463 +++++++++++++++++-------------- 1 file changed, 249 insertions(+), 214 deletions(-) diff --git a/tests/testsuite/lockfile_path.rs b/tests/testsuite/lockfile_path.rs index b52b14a7b09..3a6854d0376 100644 --- a/tests/testsuite/lockfile_path.rs +++ b/tests/testsuite/lockfile_path.rs @@ -1,8 +1,9 @@ //! Tests for `lockfile-path` flag +use cargo_test_support::compare::assert_e2e; use cargo_test_support::registry::RegistryBuilder; use cargo_test_support::{ - basic_bin_manifest, cargo_test, project, symlink_supported, Execs, ProjectBuilder, + basic_bin_manifest, cargo_test, project, symlink_supported, Execs, Project, ProjectBuilder, }; use snapbox::str; use std::fs; @@ -22,13 +23,13 @@ const LIB_TOML: &str = r#" edition = "2021" "#; -fn make_basic_project() -> ProjectBuilder { +fn make_project() -> ProjectBuilder { return project() .file("Cargo.toml", &basic_bin_manifest("test_foo")) .file("src/main.rs", "fn main() {}"); } -fn make_basic_command(execs: &mut Execs, lockfile_path_argument: String) -> &mut Execs { +fn make_execs(execs: &mut Execs, lockfile_path_argument: String) -> &mut Execs { return execs .masquerade_as_nightly_cargo(&["lockfile-path"]) .arg("-Zunstable-options") @@ -36,77 +37,48 @@ fn make_basic_command(execs: &mut Execs, lockfile_path_argument: String) -> &mut .arg(lockfile_path_argument); } -fn lockfile_must_exist(command: &str) -> bool { - return command == "pkgid" || command == "publish" || command == "package"; -} - -fn lockfile_created( - command: &str, - make_execs: &dyn Fn(&mut Execs, String) -> &mut Execs, - make_project: impl FnOnce() -> ProjectBuilder, -) { - if lockfile_must_exist(command) { - return; - } - +#[cargo_test] +fn basic_lockfile_created() { let lockfile_path_argument = "mylockfile/is/burried/Cargo.lock"; let p = make_project().build(); - let registry = RegistryBuilder::new().http_api().http_index().build(); - make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) - .replace_crates_io(registry.index_url()) - .run(); + make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()).run(); assert!(!p.root().join("Cargo.lock").exists()); assert!(p.root().join(lockfile_path_argument).is_file()); } -fn lockfile_read( - command: &str, - make_execs: &dyn Fn(&mut Execs, String) -> &mut Execs, - make_project: impl FnOnce() -> ProjectBuilder, -) { +#[cargo_test] +fn basic_lockfile_read() { let lockfile_path_argument = "mylockfile/Cargo.lock"; let p = make_project() .file("mylockfile/Cargo.lock", VALID_LOCKFILE) .build(); - let registry = RegistryBuilder::new().http_api().http_index().build(); - make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) - .replace_crates_io(registry.index_url()) - .run(); + make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()).run(); assert!(!p.root().join("Cargo.lock").exists()); assert!(p.root().join(lockfile_path_argument).is_file()); } -fn lockfile_override( - command: &str, - make_execs: &dyn Fn(&mut Execs, String) -> &mut Execs, - make_project: impl FnOnce() -> ProjectBuilder, -) { - if lockfile_must_exist(command) { - return; - } - +#[cargo_test] +fn basic_lockfile_override() { let lockfile_path_argument = "mylockfile/Cargo.lock"; let p = make_project() .file("Cargo.lock", "This is an invalid lock file!") .build(); - let registry = RegistryBuilder::new().http_api().http_index().build(); - make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) - .replace_crates_io(registry.index_url()) - .run(); + make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()).run(); assert!(p.root().join(lockfile_path_argument).is_file()); } -fn symlink_in_path( - command: &str, - make_execs: &dyn Fn(&mut Execs, String) -> &mut Execs, - make_project: impl FnOnce() -> ProjectBuilder, -) { - if !symlink_supported() || lockfile_must_exist(command) { +////////////////////// +///// Symlink tests +////////////////////// + +#[cargo_test] +fn symlink_in_path() { + if !symlink_supported() { return; } @@ -115,26 +87,20 @@ fn symlink_in_path( let lockfile_path_argument = format!("{src}/Cargo.lock"); let p = make_project().symlink_dir(dst, src).build(); - let registry = RegistryBuilder::new().http_api().http_index().build(); fs::create_dir(p.root().join("dst")) .unwrap_or_else(|e| panic!("could not create directory {}", e)); assert!(p.root().join(src).is_dir()); - make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) - .replace_crates_io(registry.index_url()) - .run(); + make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()).run(); assert!(p.root().join(format!("{src}/Cargo.lock")).is_file()); assert!(p.root().join(lockfile_path_argument).is_file()); assert!(p.root().join(dst).join("Cargo.lock").is_file()); } -fn symlink_lockfile( - command: &str, - make_execs: &dyn Fn(&mut Execs, String) -> &mut Execs, - make_project: impl FnOnce() -> ProjectBuilder, -) { +#[cargo_test] +fn symlink_lockfile() { if !symlink_supported() { return; } @@ -147,22 +113,16 @@ fn symlink_lockfile( .file(lockfile_path_argument, lock_body) .symlink(lockfile_path_argument, src) .build(); - let registry = RegistryBuilder::new().http_api().http_index().build(); assert!(p.root().join(src).is_file()); - make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) - .replace_crates_io(registry.index_url()) - .run(); + make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()).run(); assert!(!p.root().join("Cargo.lock").exists()); } -fn broken_symlink( - command: &str, - make_execs: &dyn Fn(&mut Execs, String) -> &mut Execs, - make_project: impl FnOnce() -> ProjectBuilder, -) { +#[cargo_test] +fn broken_symlink() { if !symlink_supported() { return; } @@ -173,34 +133,31 @@ fn broken_symlink( let p = make_project().symlink_dir(invalid_dst, src).build(); assert!(!p.root().join(src).is_dir()); - let registry = RegistryBuilder::new().http_api().http_index().build(); let err_msg = if !cfg!(windows) { str![[r#"[ERROR] failed to create directory `somedir/link` Caused by: File exists (os error 17) + "#]] } else { str![[r#"[ERROR] failed to create directory `somedir/link` Caused by: Cannot create a file when that file already exists. (os error 183) + "#]] }; - make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) + make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()) .with_status(101) .with_stderr_data(err_msg) - .replace_crates_io(registry.index_url()) .run(); } -fn loop_symlink( - command: &str, - make_execs: &dyn Fn(&mut Execs, String) -> &mut Execs, - make_project: impl FnOnce() -> ProjectBuilder, -) { +#[cargo_test] +fn loop_symlink() { if !symlink_supported() { return; } @@ -214,104 +171,178 @@ fn loop_symlink( .symlink_dir(src, loop_link) .build(); assert!(!p.root().join(src).is_dir()); - let registry = RegistryBuilder::new().http_api().http_index().build(); let err_msg = if !cfg!(windows) { str![[r#"[ERROR] failed to create directory `somedir/link` Caused by: - "Cannot create a file when that file already exists. (os error 183)" + File exists (os error 17) + "#]] } else { str![[r#"[ERROR] failed to create directory `somedir/link` Caused by: - "File exists (os error 17)" + Cannot create a file when that file already exists. (os error 183) + "#]] }; - make_execs(&mut p.cargo(command), lockfile_path_argument.to_string()) + make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()) .with_status(101) .with_stderr_data(err_msg) - .replace_crates_io(registry.index_url()) .run(); } -///////////////////// -//// Generic tests -///////////////////// - -macro_rules! tests { - ($name: ident, $cmd_name:expr, $make_command:expr, $setup_test:expr) => { - #[cfg(test)] - mod $name { - use super::*; - - #[cargo_test] - fn test_lockfile_created() { - lockfile_created($cmd_name, $make_command, $setup_test); - } - - #[cargo_test] - fn test_lockfile_read() { - lockfile_read($cmd_name, $make_command, $setup_test); - } - - #[cargo_test] - fn test_lockfile_override() { - lockfile_override($cmd_name, $make_command, $setup_test); - } - - #[cargo_test] - fn test_symlink_in_path() { - symlink_in_path($cmd_name, $make_command, $setup_test); - } - - #[cargo_test] - fn test_symlink_lockfile() { - symlink_lockfile($cmd_name, $make_command, $setup_test); - } - - #[cargo_test] - fn test_broken_symlink() { - broken_symlink($cmd_name, $make_command, $setup_test); - } - - #[cargo_test] - fn test_loop_symlink() { - loop_symlink($cmd_name, $make_command, $setup_test); - } - } - }; - - ($name: ident, $cmd_name:expr) => { - tests!($name, $cmd_name, &make_basic_command, make_basic_project); - }; -} - -fn make_add_command(execs: &mut Execs, lockfile_path_argument: String) -> &mut Execs { - return make_basic_command(execs, lockfile_path_argument) +fn run_add_command(p: &Project, lockfile_path_argument: String) { + make_execs(&mut p.cargo("add"), lockfile_path_argument) .arg("--path") - .arg("../bar"); + .arg("../bar") + .run(); } fn make_add_project() -> ProjectBuilder { - return make_basic_project() + return make_project() .file("../bar/Cargo.toml", LIB_TOML) .file("../bar/src/main.rs", "fn main() {}"); } -fn make_clean_command(execs: &mut Execs, lockfile_path_argument: String) -> &mut Execs { - return make_basic_command(execs, lockfile_path_argument) +///////////////////////// +//// Commands tests +///////////////////////// + +#[cargo_test] +fn add_lockfile_created() { + let lockfile_path_argument = "mylockfile/is/burried/Cargo.lock"; + let p = make_add_project().build(); + run_add_command(&p, lockfile_path_argument.to_string()); + + assert!(!p.root().join("Cargo.lock").exists()); + assert!(p.root().join(lockfile_path_argument).is_file()); +} + +#[cargo_test] +fn add_lockfile_read() { + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = make_add_project() + .file("mylockfile/Cargo.lock", VALID_LOCKFILE) + .build(); + run_add_command(&p, lockfile_path_argument.to_string()); + + assert!(!p.root().join("Cargo.lock").exists()); + assert!(p.root().join(lockfile_path_argument).is_file()); +} + +#[cargo_test] +fn add_lockfile_override() { + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = make_add_project() + .file("Cargo.lock", "This is an invalid lock file!") + .build(); + run_add_command(&p, lockfile_path_argument.to_string()); + + assert!(p.root().join(lockfile_path_argument).is_file()); +} + +fn run_clean_command(p: &Project, lockfile_path_argument: String) { + make_execs(&mut p.cargo("clean"), lockfile_path_argument) .arg("--package") - .arg("test_foo"); + .arg("test_foo") + .run(); } -fn make_fix_command(execs: &mut Execs, lockfile_path_argument: String) -> &mut Execs { - return make_basic_command(execs, lockfile_path_argument) +#[cargo_test] +fn clean_lockfile_created() { + let lockfile_path_argument = "mylockfile/is/burried/Cargo.lock"; + let p = make_project().build(); + run_clean_command(&p, lockfile_path_argument.to_string()); + + assert!(!p.root().join("Cargo.lock").exists()); + assert!(p.root().join(lockfile_path_argument).is_file()); +} + +#[cargo_test] +fn clean_lockfile_read() { + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = make_project() + .file("mylockfile/Cargo.lock", VALID_LOCKFILE) + .build(); + run_clean_command(&p, lockfile_path_argument.to_string()); + + assert!(!p.root().join("Cargo.lock").exists()); + assert!(p.root().join(lockfile_path_argument).is_file()); +} + +#[cargo_test] +fn clean_lockfile_override() { + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = make_project() + .file("Cargo.lock", "This is an invalid lock file!") + .build(); + run_clean_command(&p, lockfile_path_argument.to_string()); + + assert!(p.root().join(lockfile_path_argument).is_file()); +} + +fn run_fix_command(p: &Project, lockfile_path_argument: String) { + make_execs(&mut p.cargo("fix"), lockfile_path_argument) .arg("--package") .arg("test_foo") - .arg("--allow-no-vcs"); + .arg("--allow-no-vcs") + .run(); +} + +#[cargo_test] +fn fix_lockfile_created() { + let lockfile_path_argument = "mylockfile/is/burried/Cargo.lock"; + let p = make_project().build(); + run_fix_command(&p, lockfile_path_argument.to_string()); + + assert!(!p.root().join("Cargo.lock").exists()); + assert!(p.root().join(lockfile_path_argument).is_file()); +} + +#[cargo_test] +fn fix_lockfile_read() { + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = make_project() + .file("mylockfile/Cargo.lock", VALID_LOCKFILE) + .build(); + run_fix_command(&p, lockfile_path_argument.to_string()); + + assert!(!p.root().join("Cargo.lock").exists()); + assert!(p.root().join(lockfile_path_argument).is_file()); +} + +#[cargo_test] +fn fix_lockfile_override() { + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = make_project() + .file("Cargo.lock", "This is an invalid lock file!") + .build(); + run_fix_command(&p, lockfile_path_argument.to_string()); + + assert!(p.root().join(lockfile_path_argument).is_file()); +} + +fn run_publish_command(p: &Project, lockfile_path_argument: String) { + let registry = RegistryBuilder::new().http_api().http_index().build(); + + make_execs(&mut p.cargo("publish"), lockfile_path_argument) + .replace_crates_io(registry.index_url()) + .run(); +} + +#[cargo_test] +fn publish_lockfile_read() { + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = make_project() + .file("mylockfile/Cargo.lock", VALID_LOCKFILE) + .build(); + run_publish_command(&p, lockfile_path_argument.to_string()); + + assert!(!p.root().join("Cargo.lock").exists()); + assert!(p.root().join(lockfile_path_argument).is_file()); } fn make_remove_project() -> ProjectBuilder { @@ -338,42 +369,47 @@ fn make_remove_project() -> ProjectBuilder { .file("../bar/src/main.rs", "fn main() {}"); } -fn make_remove_command(execs: &mut Execs, lockfile_path_argument: String) -> &mut Execs { - return make_basic_command(execs, lockfile_path_argument).arg("test_bar"); -} - -tests!(add, "add", &make_add_command, make_add_project); -tests!(bench, "bench"); -tests!(build, "build"); -tests!(check, "check"); -tests!(clean, "clean", &make_clean_command, make_basic_project); -tests!(doc, "doc"); -tests!(fetch, "fetch"); -tests!(fix, "fix", &make_fix_command, make_basic_project); -tests!(generate_lockfile, "generate-lockfile"); -tests!(metadata, "metadata"); -tests!(package, "package"); -tests!(pkgid, "pkgid"); -tests!(publish, "publish"); -tests!(remove, "remove", &make_remove_command, make_remove_project); -tests!(run, "run"); -tests!(rustc, "rustc"); -tests!(rustdoc, "rustdoc"); -tests!(test, "test"); -tests!(tree, "tree"); -tests!(update, "update"); -tests!(vendor, "vendor"); - -#[cfg(test)] -mod package_extra { - use crate::lockfile_path::make_basic_command; - use cargo_test_support::compare::assert_e2e; - use cargo_test_support::{cargo_test, project}; - use std::fs; - - #[cargo_test] - fn assert_respect_pinned_version_from_lockfile_path() { - const PINNED_VERSION: &str = r#"# This file is automatically @generated by Cargo. +fn run_remove_command(p: &Project, lockfile_path_argument: String) { + make_execs(&mut p.cargo("remove"), lockfile_path_argument) + .arg("test_bar") + .run(); +} +#[cargo_test] +fn remove_lockfile_created() { + let lockfile_path_argument = "mylockfile/is/burried/Cargo.lock"; + let p = make_remove_project().build(); + run_remove_command(&p, lockfile_path_argument.to_string()); + + assert!(!p.root().join("Cargo.lock").exists()); + assert!(p.root().join(lockfile_path_argument).is_file()); +} + +#[cargo_test] +fn remove_lockfile_read() { + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = make_remove_project() + .file("mylockfile/Cargo.lock", VALID_LOCKFILE) + .build(); + run_remove_command(&p, lockfile_path_argument.to_string()); + + assert!(!p.root().join("Cargo.lock").exists()); + assert!(p.root().join(lockfile_path_argument).is_file()); +} + +#[cargo_test] +fn remove_lockfile_override() { + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = make_remove_project() + .file("Cargo.lock", "This is an invalid lock file!") + .build(); + run_remove_command(&p, lockfile_path_argument.to_string()); + + assert!(p.root().join(lockfile_path_argument).is_file()); +} + +#[cargo_test] +fn assert_respect_pinned_version_from_lockfile_path() { + const PINNED_VERSION: &str = r#"# This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 @@ -390,7 +426,7 @@ dependencies = [ "hello", ] "#; - const TOML: &str = r#"# + const TOML: &str = r#"# [package] name = "test_foo" @@ -406,32 +442,32 @@ name = "test_foo" hello = "1.0.0" "#; - let lockfile_path_argument = "mylockfile/Cargo.lock"; - let p = project() - .file("Cargo.toml", TOML) - .file("src/main.rs", "fn main() {}") - .file("mylockfile/Cargo.lock", PINNED_VERSION) - .build(); + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = project() + .file("Cargo.toml", TOML) + .file("src/main.rs", "fn main() {}") + .file("mylockfile/Cargo.lock", PINNED_VERSION) + .build(); - make_basic_command(&mut p.cargo("package"), lockfile_path_argument.to_string()).run(); + make_execs(&mut p.cargo("package"), lockfile_path_argument.to_string()).run(); - assert!(!p.root().join("Cargo.lock").exists()); - assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(!p.root().join("Cargo.lock").exists()); + assert!(p.root().join(lockfile_path_argument).is_file()); - assert!(p - .root() - .join("target/package/test_foo-0.5.0/Cargo.lock") - .is_file()); + assert!(p + .root() + .join("target/package/test_foo-0.5.0/Cargo.lock") + .is_file()); - let path = p.root().join("target/package/test_foo-0.5.0/Cargo.lock"); - let contents = fs::read_to_string(path).unwrap(); + let path = p.root().join("target/package/test_foo-0.5.0/Cargo.lock"); + let contents = fs::read_to_string(path).unwrap(); - assert_e2e().eq(contents, PINNED_VERSION); - } + assert_e2e().eq(contents, PINNED_VERSION); +} - #[cargo_test] - fn run_embed() { - const ECHO_SCRIPT: &str = r#"#!/usr/bin/env cargo +#[cargo_test] +fn run_embed() { + const ECHO_SCRIPT: &str = r#"#!/usr/bin/env cargo fn main() { let mut args = std::env::args_os(); @@ -444,20 +480,19 @@ fn main() { #[test] fn test () {} "#; - let lockfile_path_argument = "mylockfile/Cargo.lock"; - let p = project().file("src/main.rs", ECHO_SCRIPT).build(); - - p.cargo("run") - .masquerade_as_nightly_cargo(&["lockfile-path"]) - .arg("-Zunstable-options") - .arg("-Zscript") - .arg("--lockfile-path") - .arg(lockfile_path_argument) - .arg("--manifest-path") - .arg("src/main.rs") - .run(); - - assert!(p.root().join(lockfile_path_argument).is_file()); - assert!(!p.root().join("Cargo.lock").exists()); - } + let lockfile_path_argument = "mylockfile/Cargo.lock"; + let p = project().file("src/main.rs", ECHO_SCRIPT).build(); + + p.cargo("run") + .masquerade_as_nightly_cargo(&["lockfile-path"]) + .arg("-Zunstable-options") + .arg("-Zscript") + .arg("--lockfile-path") + .arg(lockfile_path_argument) + .arg("--manifest-path") + .arg("src/main.rs") + .run(); + + assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(!p.root().join("Cargo.lock").exists()); } From d1b1b65a54bdbdf700d9a19cbbd8f4831fea5dc9 Mon Sep 17 00:00:00 2001 From: Ifropc Date: Tue, 13 Aug 2024 23:07:54 -0700 Subject: [PATCH 11/12] feat: lockfile path move create logic into write_pkg_lockfile --- src/cargo/ops/lockfile.rs | 4 ++++ src/cargo/util/command_prelude.rs | 8 +------- tests/testsuite/lockfile_path.rs | 28 ++++++++++++++++++++-------- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/cargo/ops/lockfile.rs b/src/cargo/ops/lockfile.rs index 42a0d61b39d..d865a7186f6 100644 --- a/src/cargo/ops/lockfile.rs +++ b/src/cargo/ops/lockfile.rs @@ -84,6 +84,10 @@ pub fn write_pkg_lockfile(ws: &Workspace<'_>, resolve: &mut Resolve) -> CargoRes anyhow::bail!("lock file version `{current_version:?}` requires `-Znext-lockfile-bump`") } + if !lock_root.as_path_unlocked().exists() { + lock_root.create_dir()?; + } + // Ok, if that didn't work just write it out lock_root .open_rw_exclusive_create(LOCKFILE_NAME, ws.gctx(), "Cargo.lock file") diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index 6dc8a5fffa7..dfc4ad147a0 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -1015,7 +1015,7 @@ pub fn lockfile_path( let path = gctx.cwd().join(lockfile_path); if !path.ends_with(LOCKFILE_NAME) { - bail!("the lockfile-path must be a path to a {LOCKFILE_NAME} file") + bail!("the lockfile-path must be a path to a {LOCKFILE_NAME} file (please rename your lock file to {LOCKFILE_NAME})") } if path.is_dir() { bail!( @@ -1023,12 +1023,6 @@ pub fn lockfile_path( lockfile_path.display() ) } - if !path.exists() { - // Root case should already be covered above - let parent_path = lockfile_path.parent().expect("lockfile path can't be root"); - - paths::create_dir_all(parent_path)?; - } return Ok(Some(path)); } diff --git a/tests/testsuite/lockfile_path.rs b/tests/testsuite/lockfile_path.rs index 3a6854d0376..dae3d818b0b 100644 --- a/tests/testsuite/lockfile_path.rs +++ b/tests/testsuite/lockfile_path.rs @@ -135,19 +135,25 @@ fn broken_symlink() { assert!(!p.root().join(src).is_dir()); let err_msg = if !cfg!(windows) { - str![[r#"[ERROR] failed to create directory `somedir/link` + str![[ + r#"[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems +[ERROR] failed to create directory `[ROOT]/foo/somedir/link` Caused by: File exists (os error 17) -"#]] +"# + ]] } else { - str![[r#"[ERROR] failed to create directory `somedir/link` + str![[ + r#"[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems +[ERROR] failed to create directory `[ROOT]/foo/somedir/link` Caused by: Cannot create a file when that file already exists. (os error 183) -"#]] +"# + ]] }; make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()) @@ -173,19 +179,25 @@ fn loop_symlink() { assert!(!p.root().join(src).is_dir()); let err_msg = if !cfg!(windows) { - str![[r#"[ERROR] failed to create directory `somedir/link` + str![[ + r#"[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems +[ERROR] failed to create directory `[ROOT]/foo/somedir/link` Caused by: File exists (os error 17) -"#]] +"# + ]] } else { - str![[r#"[ERROR] failed to create directory `somedir/link` + str![[ + r#"[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems +[ERROR] failed to create directory `[ROOT]/foo/somedir/link` Caused by: Cannot create a file when that file already exists. (os error 183) -"#]] +"# + ]] }; make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()) From 04f9e2dfc0f59340ebf2db4ad5eadce0f5f23818 Mon Sep 17 00:00:00 2001 From: Ifropc Date: Thu, 15 Aug 2024 23:19:26 -0700 Subject: [PATCH 12/12] test: lockfile path test refactoring --- tests/testsuite/lockfile_path.rs | 445 +++++++++++-------------------- 1 file changed, 149 insertions(+), 296 deletions(-) diff --git a/tests/testsuite/lockfile_path.rs b/tests/testsuite/lockfile_path.rs index dae3d818b0b..2e04cdd744b 100644 --- a/tests/testsuite/lockfile_path.rs +++ b/tests/testsuite/lockfile_path.rs @@ -1,75 +1,46 @@ //! Tests for `lockfile-path` flag -use cargo_test_support::compare::assert_e2e; -use cargo_test_support::registry::RegistryBuilder; -use cargo_test_support::{ - basic_bin_manifest, cargo_test, project, symlink_supported, Execs, Project, ProjectBuilder, -}; -use snapbox::str; use std::fs; -const VALID_LOCKFILE: &str = r#"# Test lockfile -version = 3 - -[[package]] -name = "test_foo" -version = "0.5.0" -"#; - -const LIB_TOML: &str = r#" - [package] - name = "test_bar" - version = "0.1.0" - edition = "2021" - "#; - -fn make_project() -> ProjectBuilder { - return project() - .file("Cargo.toml", &basic_bin_manifest("test_foo")) - .file("src/main.rs", "fn main() {}"); -} +use snapbox::str; -fn make_execs(execs: &mut Execs, lockfile_path_argument: String) -> &mut Execs { - return execs - .masquerade_as_nightly_cargo(&["lockfile-path"]) - .arg("-Zunstable-options") - .arg("--lockfile-path") - .arg(lockfile_path_argument); -} +use cargo_test_support::compare::assert_e2e; +use cargo_test_support::registry::{Package, RegistryBuilder}; +use cargo_test_support::{ + basic_bin_manifest, cargo_test, project, symlink_supported, Execs, ProjectBuilder, +}; #[cargo_test] fn basic_lockfile_created() { - let lockfile_path_argument = "mylockfile/is/burried/Cargo.lock"; + let lockfile_path = "mylockfile/is/burried/Cargo.lock"; let p = make_project().build(); - make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()).run(); + make_execs(&mut p.cargo("generate-lockfile"), lockfile_path).run(); assert!(!p.root().join("Cargo.lock").exists()); - assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(p.root().join(lockfile_path).is_file()); } #[cargo_test] fn basic_lockfile_read() { - let lockfile_path_argument = "mylockfile/Cargo.lock"; - let p = make_project() - .file("mylockfile/Cargo.lock", VALID_LOCKFILE) - .build(); + let lockfile_path = "mylockfile/Cargo.lock"; + let p = make_project().file(lockfile_path, VALID_LOCKFILE).build(); - make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()).run(); + make_execs(&mut p.cargo("generate-lockfile"), lockfile_path).run(); assert!(!p.root().join("Cargo.lock").exists()); - assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(p.root().join(lockfile_path).is_file()); } #[cargo_test] fn basic_lockfile_override() { - let lockfile_path_argument = "mylockfile/Cargo.lock"; + let lockfile_path = "mylockfile/Cargo.lock"; let p = make_project() .file("Cargo.lock", "This is an invalid lock file!") .build(); - make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()).run(); + make_execs(&mut p.cargo("generate-lockfile"), lockfile_path).run(); - assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(p.root().join(lockfile_path).is_file()); } ////////////////////// @@ -84,18 +55,16 @@ fn symlink_in_path() { let dst = "dst"; let src = "somedir/link"; - let lockfile_path_argument = format!("{src}/Cargo.lock"); + let lockfile_path = format!("{src}/Cargo.lock"); let p = make_project().symlink_dir(dst, src).build(); - fs::create_dir(p.root().join("dst")) - .unwrap_or_else(|e| panic!("could not create directory {}", e)); + fs::create_dir(p.root().join("dst")).unwrap(); assert!(p.root().join(src).is_dir()); - make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()).run(); + make_execs(&mut p.cargo("generate-lockfile"), lockfile_path.as_str()).run(); - assert!(p.root().join(format!("{src}/Cargo.lock")).is_file()); - assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(p.root().join(lockfile_path).is_file()); assert!(p.root().join(dst).join("Cargo.lock").is_file()); } @@ -105,18 +74,18 @@ fn symlink_lockfile() { return; } - let lockfile_path_argument = "dst/Cargo.lock"; + let lockfile_path = "dst/Cargo.lock"; let src = "somedir/link"; let lock_body = VALID_LOCKFILE; let p = make_project() - .file(lockfile_path_argument, lock_body) - .symlink(lockfile_path_argument, src) + .file(lockfile_path, lock_body) + .symlink(lockfile_path, src) .build(); assert!(p.root().join(src).is_file()); - make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()).run(); + make_execs(&mut p.cargo("generate-lockfile"), lockfile_path).run(); assert!(!p.root().join("Cargo.lock").exists()); } @@ -129,36 +98,20 @@ fn broken_symlink() { let invalid_dst = "invalid_path"; let src = "somedir/link"; - let lockfile_path_argument = format!("{src}/Cargo.lock"); + let lockfile_path = format!("{src}/Cargo.lock"); let p = make_project().symlink_dir(invalid_dst, src).build(); assert!(!p.root().join(src).is_dir()); - let err_msg = if !cfg!(windows) { - str![[ - r#"[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems -[ERROR] failed to create directory `[ROOT]/foo/somedir/link` - -Caused by: - File exists (os error 17) - -"# - ]] - } else { - str![[ - r#"[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems -[ERROR] failed to create directory `[ROOT]/foo/somedir/link` + make_execs(&mut p.cargo("generate-lockfile"), lockfile_path.as_str()) + .with_status(101) + .with_stderr_data(str![[ + r#"[ERROR] failed to create directory `[ROOT]/foo/somedir/link` -Caused by: - Cannot create a file when that file already exists. (os error 183) +... "# - ]] - }; - - make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()) - .with_status(101) - .with_stderr_data(err_msg) + ]]) .run(); } @@ -170,7 +123,7 @@ fn loop_symlink() { let loop_link = "loop"; let src = "somedir/link"; - let lockfile_path_argument = format!("{src}/Cargo.lock"); + let lockfile_path = format!("{src}/Cargo.lock"); let p = make_project() .symlink_dir(loop_link, src) @@ -178,186 +131,87 @@ fn loop_symlink() { .build(); assert!(!p.root().join(src).is_dir()); - let err_msg = if !cfg!(windows) { - str![[ - r#"[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems -[ERROR] failed to create directory `[ROOT]/foo/somedir/link` - -Caused by: - File exists (os error 17) - -"# - ]] - } else { - str![[ - r#"[WARNING] please specify `--format-version` flag explicitly to avoid compatibility problems -[ERROR] failed to create directory `[ROOT]/foo/somedir/link` + make_execs(&mut p.cargo("generate-lockfile"), lockfile_path.as_str()) + .with_status(101) + .with_stderr_data(str![[ + r#"[ERROR] failed to create directory `[ROOT]/foo/somedir/link` -Caused by: - Cannot create a file when that file already exists. (os error 183) +... "# - ]] - }; - - make_execs(&mut p.cargo("metadata"), lockfile_path_argument.to_string()) - .with_status(101) - .with_stderr_data(err_msg) - .run(); -} - -fn run_add_command(p: &Project, lockfile_path_argument: String) { - make_execs(&mut p.cargo("add"), lockfile_path_argument) - .arg("--path") - .arg("../bar") + ]]) .run(); } -fn make_add_project() -> ProjectBuilder { - return make_project() - .file("../bar/Cargo.toml", LIB_TOML) - .file("../bar/src/main.rs", "fn main() {}"); -} - ///////////////////////// //// Commands tests ///////////////////////// -#[cargo_test] -fn add_lockfile_created() { - let lockfile_path_argument = "mylockfile/is/burried/Cargo.lock"; - let p = make_add_project().build(); - run_add_command(&p, lockfile_path_argument.to_string()); - - assert!(!p.root().join("Cargo.lock").exists()); - assert!(p.root().join(lockfile_path_argument).is_file()); -} - -#[cargo_test] -fn add_lockfile_read() { - let lockfile_path_argument = "mylockfile/Cargo.lock"; - let p = make_add_project() - .file("mylockfile/Cargo.lock", VALID_LOCKFILE) - .build(); - run_add_command(&p, lockfile_path_argument.to_string()); - - assert!(!p.root().join("Cargo.lock").exists()); - assert!(p.root().join(lockfile_path_argument).is_file()); -} - #[cargo_test] fn add_lockfile_override() { - let lockfile_path_argument = "mylockfile/Cargo.lock"; - let p = make_add_project() - .file("Cargo.lock", "This is an invalid lock file!") + let lockfile_path = "mylockfile/Cargo.lock"; + project() + .at("bar") + .file("Cargo.toml", LIB_TOML) + .file("src/main.rs", "fn main() {}") .build(); - run_add_command(&p, lockfile_path_argument.to_string()); - - assert!(p.root().join(lockfile_path_argument).is_file()); -} - -fn run_clean_command(p: &Project, lockfile_path_argument: String) { - make_execs(&mut p.cargo("clean"), lockfile_path_argument) - .arg("--package") - .arg("test_foo") - .run(); -} - -#[cargo_test] -fn clean_lockfile_created() { - let lockfile_path_argument = "mylockfile/is/burried/Cargo.lock"; - let p = make_project().build(); - run_clean_command(&p, lockfile_path_argument.to_string()); - - assert!(!p.root().join("Cargo.lock").exists()); - assert!(p.root().join(lockfile_path_argument).is_file()); -} - -#[cargo_test] -fn clean_lockfile_read() { - let lockfile_path_argument = "mylockfile/Cargo.lock"; let p = make_project() - .file("mylockfile/Cargo.lock", VALID_LOCKFILE) + .file("Cargo.lock", "This is an invalid lock file!") .build(); - run_clean_command(&p, lockfile_path_argument.to_string()); + make_execs(&mut p.cargo("add"), lockfile_path) + .arg("--path") + .arg("../bar") + .run(); - assert!(!p.root().join("Cargo.lock").exists()); - assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(p.root().join(lockfile_path).is_file()); } #[cargo_test] fn clean_lockfile_override() { - let lockfile_path_argument = "mylockfile/Cargo.lock"; + let lockfile_path = "mylockfile/Cargo.lock"; let p = make_project() .file("Cargo.lock", "This is an invalid lock file!") .build(); - run_clean_command(&p, lockfile_path_argument.to_string()); - - assert!(p.root().join(lockfile_path_argument).is_file()); -} - -fn run_fix_command(p: &Project, lockfile_path_argument: String) { - make_execs(&mut p.cargo("fix"), lockfile_path_argument) + make_execs(&mut p.cargo("clean"), lockfile_path) .arg("--package") .arg("test_foo") - .arg("--allow-no-vcs") .run(); -} - -#[cargo_test] -fn fix_lockfile_created() { - let lockfile_path_argument = "mylockfile/is/burried/Cargo.lock"; - let p = make_project().build(); - run_fix_command(&p, lockfile_path_argument.to_string()); - assert!(!p.root().join("Cargo.lock").exists()); - assert!(p.root().join(lockfile_path_argument).is_file()); -} - -#[cargo_test] -fn fix_lockfile_read() { - let lockfile_path_argument = "mylockfile/Cargo.lock"; - let p = make_project() - .file("mylockfile/Cargo.lock", VALID_LOCKFILE) - .build(); - run_fix_command(&p, lockfile_path_argument.to_string()); - - assert!(!p.root().join("Cargo.lock").exists()); - assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(p.root().join(lockfile_path).is_file()); } #[cargo_test] fn fix_lockfile_override() { - let lockfile_path_argument = "mylockfile/Cargo.lock"; + let lockfile_path = "mylockfile/Cargo.lock"; let p = make_project() .file("Cargo.lock", "This is an invalid lock file!") .build(); - run_fix_command(&p, lockfile_path_argument.to_string()); + make_execs(&mut p.cargo("fix"), lockfile_path) + .arg("--package") + .arg("test_foo") + .arg("--allow-no-vcs") + .run(); - assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(p.root().join(lockfile_path).is_file()); } -fn run_publish_command(p: &Project, lockfile_path_argument: String) { +#[cargo_test] +fn publish_lockfile_read() { + let lockfile_path = "mylockfile/Cargo.lock"; + let p = make_project().file(lockfile_path, VALID_LOCKFILE).build(); let registry = RegistryBuilder::new().http_api().http_index().build(); - make_execs(&mut p.cargo("publish"), lockfile_path_argument) + make_execs(&mut p.cargo("publish"), lockfile_path) .replace_crates_io(registry.index_url()) .run(); -} - -#[cargo_test] -fn publish_lockfile_read() { - let lockfile_path_argument = "mylockfile/Cargo.lock"; - let p = make_project() - .file("mylockfile/Cargo.lock", VALID_LOCKFILE) - .build(); - run_publish_command(&p, lockfile_path_argument.to_string()); assert!(!p.root().join("Cargo.lock").exists()); - assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(p.root().join(lockfile_path).is_file()); } -fn make_remove_project() -> ProjectBuilder { +#[cargo_test] +fn remove_lockfile_override() { + let lockfile_path = "mylockfile/Cargo.lock"; let manifest = r#" [package] @@ -374,71 +228,31 @@ fn make_remove_project() -> ProjectBuilder { test_bar = { version = "0.1.0", path = "../bar" } "#; - return project() - .file("Cargo.toml", &manifest) + project() + .at("bar") + .file("Cargo.toml", LIB_TOML) .file("src/main.rs", "fn main() {}") - .file("../bar/Cargo.toml", LIB_TOML) - .file("../bar/src/main.rs", "fn main() {}"); -} - -fn run_remove_command(p: &Project, lockfile_path_argument: String) { - make_execs(&mut p.cargo("remove"), lockfile_path_argument) - .arg("test_bar") - .run(); -} -#[cargo_test] -fn remove_lockfile_created() { - let lockfile_path_argument = "mylockfile/is/burried/Cargo.lock"; - let p = make_remove_project().build(); - run_remove_command(&p, lockfile_path_argument.to_string()); - - assert!(!p.root().join("Cargo.lock").exists()); - assert!(p.root().join(lockfile_path_argument).is_file()); -} - -#[cargo_test] -fn remove_lockfile_read() { - let lockfile_path_argument = "mylockfile/Cargo.lock"; - let p = make_remove_project() - .file("mylockfile/Cargo.lock", VALID_LOCKFILE) .build(); - run_remove_command(&p, lockfile_path_argument.to_string()); - - assert!(!p.root().join("Cargo.lock").exists()); - assert!(p.root().join(lockfile_path_argument).is_file()); -} -#[cargo_test] -fn remove_lockfile_override() { - let lockfile_path_argument = "mylockfile/Cargo.lock"; - let p = make_remove_project() + let p = project() + .file("Cargo.toml", &manifest) + .file("src/main.rs", "fn main() {}") .file("Cargo.lock", "This is an invalid lock file!") .build(); - run_remove_command(&p, lockfile_path_argument.to_string()); + make_execs(&mut p.cargo("remove"), lockfile_path) + .arg("test_bar") + .run(); - assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(p.root().join(lockfile_path).is_file()); } #[cargo_test] fn assert_respect_pinned_version_from_lockfile_path() { - const PINNED_VERSION: &str = r#"# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "hello" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b94f16c310ebbd9efcca5a5a17131d70bd454876f2af007f3da211afadff4fc" - -[[package]] -name = "test_foo" -version = "0.5.0" -dependencies = [ - "hello", -] -"#; - const TOML: &str = r#"# + let lockfile_path = "mylockfile/Cargo.lock"; + let p = project() + .file( + "Cargo.toml", + r#"# [package] name = "test_foo" @@ -451,20 +265,22 @@ edition = "2015" name = "test_foo" [dependencies] -hello = "1.0.0" -"#; - - let lockfile_path_argument = "mylockfile/Cargo.lock"; - let p = project() - .file("Cargo.toml", TOML) +bar = "0.1.0" +"#, + ) .file("src/main.rs", "fn main() {}") - .file("mylockfile/Cargo.lock", PINNED_VERSION) .build(); - make_execs(&mut p.cargo("package"), lockfile_path_argument.to_string()).run(); + Package::new("bar", "0.1.0").publish(); + make_execs(&mut p.cargo("generate-lockfile"), lockfile_path).run(); assert!(!p.root().join("Cargo.lock").exists()); - assert!(p.root().join(lockfile_path_argument).is_file()); + assert!(p.root().join(lockfile_path).is_file()); + + let lockfile_original = fs::read_to_string(p.root().join(lockfile_path)).unwrap(); + + Package::new("bar", "0.1.1").publish(); + make_execs(&mut p.cargo("package"), lockfile_path).run(); assert!(p .root() @@ -474,37 +290,74 @@ hello = "1.0.0" let path = p.root().join("target/package/test_foo-0.5.0/Cargo.lock"); let contents = fs::read_to_string(path).unwrap(); - assert_e2e().eq(contents, PINNED_VERSION); + assert_e2e().eq(contents, lockfile_original); } #[cargo_test] fn run_embed() { - const ECHO_SCRIPT: &str = r#"#!/usr/bin/env cargo - -fn main() { - let mut args = std::env::args_os(); - let bin = args.next().unwrap().to_str().unwrap().to_owned(); - let args = args.collect::>(); - println!("bin: {bin}"); - println!("args: {args:?}"); -} + let lockfile_path = "mylockfile/Cargo.lock"; + let invalid_lockfile = "Cargo.lock"; + let p = project() + .file("src/main.rs", "fn main() {}") + .file("Cargo.lock", "This is an invalid lock file!") + .build(); -#[test] -fn test () {} -"#; - let lockfile_path_argument = "mylockfile/Cargo.lock"; - let p = project().file("src/main.rs", ECHO_SCRIPT).build(); + p.cargo("run") + .masquerade_as_nightly_cargo(&["lockfile-path"]) + .arg("-Zunstable-options") + .arg("-Zscript") + .arg("--lockfile-path") + .arg(lockfile_path) + .arg("--manifest-path") + .arg("src/main.rs") + .run(); + + assert!(p.root().join(lockfile_path).is_file()); p.cargo("run") .masquerade_as_nightly_cargo(&["lockfile-path"]) .arg("-Zunstable-options") .arg("-Zscript") .arg("--lockfile-path") - .arg(lockfile_path_argument) + .arg(invalid_lockfile) .arg("--manifest-path") .arg("src/main.rs") + .with_status(101) + .with_stderr_data(str![[ + r#"[WARNING] `package.edition` is unspecified, defaulting to `2021` +[ERROR] failed to parse lock file at: [ROOT]/foo/Cargo.lock + +... +"# + ]]) .run(); +} - assert!(p.root().join(lockfile_path_argument).is_file()); - assert!(!p.root().join("Cargo.lock").exists()); +const VALID_LOCKFILE: &str = r#"# Test lockfile +version = 3 + +[[package]] +name = "test_foo" +version = "0.5.0" +"#; + +const LIB_TOML: &str = r#" + [package] + name = "test_bar" + version = "0.1.0" + edition = "2021" + "#; + +fn make_project() -> ProjectBuilder { + project() + .file("Cargo.toml", &basic_bin_manifest("test_foo")) + .file("src/main.rs", "fn main() {}") +} + +fn make_execs<'a>(execs: &'a mut Execs, lockfile_path_argument: &str) -> &'a mut Execs { + execs + .masquerade_as_nightly_cargo(&["lockfile-path"]) + .arg("-Zunstable-options") + .arg("--lockfile-path") + .arg(lockfile_path_argument) }