From: Dale Wijnand Date: Tue, 10 Apr 2018 14:10:38 +0000 (+0100) Subject: warn in 2015, error in 2018 X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~1^2~81^2~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e201a8949c40ff1456e219d87a67313ee54dfe52;p=cargo.git warn in 2015, error in 2018 --- diff --git a/src/cargo/ops/cargo_install.rs b/src/cargo/ops/cargo_install.rs index 9984c3952..7987eb1e7 100644 --- a/src/cargo/ops/cargo_install.rs +++ b/src/cargo/ops/cargo_install.rs @@ -235,10 +235,18 @@ fn install_one( if from_cwd { match pkg.manifest().edition() { - Edition::Edition2015 => (), - Edition::Edition2018 => { - config.shell().warn("To build the current package use 'cargo build', to install the current package run `cargo install --path .`")?; - }, + Edition::Edition2015 => + config.shell().warn("To build the current package use `cargo build`, to install the current package run `cargo install --path .`")? + , + Edition::Edition2018 => + bail!( + "To build the current package use `cargo build`, \ + to install the current package run `cargo install --path .`, \ + otherwise specify a crate to install from \ + crates.io, or use --path or --git to \ + specify alternate source" + ) + , } }; diff --git a/tests/testsuite/install.rs b/tests/testsuite/install.rs index 3224f269f..8e3baa8cf 100644 --- a/tests/testsuite/install.rs +++ b/tests/testsuite/install.rs @@ -1009,7 +1009,11 @@ fn installs_from_cwd_by_default() { assert_that( cargo_process("install").cwd(p.root()), - execs().with_status(0), + execs().with_status(0).with_stderr_contains( + "\ +warning: To build the current package use `cargo build`, to install the current package run `cargo install --path .` +", + ), ); assert_that(cargo_home(), has_installed_exe("foo")); } @@ -1039,13 +1043,13 @@ fn installs_from_cwd_with_2018_warnings() { assert_that( cargo_process("install").cwd(p.root()).masquerade_as_nightly_cargo(), - execs().with_status(0).with_stderr_contains( - "\ -warning: To build the current package use 'cargo build', to install the current package run `cargo install --path .` -", - ), + execs().with_status(101).with_stderr_contains( + "error: To build the current package use `cargo build`, \ + to install the current package run `cargo install --path .`, \ + otherwise specify a crate to install from crates.io, \ + or use --path or --git to specify alternate source\ + "), ); - assert_that(cargo_home(), has_installed_exe("foo")); } #[test]