about summary refs log tree commit diff
path: root/src/libsyntax_pos/lib.rs
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-07-30 13:44:47 +0530
committerGitHub <noreply@github.com>2016-07-30 13:44:47 +0530
commit6ea3ef7ac258c75f800ea919aaf74ad0bb4e93c3 (patch)
treee85196d3360b3cec516a2b768a6e74979049f1ef /src/libsyntax_pos/lib.rs
parente649a2535f150d02a8e87edd184b6412a3d9604a (diff)
parent6dc98cf099d1fc3209e1354144f2190c052c8a0b (diff)
downloadrust-6ea3ef7ac258c75f800ea919aaf74ad0bb4e93c3.tar.gz
rust-6ea3ef7ac258c75f800ea919aaf74ad0bb4e93c3.zip
Rollup merge of #35094 - mcarton:multispan, r=jonathandturner
Revert "Remove unused methods from MultiSpan"

This reverts commit f7019a4e2f80577d38ec35fcebd64d5970b15f78.

That commit removed the only way to make a suggestion with more than one substitute. That feature is not used directly by rustc but exists and is used by Clippy. Bring it back until we come up with a better solution (suggestions don't use span labels, so it would make sense for them to use their own type).
Rational there: https://github.com/Manishearth/rust-clippy/pull/1119.

r? @jonathandturner
Cc @Manishearth
Diffstat (limited to 'src/libsyntax_pos/lib.rs')
-rw-r--r--src/libsyntax_pos/lib.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs
index b1ec7fd0ab8..0f171805bb0 100644
--- a/src/libsyntax_pos/lib.rs
+++ b/src/libsyntax_pos/lib.rs
@@ -193,6 +193,20 @@ impl MultiSpan {
         }
     }
 
+    pub fn from_span(primary_span: Span) -> MultiSpan {
+        MultiSpan {
+            primary_spans: vec![primary_span],
+            span_labels: vec![]
+        }
+    }
+
+    pub fn from_spans(vec: Vec<Span>) -> MultiSpan {
+        MultiSpan {
+            primary_spans: vec,
+            span_labels: vec![]
+        }
+    }
+
     pub fn push_span_label(&mut self, span: Span, label: String) {
         self.span_labels.push((span, label));
     }
@@ -240,10 +254,7 @@ impl MultiSpan {
 
 impl From<Span> for MultiSpan {
     fn from(span: Span) -> MultiSpan {
-        MultiSpan {
-            primary_spans: vec![span],
-            span_labels: vec![]
-        }
+        MultiSpan::from_span(span)
     }
 }