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 @@ fn emit_messages_default_inner(
); );
line += 1; 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 { if self.short_message {
let labels = msp let labels = msp

View File

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