Skip to content

Commit 09689b9

Browse files
authored
Rollup merge of rust-lang#35094 - mcarton:multispan, r=jonathandturner
Revert "Remove unused methods from MultiSpan" This reverts commit f7019a4. 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
2 parents 8d6f9ae + 6dc98cf commit 09689b9

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/libsyntax_pos/lib.rs

+15-4
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,20 @@ impl MultiSpan {
193193
}
194194
}
195195

196+
pub fn from_span(primary_span: Span) -> MultiSpan {
197+
MultiSpan {
198+
primary_spans: vec![primary_span],
199+
span_labels: vec![]
200+
}
201+
}
202+
203+
pub fn from_spans(vec: Vec<Span>) -> MultiSpan {
204+
MultiSpan {
205+
primary_spans: vec,
206+
span_labels: vec![]
207+
}
208+
}
209+
196210
pub fn push_span_label(&mut self, span: Span, label: String) {
197211
self.span_labels.push((span, label));
198212
}
@@ -240,10 +254,7 @@ impl MultiSpan {
240254

241255
impl From<Span> for MultiSpan {
242256
fn from(span: Span) -> MultiSpan {
243-
MultiSpan {
244-
primary_spans: vec![span],
245-
span_labels: vec![]
246-
}
257+
MultiSpan::from_span(span)
247258
}
248259
}
249260

0 commit comments

Comments
 (0)