From 6dc98cf099d1fc3209e1354144f2190c052c8a0b Mon Sep 17 00:00:00 2001 From: mcarton Date: Thu, 28 Jul 2016 19:33:31 +0200 Subject: [PATCH] Revert "Remove unused methods from MultiSpan" 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 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index c96be8fec2b..7dfe19452a2 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) -> 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 for MultiSpan { fn from(span: Span) -> MultiSpan { - MultiSpan { - primary_spans: vec![span], - span_labels: vec![] - } + MultiSpan::from_span(span) } }