Skip to content

Commit 034b73b

Browse files
committed
fix test
1 parent 5e26c8d commit 034b73b

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

compiler/rustc_errors/src/emitter.rs

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

tests/run-make/crate-loading/rmake.rs

+11-15
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,15 @@ fn main() {
1313
.input("multiple-dep-versions.rs")
1414
.extern_("dependency", rust_lib_name("dependency"))
1515
.extern_("dep_2_reexport", rust_lib_name("dependency2"))
16-
.inspect(|cmd| eprintln!("{cmd:?}"))
17-
.run_fail();
18-
let stderr = out.stderr_utf8();
19-
assert_contains(
20-
&stderr,
21-
"you have multiple different versions of crate `dependency` in your dependency graph",
22-
);
23-
assert_contains(
24-
&stderr,
25-
"two types coming from two different versions of the same crate are different types even \
26-
if they look the same",
27-
);
28-
assert_contains(&stderr, "this type doesn't implement the required trait");
29-
assert_contains(&stderr, "this type implements the required trait");
30-
assert_contains(&stderr, "this is the required trait");
16+
.run_fail()
17+
.assert_stderr_contains(
18+
"you have multiple different versions of crate `dependency` in your dependency graph",
19+
)
20+
.assert_stderr_contains(
21+
"two types coming from two different versions of the same crate are different types \
22+
even if they look the same",
23+
)
24+
.assert_stderr_contains("this type doesn't implement the required trait")
25+
.assert_stderr_contains("this type implements the required trait")
26+
.assert_stderr_contains("this is the required trait");
3127
}

0 commit comments

Comments
 (0)