]> git.lizzy.rs Git - rust.git/commitdiff
Increase suggestion code window from 6 lines to 20
authorEsteban Küber <esteban@kuber.com.ar>
Fri, 24 Jan 2020 19:18:45 +0000 (11:18 -0800)
committerEsteban Küber <esteban@kuber.com.ar>
Fri, 24 Jan 2020 19:18:45 +0000 (11:18 -0800)
src/librustc_errors/emitter.rs
src/test/ui/issues/issue-22644.stderr
src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr

index b0e0cb611afaffb60711b97e46c21e669ff2d4dc..2149e46a1cfbc9327c6df084c06225c0e2f3cf67 100644 (file)
@@ -456,9 +456,14 @@ fn source_map(&self) -> Option<&Lrc<SourceMap>> {
     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 @@ fn emit_suggestion_default(
             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,
index 2bddcc2ba56ceaa11b946b5de8f9f549bd06dbc5..105cf73652586f13bc0952c8204a78fefbad69e2 100644 (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
index 0a028e44919a6b144aad1d19c66729802d4f00e1..469425ea44ded8dd10c080aec1ff617430a36fad 100644 (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