Skip to content

Commit d24c315

Browse files
committed
Remove SubDiagnostic::render_span.
It's only ever set to `None`.
1 parent 56120be commit d24c315

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

compiler/rustc_errors/src/diagnostic.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ pub struct SubDiagnostic {
163163
pub level: Level,
164164
pub messages: Vec<(DiagnosticMessage, Style)>,
165165
pub span: MultiSpan,
166-
pub render_span: Option<MultiSpan>,
167166
}
168167

169168
#[derive(Debug, PartialEq, Eq)]
@@ -960,7 +959,6 @@ impl Diagnostic {
960959
Style::NoStyle,
961960
)],
962961
span,
963-
render_span: None,
964962
};
965963
self.children.push(sub);
966964
}
@@ -977,7 +975,7 @@ impl Diagnostic {
977975
.into_iter()
978976
.map(|m| (self.subdiagnostic_message_to_diagnostic_message(m.0), m.1))
979977
.collect();
980-
let sub = SubDiagnostic { level, messages, span, render_span: None };
978+
let sub = SubDiagnostic { level, messages, span };
981979
self.children.push(sub);
982980
}
983981

compiler/rustc_errors/src/emitter.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ pub trait Emitter: Translate {
352352
level: Level::Note,
353353
messages: vec![(DiagnosticMessage::from(msg), Style::NoStyle)],
354354
span: MultiSpan::new(),
355-
render_span: None,
356355
});
357356
}
358357
}
@@ -2118,7 +2117,7 @@ impl EmitterWriter {
21182117
}
21192118
if !self.short_message {
21202119
for child in children {
2121-
let span = child.render_span.as_ref().unwrap_or(&child.span);
2120+
let span = &child.span;
21222121
if let Err(err) = self.emit_messages_default_inner(
21232122
span,
21242123
&child.messages,

compiler/rustc_errors/src/json.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,7 @@ impl Diagnostic {
424424
message: translated_message.to_string(),
425425
code: None,
426426
level: diag.level.to_str(),
427-
spans: diag
428-
.render_span
429-
.as_ref()
430-
.map(|sp| DiagnosticSpan::from_multispan(sp, args, je))
431-
.unwrap_or_else(|| DiagnosticSpan::from_multispan(&diag.span, args, je)),
427+
spans: DiagnosticSpan::from_multispan(&diag.span, args, je),
432428
children: vec![],
433429
rendered: None,
434430
}

0 commit comments

Comments
 (0)