From bdb0ce84e2d4b361d000e7418b7cf4edba65fc4b Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 10 Jul 2019 10:01:09 -0700 Subject: [PATCH] Don't suppress error messages with `-q` If we're printing an error, make sure we always print it regardless of verbosity settings! --- src/cargo/core/shell.rs | 5 ++++- tests/testsuite/workspaces.rs | 36 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/cargo/core/shell.rs b/src/cargo/core/shell.rs index d553848c578..3f1d8600315 100644 --- a/src/cargo/core/shell.rs +++ b/src/cargo/core/shell.rs @@ -207,7 +207,10 @@ impl Shell { /// Prints a red 'error' message. pub fn error(&mut self, message: T) -> CargoResult<()> { - self.print(&"error:", Some(&message), Red, false) + if self.needs_clear { + self.err_erase_line(); + } + self.err.print(&"error:", Some(&message), Red, false) } /// Prints an amber 'warning' message. diff --git a/tests/testsuite/workspaces.rs b/tests/testsuite/workspaces.rs index a9562b1196b..35ec7a52e75 100644 --- a/tests/testsuite/workspaces.rs +++ b/tests/testsuite/workspaces.rs @@ -2137,3 +2137,39 @@ fn ws_warn_path() { .with_stderr_contains("[WARNING] [..]/foo/a/Cargo.toml: the cargo feature `edition`[..]") .run(); } + +#[cargo_test] +fn invalid_missing() { + // Warnings include path to manifest. + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.1.0" + + [dependencies] + x = { path = 'x' } + "#, + ) + .file("src/lib.rs", "") + .build(); + + p.cargo("build -q") + .with_status(101) + .with_stderr( + "\ +error: [..] + +Caused by: + [..] + +Caused by: + [..] + +Caused by: + [..]", + ) + .run(); +}