summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-03-29 12:32:28 +0100
committerGitHub <noreply@github.com>2019-03-29 12:32:28 +0100
commitc105f34fcbb1bdb17cf1a20bbdb87881a5530567 (patch)
treee31eead154b00055c4b6f4dee5f22e103b660b6b /src/libsyntax
parentfda206633da99468b4f813a2f888e05e31bafa2d (diff)
parentb5690c2cb86afc48e958e0d58ff1916c75f65b66 (diff)
downloadrust-c105f34fcbb1bdb17cf1a20bbdb87881a5530567.tar.gz
rust-c105f34fcbb1bdb17cf1a20bbdb87881a5530567.zip
Rollup merge of #59473 - estebank:borrow-sugg-inside-macro, r=davidtwco
Do not emit incorrect borrow suggestion involving macros and fix overlapping multiline spans

Fix #58298.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/test_snippet.rs60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/libsyntax/test_snippet.rs b/src/libsyntax/test_snippet.rs
index 2b3d18835d5..86910ffd894 100644
--- a/src/libsyntax/test_snippet.rs
+++ b/src/libsyntax/test_snippet.rs
@@ -375,6 +375,66 @@ error: foo
 }
 
 #[test]
+fn triple_exact_overlap() {
+    test_harness(r#"
+fn foo() {
+  X0 Y0 Z0
+  X1 Y1 Z1
+  X2 Y2 Z2
+}
+"#,
+    vec![
+        SpanLabel {
+            start: Position {
+                string: "X0",
+                count: 1,
+            },
+            end: Position {
+                string: "X2",
+                count: 1,
+            },
+            label: "`X` is a good letter",
+        },
+        SpanLabel {
+            start: Position {
+                string: "X0",
+                count: 1,
+            },
+            end: Position {
+                string: "X2",
+                count: 1,
+            },
+            label: "`Y` is a good letter too",
+        },
+        SpanLabel {
+            start: Position {
+                string: "X0",
+                count: 1,
+            },
+            end: Position {
+                string: "X2",
+                count: 1,
+            },
+            label: "`Z` label",
+        },
+    ],
+    r#"
+error: foo
+ --> test.rs:3:3
+  |
+3 | /   X0 Y0 Z0
+4 | |   X1 Y1 Z1
+5 | |   X2 Y2 Z2
+  | |    ^
+  | |    |
+  | |    `X` is a good letter
+  | |____`Y` is a good letter too
+  |      `Z` label
+
+"#);
+}
+
+#[test]
 fn minimum_depth() {
     test_harness(r#"
 fn foo() {