]> git.lizzy.rs Git - rust.git/commitdiff
Revert "Remove unused methods from MultiSpan"
authormcarton <cartonmartin+git@gmail.com>
Thu, 28 Jul 2016 17:33:31 +0000 (19:33 +0200)
committermcarton <cartonmartin+git@gmail.com>
Thu, 28 Jul 2016 17:33:31 +0000 (19:33 +0200)
This reverts commit f7019a4e2f80577d38ec35fcebd64d5970b15f78.

This removed the only way to make a suggestion with more than one
substitute. Bring it back until we come up with a better solution.

src/libsyntax_pos/lib.rs

index c96be8fec2b02abb4ffffecddaa0884187641303..7dfe19452a2a933a64cdd849e2a21ce535880f50 100644 (file)
@@ -193,6 +193,20 @@ pub fn new() -> 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 @@ pub fn span_labels(&self) -> Vec<SpanLabel> {
 
 impl From<Span> for MultiSpan {
     fn from(span: Span) -> MultiSpan {
-        MultiSpan {
-            primary_spans: vec![span],
-            span_labels: vec![]
-        }
+        MultiSpan::from_span(span)
     }
 }