nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: rust-lang/annotate-snippets-rs
Pull request #5 (2019-07-15 05:50:38)

Fix too many anonymized line numbers
This expands the logic for replacing line numbers with `LL` so that line
numbers are only replaced, when they are actually provided.

When `lineno` is `None`, no `LL` should be shown in the output.


Patch:
diff --git a/src/formatter/mod.rs b/src/formatter/mod.rs
index eb1392d..654b518 100644
--- a/src/formatter/mod.rs
+++ b/src/formatter/mod.rs
@@ -303,7 +303,7 @@ impl DisplayListFormatter {
                 inline_marks,
                 line,
             } => {
-                let lineno = if self.anonymized_line_numbers {
+                let lineno = if self.anonymized_line_numbers  && lineno.is_some() {
                     Self::ANONYMIZED_LINE_NUM.to_string()
                 } else {
                     self.format_lineno(*lineno, lineno_width)


Test patch:
diff --git a/tests/formatter.rs b/tests/formatter.rs
index c0bdc11..844c358 100644
--- a/tests/formatter.rs
+++ b/tests/formatter.rs
@@ -515,13 +515,26 @@ fn test_anon_lines() {
                 range: (0, 19),
             },
         },
+        DisplayLine::Source {
+            lineno: None,
+            inline_marks: vec![],
+            line: DisplaySourceLine::Empty,
+        },
+        DisplayLine::Source {
+            lineno: None,
+            inline_marks: vec![],
+            line: DisplaySourceLine::Content {
+                text: "abc".to_string(),
+                range: (0, 19),
+            },
+        },
     ]);
 
     let dlf = DisplayListFormatter::new(false, true);
 
     assert_eq!(
         dlf.format(&dl),
-        "LL | This is an example\nLL | of content lines"
+        "LL | This is an example\nLL | of content lines\n   |\n   | abc"
     );
 }
Repository: rust-lang/annotate-snippets-rs
Pull request #22 (2020-01-12 18:37:08)

Start column numbers from 1
This is a small change to start column numbers from 1 instead of 0.

Issue: #17


Patch:
diff --git a/src/display_list/from_snippet.rs b/src/display_list/from_snippet.rs
index e3d79ed..a30bf40 100644
--- a/src/display_list/from_snippet.rs
+++ b/src/display_list/from_snippet.rs
@@ -92,7 +92,7 @@ fn format_header(
             } = item
             {
                 if annotation.range.0 >= range.0 && annotation.range.0 <= range.1 {
-                    col = annotation.range.0 - range.0;
+                    col = annotation.range.0 - range.0 + 1;
                     break;
                 }
                 row += 1;


Test patch:
diff --git a/tests/fixtures/no-color/multiline_annotation.txt b/tests/fixtures/no-color/multiline_annotation.txt
index b900784..bacdec1 100644
--- a/tests/fixtures/no-color/multiline_annotation.txt
+++ b/tests/fixtures/no-color/multiline_annotation.txt
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> src/format.rs:51:5
+  --> src/format.rs:51:6
    |
 51 |   ) -> Option<String> {
    |        -------------- expected `std::option::Option<std::string::String>` because of return type
diff --git a/tests/fixtures/no-color/multiline_annotation2.txt b/tests/fixtures/no-color/multiline_annotation2.txt
index 5234ee8..8a00bfa 100644
--- a/tests/fixtures/no-color/multiline_annotation2.txt
+++ b/tests/fixtures/no-color/multiline_annotation2.txt
@@ -1,5 +1,5 @@
 error[E0027]: pattern does not mention fields `lineno`, `content`
-   --> src/display_list.rs:139:31
+   --> src/display_list.rs:139:32
     |
 139 |                           if let DisplayLine::Source {
     |  ________________________________^
diff --git a/tests/fixtures/no-color/simple.txt b/tests/fixtures/no-color/simple.txt
index a5a3136..752cc89 100644
--- a/tests/fixtures/no-color/simple.txt
+++ b/tests/fixtures/no-color/simple.txt
@@ -1,5 +1,5 @@
 error: expected one of `.`, `;`, `?`, or an operator, found `for`
-   --> src/format_color.rs:171:8
+   --> src/format_color.rs:171:9
     |
 169 |         })
     |           - expected one of `.`, `;`, `?`, or an operator here
Repository: rust-lang/annotate-snippets-rs
Pull request #23 (2020-01-12 21:02:31)

Fix single char overflow display issue
Fixes the error described in #16. Previously, when a single character of
an annotation overflows to a new line, the DisplayList would incorrectly
consider that character on the same line. This change fixes this and
adds a new fixture test for this case.


Patch:
diff --git a/src/display_list/from_snippet.rs b/src/display_list/from_snippet.rs
index a30bf40..2ba3b70 100644
--- a/src/display_list/from_snippet.rs
+++ b/src/display_list/from_snippet.rs
@@ -214,7 +214,7 @@ fn format_body(slice: &snippet::Slice, has_footer: bool) -> Vec<DisplayLine> {
                 };
                 match annotation.range {
                     (start, _) if start > line_end => true,
-                    (start, end) if start >= line_start && end <= line_end + 1 => {
+                    (start, end) if start >= line_start && end <= line_end => {
                         let range = (start - line_start, end - line_start);
                         body.insert(
                             body_idx + 1,


Test patch:
diff --git a/tests/fixtures/no-color/multiline_annotation3.txt b/tests/fixtures/no-color/multiline_annotation3.txt
new file mode 100644
index 0000000..12e174c
--- /dev/null
+++ b/tests/fixtures/no-color/multiline_annotation3.txt
@@ -0,0 +1,9 @@
+error[E####]: spacing error found
+  --> foo.txt:26:12
+   |
+26 |   This is an exampl
+   |  ____________^
+27 | | e of an edge case of an annotation overflowing
+   | |_^ this should not be on separate lines
+28 |   to exactly one character on next line.
+   |
\ No newline at end of file
diff --git a/tests/fixtures/no-color/multiline_annotation3.yaml b/tests/fixtures/no-color/multiline_annotation3.yaml
new file mode 100644
index 0000000..65b50bf
--- /dev/null
+++ b/tests/fixtures/no-color/multiline_annotation3.yaml
@@ -0,0 +1,16 @@
+slices:
+  - source: |-
+      This is an exampl
+      e of an edge case of an annotation overflowing
+      to exactly one character on next line.
+    line_start: 26
+    origin: foo.txt
+    fold: false
+    annotations:
+      - label: this should not be on separate lines
+        annotation_type: Error
+        range: [11, 19]
+title:
+  label: spacing error found
+  id: E####
+  annotation_type: Error