Increase suggestion code window from 6 lines to 20

This commit is contained in:
Esteban Küber 2020-01-24 11:18:45 -08:00
parent d14a323e74
commit 34d51b3378
3 changed files with 12 additions and 5 deletions

View File

@ -456,9 +456,14 @@ impl Emitter for SilentEmitter {
fn emit_diagnostic(&mut self, _: &Diagnostic) {}
}
/// maximum number of lines we will print for each error; arbitrary.
/// Maximum number of lines we will print for each error; arbitrary.
pub const MAX_HIGHLIGHT_LINES: usize = 6;
/// maximum number of suggestions to be shown
/// Maximum number of lines we will print for a multiline suggestion; arbitrary.
///
/// This should be replaced with a more involved mechanism to output multiline suggestions that
/// more closely mimmics the regular diagnostic output, where irrelevant code lines are ellided.
pub const MAX_SUGGESTION_HIGHLIGHT_LINES: usize = 20;
/// Maximum number of suggestions to be shown
///
/// Arbitrary, but taken from trait import suggestion limit
pub const MAX_SUGGESTIONS: usize = 4;
@ -1521,7 +1526,7 @@ impl EmitterWriter {
draw_col_separator_no_space(&mut buffer, 1, max_line_num_len + 1);
let mut line_pos = 0;
let mut lines = complete.lines();
for line in lines.by_ref().take(MAX_HIGHLIGHT_LINES) {
for line in lines.by_ref().take(MAX_SUGGESTION_HIGHLIGHT_LINES) {
// Print the span column to avoid confusion
buffer.puts(
row_num,

View File

@ -74,7 +74,8 @@ LL |
LL | as
LL |
LL |
...
LL | usize)
|
error: `<` is interpreted as a start of generic arguments for `usize`, not a shift
--> $DIR/issue-22644.rs:32:31

View File

@ -13,7 +13,8 @@ LL | dyn Foo(&isize) -> &isize >();
LL | eq::< dyn for<'a> Foo<(&'a isize,), Output=(&'a isize, &'a isize)>,
LL | dyn Foo(&isize) -> (&isize, &isize) >();
LL |
...
LL | let _: dyn Foo(&isize, &usize) -> &'lifetime usize;
|
error: aborting due to previous error