This commit is contained in:
Esteban Küber 2024-08-06 18:36:43 +00:00
parent 5e26c8d3c9
commit 034b73ba54
2 changed files with 19 additions and 15 deletions

View File

@ -1365,6 +1365,14 @@ impl HumanEmitter {
);
line += 1;
}
// We add lines above, but if the last line has no explicit newline (which would
// yield an empty line), then we revert one line up to continue with the next
// styled text chunk on the same line as the last one from the prior one. Otherwise
// every `text` would appear on their own line (because even though they didn't end
// in '\n', they advanced `line` by one).
if line > 0 {
line -= 1;
}
}
if self.short_message {
let labels = msp

View File

@ -13,19 +13,15 @@ fn main() {
.input("multiple-dep-versions.rs")
.extern_("dependency", rust_lib_name("dependency"))
.extern_("dep_2_reexport", rust_lib_name("dependency2"))
.inspect(|cmd| eprintln!("{cmd:?}"))
.run_fail();
let stderr = out.stderr_utf8();
assert_contains(
&stderr,
"you have multiple different versions of crate `dependency` in your dependency graph",
);
assert_contains(
&stderr,
"two types coming from two different versions of the same crate are different types even \
if they look the same",
);
assert_contains(&stderr, "this type doesn't implement the required trait");
assert_contains(&stderr, "this type implements the required trait");
assert_contains(&stderr, "this is the required trait");
.run_fail()
.assert_stderr_contains(
"you have multiple different versions of crate `dependency` in your dependency graph",
)
.assert_stderr_contains(
"two types coming from two different versions of the same crate are different types \
even if they look the same",
)
.assert_stderr_contains("this type doesn't implement the required trait")
.assert_stderr_contains("this type implements the required trait")
.assert_stderr_contains("this is the required trait");
}