Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/bin/cargo/commands/add.rs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

rust-analyzer hasn't switched to resolver.lockfile-path yet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CC @rust-lang/rust-analyzer

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the ping. Yeah, looks like we should switch to it soonish 😅

Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ 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")
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ 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 `<bright-cyan,bold>cargo help bench</>` for more detailed information.\n"
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pub fn cli() -> Command {
.arg_timings()
.arg_compile_time_deps()
.arg_manifest_path()
.arg_lockfile_path()
.arg_ignore_rust_version()
.after_help(color_print::cstr!(
"Run `<bright-cyan,bold>cargo help build</>` for more detailed information.\n"
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ pub fn cli() -> Command {
.arg_timings()
.arg_compile_time_deps()
.arg_manifest_path()
.arg_lockfile_path()
.arg_ignore_rust_version()
.after_help(color_print::cstr!(
"Run `<bright-cyan,bold>cargo help check</>` for more detailed information.\n"
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ 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(
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ 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 `<bright-cyan,bold>cargo help doc</>` for more detailed information.\n"
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ 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 `<bright-cyan,bold>cargo help fetch</>` for more detailed information.\n"
))
Expand Down
5 changes: 0 additions & 5 deletions src/bin/cargo/commands/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ 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 `<bright-cyan,bold>cargo help fix</>` for more detailed information.\n"
Expand All @@ -76,10 +75,6 @@ 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 = args.lockfile_path(gctx)?;
if ws.requested_lockfile_path().is_none() {
ws.set_requested_lockfile_path(lockfile_path.clone());
}

let mut opts =
args.compile_options(gctx, intent, Some(&ws), ProfileChecking::LegacyTestOnly)?;
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/generate_lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ 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")
.arg(
clap::Arg::new("publish-time")
Expand Down
8 changes: 0 additions & 8 deletions src/bin/cargo/commands/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ pub fn cli() -> Command {
.arg_target_triple("Build for the target triple")
.arg_target_dir()
.arg_timings()
.arg_lockfile_path()
.after_help(color_print::cstr!(
"Run `<bright-cyan,bold>cargo help install</>` for more detailed information.\n"
))
Expand Down Expand Up @@ -233,12 +232,6 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
gctx.cli_unstable().fail_if_stable_opt("--dry-run", 11123)?;
}

let requested_lockfile_path = args.lockfile_path(gctx)?;
// 14421: lockfile path should imply --locked on running `install`
if requested_lockfile_path.is_some() {
gctx.set_locked(true);
}

if args.flag("list") {
ops::install_list(root, gctx)?;
} else {
Expand All @@ -252,7 +245,6 @@ pub fn exec(gctx: &mut GlobalContext, args: &ArgMatches) -> CliResult {
args.flag("force"),
args.flag("no-track"),
args.dry_run(),
requested_lockfile_path.as_deref(),
)?;
}
Ok(())
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ pub fn cli() -> Command {
.arg_silent_suggestion()
.arg_features()
.arg_manifest_path()
.arg_lockfile_path()
.after_help(color_print::cstr!(
"Run `<bright-cyan,bold>cargo help metadata</>` for more detailed information.\n"
))
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ pub fn cli() -> Command {
.arg_target_dir()
.arg_parallel()
.arg_manifest_path()
.arg_lockfile_path()
.after_help(color_print::cstr!(
"Run `<bright-cyan,bold>cargo help package</>` for more detailed information.\n"
))
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/pkgid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ 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 `<bright-cyan,bold>cargo help pkgid</>` for more detailed information.\n"
))
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ 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 `<bright-cyan,bold>cargo help publish</>` for more detailed information.\n"
))
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ pub fn cli() -> clap::Command {
])
.arg_package("Package to remove from")
.arg_manifest_path()
.arg_lockfile_path()
.after_help(color_print::cstr!(
"Run `<bright-cyan,bold>cargo help remove</>` for more detailed information.\n"
))
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ 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()
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ 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 `<bright-cyan,bold>cargo help rustc</>` for more detailed information.\n"
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ 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 `<bright-cyan,bold>cargo help rustdoc</>` for more detailed information.\n"
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ 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 `<bright-cyan,bold>cargo help test</>` for more detailed information.\n\
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ pub fn cli() -> Command {
ArgValueCandidates::new(get_target_triples_with_all),
)
.arg_manifest_path()
.arg_lockfile_path()
.after_help(color_print::cstr!(
"Run `<bright-cyan,bold>cargo help tree</>` for more detailed information.\n"
))
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ 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")
.after_help(color_print::cstr!(
"Run `<bright-cyan,bold>cargo help update</>` for more detailed information.\n"
Expand Down
1 change: 0 additions & 1 deletion src/bin/cargo/commands/vendor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ 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 `<bright-cyan,bold>cargo help vendor</>` for more detailed information.\n"
))
Expand Down
21 changes: 3 additions & 18 deletions src/cargo/ops/cargo_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ impl<'gctx> InstallablePackage<'gctx> {
no_track: bool,
needs_update_if_source_is_index: bool,
current_rust_version: Option<&PartialVersion>,
lockfile_path: Option<&Path>,
) -> CargoResult<Option<Self>> {
if let Some(name) = krate {
if name == "." {
Expand Down Expand Up @@ -156,7 +155,6 @@ impl<'gctx> InstallablePackage<'gctx> {
&root,
&dst,
force,
lockfile_path,
) {
let msg = format!(
"package `{}` is already installed, use --force to override",
Expand All @@ -181,13 +179,8 @@ impl<'gctx> InstallablePackage<'gctx> {
}
};

let (ws, rustc, target) = make_ws_rustc_target(
gctx,
&original_opts,
&source_id,
pkg.clone(),
lockfile_path.clone(),
)?;
let (ws, rustc, target) =
make_ws_rustc_target(gctx, &original_opts, &source_id, pkg.clone())?;

if !gctx.lock_update_allowed() {
// When --lockfile-path is set, check that passed lock file exists
Expand Down Expand Up @@ -660,7 +653,6 @@ pub fn install(
force: bool,
no_track: bool,
dry_run: bool,
lockfile_path: Option<&Path>,
) -> CargoResult<()> {
let root = resolve_root(root, gctx)?;
// Normalize to absolute path for consistency throughout.
Expand Down Expand Up @@ -700,7 +692,6 @@ pub fn install(
no_track,
true,
current_rust_version.as_ref(),
lockfile_path,
)?;
let mut installed_anything = true;
if let Some(installable_pkg) = installable_pkg {
Expand Down Expand Up @@ -732,7 +723,6 @@ pub fn install(
no_track,
!did_update,
current_rust_version.as_ref(),
lockfile_path,
) {
Ok(Some(installable_pkg)) => {
did_update = true;
Expand Down Expand Up @@ -839,7 +829,6 @@ fn installed_exact_package<T>(
root: &Filesystem,
dst: &Path,
force: bool,
lockfile_path: Option<&Path>,
) -> CargoResult<Option<Package>>
where
T: Source,
Expand All @@ -855,7 +844,7 @@ where
// best-effort check to see if we can avoid hitting the network.
if let Ok(pkg) = select_dep_pkg(source, dep, gctx, false, None) {
let (_ws, rustc, target) =
make_ws_rustc_target(gctx, opts, &source.source_id(), pkg.clone(), lockfile_path)?;
make_ws_rustc_target(gctx, opts, &source.source_id(), pkg.clone())?;
if let Ok(true) = is_installed(&pkg, gctx, opts, &rustc, &target, root, dst, force) {
return Ok(Some(pkg));
}
Expand All @@ -868,7 +857,6 @@ fn make_ws_rustc_target<'gctx>(
opts: &ops::CompileOptions,
source_id: &SourceId,
pkg: Package,
lockfile_path: Option<&Path>,
) -> CargoResult<(Workspace<'gctx>, Rustc, String)> {
let mut ws = if source_id.is_git() || source_id.is_path() {
Workspace::new(pkg.manifest_path(), gctx)?
Expand All @@ -879,9 +867,6 @@ fn make_ws_rustc_target<'gctx>(
};
ws.set_resolve_feature_unification(FeatureUnification::Selected);
ws.set_ignore_lock(gctx.lock_update_allowed());
if ws.requested_lockfile_path().is_none() {
ws.set_requested_lockfile_path(lockfile_path.map(|p| p.to_path_buf()));
}
// if --lockfile-path is set, imply --locked
if ws.requested_lockfile_path().is_some() {
ws.set_ignore_lock(false);
Expand Down
Loading