Skip to content

Commit 34d51b3

Browse files
committed
Increase suggestion code window from 6 lines to 20
1 parent d14a323 commit 34d51b3

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/librustc_errors/emitter.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,14 @@ impl Emitter for SilentEmitter {
456456
fn emit_diagnostic(&mut self, _: &Diagnostic) {}
457457
}
458458

459-
/// maximum number of lines we will print for each error; arbitrary.
459+
/// Maximum number of lines we will print for each error; arbitrary.
460460
pub const MAX_HIGHLIGHT_LINES: usize = 6;
461-
/// maximum number of suggestions to be shown
461+
/// Maximum number of lines we will print for a multiline suggestion; arbitrary.
462+
///
463+
/// This should be replaced with a more involved mechanism to output multiline suggestions that
464+
/// more closely mimmics the regular diagnostic output, where irrelevant code lines are ellided.
465+
pub const MAX_SUGGESTION_HIGHLIGHT_LINES: usize = 20;
466+
/// Maximum number of suggestions to be shown
462467
///
463468
/// Arbitrary, but taken from trait import suggestion limit
464469
pub const MAX_SUGGESTIONS: usize = 4;
@@ -1521,7 +1526,7 @@ impl EmitterWriter {
15211526
draw_col_separator_no_space(&mut buffer, 1, max_line_num_len + 1);
15221527
let mut line_pos = 0;
15231528
let mut lines = complete.lines();
1524-
for line in lines.by_ref().take(MAX_HIGHLIGHT_LINES) {
1529+
for line in lines.by_ref().take(MAX_SUGGESTION_HIGHLIGHT_LINES) {
15251530
// Print the span column to avoid confusion
15261531
buffer.puts(
15271532
row_num,

src/test/ui/issues/issue-22644.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ LL |
7474
LL | as
7575
LL |
7676
LL |
77-
...
77+
LL | usize)
78+
|
7879

7980
error: `<` is interpreted as a start of generic arguments for `usize`, not a shift
8081
--> $DIR/issue-22644.rs:32:31

src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ LL | dyn Foo(&isize) -> &isize >();
1313
LL | eq::< dyn for<'a> Foo<(&'a isize,), Output=(&'a isize, &'a isize)>,
1414
LL | dyn Foo(&isize) -> (&isize, &isize) >();
1515
LL |
16-
...
16+
LL | let _: dyn Foo(&isize, &usize) -> &'lifetime usize;
17+
|
1718

1819
error: aborting due to previous error
1920

0 commit comments

Comments
 (0)