mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 12:39:31 +03:00
Make fields of Span private
This commit is contained in:
@@ -183,8 +183,8 @@ fn add_annotation_to_file(file_vec: &mut Vec<FileWithAnnotatedLines>,
|
||||
continue;
|
||||
}
|
||||
|
||||
let lo = cm.lookup_char_pos(span_label.span.lo);
|
||||
let mut hi = cm.lookup_char_pos(span_label.span.hi);
|
||||
let lo = cm.lookup_char_pos(span_label.span.lo());
|
||||
let mut hi = cm.lookup_char_pos(span_label.span.hi());
|
||||
|
||||
// Watch out for "empty spans". If we get a span like 6..6, we
|
||||
// want to just display a `^` at 6, so convert that to
|
||||
@@ -683,7 +683,7 @@ fn get_multispan_max_line_num(&mut self, msp: &MultiSpan) -> usize {
|
||||
if let Some(ref cm) = self.cm {
|
||||
for primary_span in msp.primary_spans() {
|
||||
if primary_span != &DUMMY_SP {
|
||||
let hi = cm.lookup_char_pos(primary_span.hi);
|
||||
let hi = cm.lookup_char_pos(primary_span.hi());
|
||||
if hi.line > max {
|
||||
max = hi.line;
|
||||
}
|
||||
@@ -691,7 +691,7 @@ fn get_multispan_max_line_num(&mut self, msp: &MultiSpan) -> usize {
|
||||
}
|
||||
for span_label in msp.span_labels() {
|
||||
if span_label.span != DUMMY_SP {
|
||||
let hi = cm.lookup_char_pos(span_label.span.hi);
|
||||
let hi = cm.lookup_char_pos(span_label.span.hi());
|
||||
if hi.line > max {
|
||||
max = hi.line;
|
||||
}
|
||||
@@ -914,7 +914,7 @@ fn emit_message_default(&mut self,
|
||||
let (primary_lo, cm) = if let (Some(cm), Some(ref primary_span)) =
|
||||
(self.cm.as_ref(), msp.primary_span().as_ref()) {
|
||||
if primary_span != &&DUMMY_SP {
|
||||
(cm.lookup_char_pos(primary_span.lo), cm)
|
||||
(cm.lookup_char_pos(primary_span.lo()), cm)
|
||||
} else {
|
||||
emit_to_destination(&buffer.render(), level, &mut self.dst)?;
|
||||
return Ok(());
|
||||
@@ -1091,7 +1091,7 @@ fn emit_suggestion_default(&mut self,
|
||||
Some(Style::HeaderMsg));
|
||||
|
||||
let suggestions = suggestion.splice_lines(cm.borrow());
|
||||
let span_start_pos = cm.lookup_char_pos(primary_sub.span.lo);
|
||||
let span_start_pos = cm.lookup_char_pos(primary_sub.span.lo());
|
||||
let line_start = span_start_pos.line;
|
||||
draw_col_separator_no_space(&mut buffer, 1, max_line_num_len + 1);
|
||||
let mut row_num = 2;
|
||||
|
||||
@@ -148,16 +148,12 @@ fn push_trailing(buf: &mut String,
|
||||
|
||||
// Assumption: all spans are in the same file, and all spans
|
||||
// are disjoint. Sort in ascending order.
|
||||
primary_spans.sort_by_key(|sp| sp.0.lo);
|
||||
primary_spans.sort_by_key(|sp| sp.0.lo());
|
||||
|
||||
// Find the bounding span.
|
||||
let lo = primary_spans.iter().map(|sp| sp.0.lo).min().unwrap();
|
||||
let hi = primary_spans.iter().map(|sp| sp.0.hi).min().unwrap();
|
||||
let bounding_span = Span {
|
||||
lo,
|
||||
hi,
|
||||
ctxt: NO_EXPANSION,
|
||||
};
|
||||
let lo = primary_spans.iter().map(|sp| sp.0.lo()).min().unwrap();
|
||||
let hi = primary_spans.iter().map(|sp| sp.0.hi()).min().unwrap();
|
||||
let bounding_span = Span::new(lo, hi, NO_EXPANSION);
|
||||
let lines = cm.span_to_lines(bounding_span).unwrap();
|
||||
assert!(!lines.lines.is_empty());
|
||||
|
||||
@@ -171,14 +167,14 @@ fn push_trailing(buf: &mut String,
|
||||
//
|
||||
// Finally push the trailing line segment of the last span
|
||||
let fm = &lines.file;
|
||||
let mut prev_hi = cm.lookup_char_pos(bounding_span.lo);
|
||||
let mut prev_hi = cm.lookup_char_pos(bounding_span.lo());
|
||||
prev_hi.col = CharPos::from_usize(0);
|
||||
|
||||
let mut prev_line = fm.get_line(lines.lines[0].line_index);
|
||||
let mut bufs = vec![(String::new(), false); self.substitutions()];
|
||||
|
||||
for (sp, substitutes) in primary_spans {
|
||||
let cur_lo = cm.lookup_char_pos(sp.lo);
|
||||
let cur_lo = cm.lookup_char_pos(sp.lo());
|
||||
for (&mut (ref mut buf, ref mut underline), substitute) in bufs.iter_mut()
|
||||
.zip(substitutes) {
|
||||
if prev_hi.line == cur_lo.line {
|
||||
@@ -208,7 +204,7 @@ fn push_trailing(buf: &mut String,
|
||||
}
|
||||
buf.push_str(substitute);
|
||||
}
|
||||
prev_hi = cm.lookup_char_pos(sp.hi);
|
||||
prev_hi = cm.lookup_char_pos(sp.hi());
|
||||
prev_line = fm.get_line(prev_hi.line - 1);
|
||||
}
|
||||
for &mut (ref mut buf, _) in &mut bufs {
|
||||
|
||||
Reference in New Issue
Block a user