Skip to content

Warnings for breaking changes to the configuration discovery of cargo install and cargo uninstall proposed in #11775 #11786

New issue

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

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

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 6 additions & 1 deletion src/bin/cargo/commands/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
if let Some(path) = &path {
config.reload_rooted_at(path)?;
} else {
// TODO: Consider calling set_search_stop_path(home).
config.shell().warn(
"the configuration discovery of `cargo install` will change in a \
future version.\n\
In the future, only the global configuration file \
`$CARGO_HOME/config.toml` will be considered by `cargo install`.",
)?;
config.reload_rooted_at(config.home().clone().into_path_unlocked())?;
}

Expand Down
7 changes: 7 additions & 0 deletions src/bin/cargo/commands/uninstall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ pub fn cli() -> Command {
}

pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
config.shell().warn(
"the configuration discovery of `cargo uninstall` will change in a \
future version.\n\
In the future, only the global configuration file \
`$CARGO_HOME/config.toml` will be considered by `cargo uninstall`.",
)?;

let root = args.get_one::<String>("root").map(String::as_str);

if args.is_present_with_zero_values("package") {
Expand Down
17 changes: 17 additions & 0 deletions tests/testsuite/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,23 @@ fn bad_paths() {
.run();
}

#[cargo_test]
fn warning_for_configuration_discovery_changes() {
pkg("foo", "0.0.1");

cargo_process("install foo")
.with_stderr_contains(
"warning: the configuration discovery of `cargo install` will change in a future version.",
)
.run();

cargo_process("uninstall foo")
.with_stderr_contains(
"warning: the configuration discovery of `cargo uninstall` will change in a future version.",
)
.run();
}

#[cargo_test]
fn install_location_precedence() {
pkg("foo", "0.0.1");
Expand Down