Add more instructions to error message
authorGabriel Féron <feron.gabriel@gmail.com>
Tue, 29 May 2018 09:05:34 +0000 (11:05 +0200)
committerGabriel Féron <feron.gabriel@gmail.com>
Tue, 29 May 2018 09:05:34 +0000 (11:05 +0200)
src/cargo/ops/cargo_package.rs
tests/testsuite/package.rs

index 84115a6da87413603516d2c16039d79720e25b57..2b55b19d1106d91ceeea823ade4bb4d18f15be74 100644 (file)
@@ -360,8 +360,9 @@ fn run_verify(ws: &Workspace, tar: &FileLock, opts: &PackageOpts) -> CargoResult
         bail!(
             "Source directory was modified by build.rs during cargo publish. \
              Build scripts should not modify anything outside of OUT_DIR. \
-             Modified file: {}",
-             path.display()
+             Modified file: {}\n\n\
+             To proceed despite this, pass the `--no-verify` flag.",
+            path.display()
         )
     }
 
index beb650c7233e2bc41c155667d87bdc290063ffbe..fde31b76c7250e3f681c0db0a444ec6c9d118538 100644 (file)
@@ -1442,7 +1442,17 @@ fn do_not_package_if_src_was_modified() {
 
     assert_that(
         p.cargo("package"),
-        execs().with_status(101),
+        execs().with_status(101)
+               .with_stderr_contains(
+                   "\
+error: failed to verify package tarball
+
+Caused by:
+  Source directory was modified by build.rs during cargo publish. \
+Build scripts should not modify anything outside of OUT_DIR. Modified file: [..]src/generated.txt
+
+To proceed despite this, pass the `--no-verify` flag.",
+               ),
     );
 
     assert_that(