Skip to content

Commit a2ca458

Browse files
committed
fix: Add col separator before secondary messages with no source
1 parent fde89c3 commit a2ca458

File tree

41 files changed

+89
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+89
-0
lines changed

compiler/rustc_errors/src/emitter.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,6 +1590,9 @@ impl HumanEmitter {
15901590
annotated_files.swap(0, pos);
15911591
}
15921592

1593+
// An end column separator should be emitted when a file with with a
1594+
// source, is followed by one without a source
1595+
let mut col_sep_before_no_show_source = false;
15931596
let mut already_closed = None;
15941597
let annotated_files_len = annotated_files.len();
15951598
// Print out the annotate source lines that correspond with the error
@@ -1601,6 +1604,26 @@ impl HumanEmitter {
16011604
&annotated_file.file,
16021605
) {
16031606
if !self.short_message {
1607+
// Add an end column separator when a file without a source
1608+
// comes after one with a source
1609+
// ╭▸ $DIR/deriving-meta-unknown-trait.rs:1:10
1610+
// │
1611+
// LL │ #[derive(Eqr)]
1612+
// │ ━━━
1613+
// ╰╴ (<- It prints *this* line)
1614+
// ╭▸ $SRC_DIR/core/src/cmp.rs:356:0
1615+
// │
1616+
// ╰╴note: similarly named derive macro `Eq` defined here
1617+
if col_sep_before_no_show_source {
1618+
let buffer_msg_line_offset = buffer.num_lines();
1619+
self.draw_col_separator_end(
1620+
&mut buffer,
1621+
buffer_msg_line_offset,
1622+
max_line_num_len + 1,
1623+
);
1624+
}
1625+
col_sep_before_no_show_source = false;
1626+
16041627
// We'll just print an unannotated message.
16051628
for (annotation_id, line) in annotated_file.lines.iter().enumerate() {
16061629
let mut annotations = line.annotations.clone();
@@ -1670,6 +1693,8 @@ impl HumanEmitter {
16701693
}
16711694
}
16721695
continue;
1696+
} else {
1697+
col_sep_before_no_show_source = true;
16731698
}
16741699

16751700
// print out the span ___location and spacer before we print the annotated source

tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ error[E0599]: no method named `poll` found for struct `Pin<&mut impl Future<Outp
2525
|
2626
LL | match fut.as_mut().poll(ctx) {
2727
| ^^^^ method not found in `Pin<&mut impl Future<Output = ()>>`
28+
|
2829
--> $SRC_DIR/core/src/future/future.rs:LL:COL
2930
|
3031
= note: the method is available for `Pin<&mut impl Future<Output = ()>>` here

tests/ui/c-variadic/issue-86053-1.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ error[E0412]: cannot find type `F` in this scope
5757
|
5858
LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
5959
| ^
60+
|
6061
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
6162
|
6263
= note: similarly named trait `Fn` defined here

tests/ui/closures/issue-78720.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ error[E0412]: cannot find type `F` in this scope
99
|
1010
LL | _func: F,
1111
| ^
12+
|
1213
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
1314
|
1415
= note: similarly named trait `Fn` defined here

tests/ui/closures/issue-90871.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ error[E0412]: cannot find type `n` in this scope
33
|
44
LL | type_ascribe!(2, n([u8; || 1]))
55
| ^ help: a trait with a similar name exists: `Fn`
6+
|
67
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
78
|
89
= note: similarly named trait `Fn` defined here

tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ error[E0412]: cannot find type `F` in this scope
33
|
44
LL | let f: F = async { 1 };
55
| ^
6+
|
67
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
78
|
89
= note: similarly named trait `Fn` defined here

tests/ui/consts/issue-89088.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LL | const FOO: &A = &A::Field(Cow::Borrowed("foo"));
66
...
77
LL | FOO => todo!(),
88
| ^^^ constant of non-structural type
9+
|
910
--> $SRC_DIR/alloc/src/borrow.rs:LL:COL
1011
|
1112
= note: `Cow<'_, str>` must be annotated with `#[derive(PartialEq)]` to be usable in patterns

tests/ui/derives/deriving-meta-unknown-trait.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ error: cannot find derive macro `Eqr` in this scope
33
|
44
LL | #[derive(Eqr)]
55
| ^^^ help: a derive macro with a similar name exists: `Eq`
6+
|
67
--> $SRC_DIR/core/src/cmp.rs:LL:COL
78
|
89
= note: similarly named derive macro `Eq` defined here
@@ -12,6 +13,7 @@ error: cannot find derive macro `Eqr` in this scope
1213
|
1314
LL | #[derive(Eqr)]
1415
| ^^^ help: a derive macro with a similar name exists: `Eq`
16+
|
1517
--> $SRC_DIR/core/src/cmp.rs:LL:COL
1618
|
1719
= note: similarly named derive macro `Eq` defined here

tests/ui/did_you_mean/println-typo.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ error: cannot find macro `prinltn` in this scope
33
|
44
LL | prinltn!();
55
| ^^^^^^^ help: a macro with a similar name exists: `println`
6+
|
67
--> $SRC_DIR/std/src/macros.rs:LL:COL
78
|
89
= note: similarly named macro `println` defined here

tests/ui/impl-trait/call_method_without_import.no_import.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ error[E0599]: no method named `fmt` found for opaque type `impl Debug` in the cu
33
|
44
LL | x.fmt(f);
55
| ^^^ method not found in `impl Debug`
6+
|
67
--> $SRC_DIR/core/src/fmt/mod.rs:LL:COL
78
|
89
= note: the method is available for `impl Debug` here

0 commit comments

Comments
 (0)