Skip to content

Commit 56120be

Browse files
committed
Remove render_span args from Diagnostic::{sub,sub_with_highlight}.
They're always `None`.
1 parent c392d7a commit 56120be

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed

compiler/rustc_errors/src/diagnostic.rs

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -425,22 +425,22 @@ impl Diagnostic {
425425
/// Add a note attached to this diagnostic.
426426
#[rustc_lint_diagnostics]
427427
pub fn note(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
428-
self.sub(Level::Note, msg, MultiSpan::new(), None);
428+
self.sub(Level::Note, msg, MultiSpan::new());
429429
self
430430
}
431431

432432
fn highlighted_note<M: Into<SubdiagnosticMessage>>(
433433
&mut self,
434434
msg: Vec<(M, Style)>,
435435
) -> &mut Self {
436-
self.sub_with_highlights(Level::Note, msg, MultiSpan::new(), None);
436+
self.sub_with_highlights(Level::Note, msg, MultiSpan::new());
437437
self
438438
}
439439

440440
/// Prints the span with a note above it.
441441
/// This is like [`Diagnostic::note()`], but it gets its own span.
442442
pub fn note_once(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
443-
self.sub(Level::OnceNote, msg, MultiSpan::new(), None);
443+
self.sub(Level::OnceNote, msg, MultiSpan::new());
444444
self
445445
}
446446

@@ -452,7 +452,7 @@ impl Diagnostic {
452452
sp: S,
453453
msg: impl Into<SubdiagnosticMessage>,
454454
) -> &mut Self {
455-
self.sub(Level::Note, msg, sp.into(), None);
455+
self.sub(Level::Note, msg, sp.into());
456456
self
457457
}
458458

@@ -463,14 +463,14 @@ impl Diagnostic {
463463
sp: S,
464464
msg: impl Into<SubdiagnosticMessage>,
465465
) -> &mut Self {
466-
self.sub(Level::OnceNote, msg, sp.into(), None);
466+
self.sub(Level::OnceNote, msg, sp.into());
467467
self
468468
}
469469

470470
/// Add a warning attached to this diagnostic.
471471
#[rustc_lint_diagnostics]
472472
pub fn warn(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
473-
self.sub(Level::Warning(None), msg, MultiSpan::new(), None);
473+
self.sub(Level::Warning(None), msg, MultiSpan::new());
474474
self
475475
}
476476

@@ -482,27 +482,27 @@ impl Diagnostic {
482482
sp: S,
483483
msg: impl Into<SubdiagnosticMessage>,
484484
) -> &mut Self {
485-
self.sub(Level::Warning(None), msg, sp.into(), None);
485+
self.sub(Level::Warning(None), msg, sp.into());
486486
self
487487
}
488488

489489
/// Add a help message attached to this diagnostic.
490490
#[rustc_lint_diagnostics]
491491
pub fn help(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
492-
self.sub(Level::Help, msg, MultiSpan::new(), None);
492+
self.sub(Level::Help, msg, MultiSpan::new());
493493
self
494494
}
495495

496496
/// Prints the span with a help above it.
497497
/// This is like [`Diagnostic::help()`], but it gets its own span.
498498
pub fn help_once(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self {
499-
self.sub(Level::OnceHelp, msg, MultiSpan::new(), None);
499+
self.sub(Level::OnceHelp, msg, MultiSpan::new());
500500
self
501501
}
502502

503503
/// Add a help message attached to this diagnostic with a customizable highlighted message.
504504
pub fn highlighted_help(&mut self, msg: Vec<(String, Style)>) -> &mut Self {
505-
self.sub_with_highlights(Level::Help, msg, MultiSpan::new(), None);
505+
self.sub_with_highlights(Level::Help, msg, MultiSpan::new());
506506
self
507507
}
508508

@@ -514,7 +514,7 @@ impl Diagnostic {
514514
sp: S,
515515
msg: impl Into<SubdiagnosticMessage>,
516516
) -> &mut Self {
517-
self.sub(Level::Help, msg, sp.into(), None);
517+
self.sub(Level::Help, msg, sp.into());
518518
self
519519
}
520520

@@ -952,21 +952,15 @@ impl Diagnostic {
952952
/// public methods above.
953953
///
954954
/// Used by `proc_macro_server` for implementing `server::Diagnostic`.
955-
pub fn sub(
956-
&mut self,
957-
level: Level,
958-
message: impl Into<SubdiagnosticMessage>,
959-
span: MultiSpan,
960-
render_span: Option<MultiSpan>,
961-
) {
955+
pub fn sub(&mut self, level: Level, message: impl Into<SubdiagnosticMessage>, span: MultiSpan) {
962956
let sub = SubDiagnostic {
963957
level,
964958
messages: vec![(
965959
self.subdiagnostic_message_to_diagnostic_message(message),
966960
Style::NoStyle,
967961
)],
968962
span,
969-
render_span,
963+
render_span: None,
970964
};
971965
self.children.push(sub);
972966
}
@@ -978,13 +972,12 @@ impl Diagnostic {
978972
level: Level,
979973
messages: Vec<(M, Style)>,
980974
span: MultiSpan,
981-
render_span: Option<MultiSpan>,
982975
) {
983976
let messages = messages
984977
.into_iter()
985978
.map(|m| (self.subdiagnostic_message_to_diagnostic_message(m.0), m.1))
986979
.collect();
987-
let sub = SubDiagnostic { level, messages, span, render_span };
980+
let sub = SubDiagnostic { level, messages, span, render_span: None };
988981
self.children.push(sub);
989982
}
990983

compiler/rustc_expand/src/proc_macro_server.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -499,12 +499,7 @@ impl server::FreeFunctions for Rustc<'_, '_> {
499499
rustc_errors::Diagnostic::new(diagnostic.level.to_internal(), diagnostic.message);
500500
diag.set_span(MultiSpan::from_spans(diagnostic.spans));
501501
for child in diagnostic.children {
502-
diag.sub(
503-
child.level.to_internal(),
504-
child.message,
505-
MultiSpan::from_spans(child.spans),
506-
None,
507-
);
502+
diag.sub(child.level.to_internal(), child.message, MultiSpan::from_spans(child.spans));
508503
}
509504
self.sess().dcx.emit_diagnostic(diag);
510505
}

0 commit comments

Comments
 (0)