Skip to content

Commit d51b3db

Browse files
committed
Remove some unused code, and downgrade some pubs.
1 parent 32dc78e commit d51b3db

File tree

3 files changed

+6
-49
lines changed

3 files changed

+6
-49
lines changed

compiler/rustc_errors/src/diagnostic.rs

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ impl Diagnostic {
239239
}
240240

241241
#[track_caller]
242-
pub fn new_with_code<M: Into<DiagnosticMessage>>(
242+
pub(crate) fn new_with_code<M: Into<DiagnosticMessage>>(
243243
level: Level,
244244
code: Option<DiagnosticId>,
245245
message: M,
@@ -281,7 +281,7 @@ impl Diagnostic {
281281
}
282282
}
283283

284-
pub fn update_unstable_expectation_id(
284+
pub(crate) fn update_unstable_expectation_id(
285285
&mut self,
286286
unstable_to_stable: &FxHashMap<LintExpectationId, LintExpectationId>,
287287
) {
@@ -307,14 +307,14 @@ impl Diagnostic {
307307
}
308308

309309
/// Indicates whether this diagnostic should show up in cargo's future breakage report.
310-
pub fn has_future_breakage(&self) -> bool {
310+
pub(crate) fn has_future_breakage(&self) -> bool {
311311
match self.code {
312312
Some(DiagnosticId::Lint { has_future_breakage, .. }) => has_future_breakage,
313313
_ => false,
314314
}
315315
}
316316

317-
pub fn is_force_warn(&self) -> bool {
317+
pub(crate) fn is_force_warn(&self) -> bool {
318318
match self.code {
319319
Some(DiagnosticId::Lint { is_force_warn, .. }) => is_force_warn,
320320
_ => false,
@@ -391,29 +391,6 @@ impl Diagnostic {
391391
self.note_expected_found_extra(expected_label, expected, found_label, found, &"", &"")
392392
}
393393

394-
pub fn note_unsuccessful_coercion(
395-
&mut self,
396-
expected: DiagnosticStyledString,
397-
found: DiagnosticStyledString,
398-
) -> &mut Self {
399-
let mut msg: Vec<_> =
400-
vec![(Cow::from("required when trying to coerce from type `"), Style::NoStyle)];
401-
msg.extend(expected.0.iter().map(|x| match *x {
402-
StringPart::Normal(ref s) => (Cow::from(s.clone()), Style::NoStyle),
403-
StringPart::Highlighted(ref s) => (Cow::from(s.clone()), Style::Highlight),
404-
}));
405-
msg.push((Cow::from("` to type '"), Style::NoStyle));
406-
msg.extend(found.0.iter().map(|x| match *x {
407-
StringPart::Normal(ref s) => (Cow::from(s.clone()), Style::NoStyle),
408-
StringPart::Highlighted(ref s) => (Cow::from(s.clone()), Style::Highlight),
409-
}));
410-
msg.push((Cow::from("`"), Style::NoStyle));
411-
412-
// For now, just attach these as notes
413-
self.highlighted_note(msg);
414-
self
415-
}
416-
417394
pub fn note_expected_found_extra(
418395
&mut self,
419396
expected_label: &dyn fmt::Display,
@@ -475,7 +452,7 @@ impl Diagnostic {
475452
self
476453
}
477454

478-
pub fn highlighted_note<M: Into<SubdiagnosticMessage>>(
455+
fn highlighted_note<M: Into<SubdiagnosticMessage>>(
479456
&mut self,
480457
msg: Vec<(M, Style)>,
481458
) -> &mut Self {
@@ -572,14 +549,6 @@ impl Diagnostic {
572549
self
573550
}
574551

575-
/// Clear any existing suggestions.
576-
pub fn clear_suggestions(&mut self) -> &mut Self {
577-
if let Ok(suggestions) = &mut self.suggestions {
578-
suggestions.clear();
579-
}
580-
self
581-
}
582-
583552
/// Helper for pushing to `self.suggestions`, if available (not disable).
584553
fn push_suggestion(&mut self, suggestion: CodeSuggestion) {
585554
if let Ok(suggestions) = &mut self.suggestions {
@@ -992,7 +961,7 @@ impl Diagnostic {
992961
/// Helper function that takes a `SubdiagnosticMessage` and returns a `DiagnosticMessage` by
993962
/// combining it with the primary message of the diagnostic (if translatable, otherwise it just
994963
/// passes the user's string along).
995-
pub(crate) fn subdiagnostic_message_to_diagnostic_message(
964+
fn subdiagnostic_message_to_diagnostic_message(
996965
&self,
997966
attr: impl Into<SubdiagnosticMessage>,
998967
) -> DiagnosticMessage {

compiler/rustc_errors/src/diagnostic_builder.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -547,12 +547,6 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
547547
found_extra: &dyn fmt::Display,
548548
) -> &mut Self);
549549

550-
forward!(pub fn note_unsuccessful_coercion(
551-
&mut self,
552-
expected: DiagnosticStyledString,
553-
found: DiagnosticStyledString,
554-
) -> &mut Self);
555-
556550
forward!(pub fn note(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self);
557551
forward!(pub fn note_once(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self);
558552
forward!(pub fn span_note(
@@ -581,7 +575,6 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
581575
forward!(pub fn set_is_lint(&mut self,) -> &mut Self);
582576

583577
forward!(pub fn disable_suggestions(&mut self,) -> &mut Self);
584-
forward!(pub fn clear_suggestions(&mut self,) -> &mut Self);
585578

586579
forward!(pub fn multipart_suggestion(
587580
&mut self,

compiler/rustc_expand/src/base.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,11 +1145,6 @@ impl<'a> ExtCtxt<'a> {
11451145
pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
11461146
self.sess.diagnostic().span_err(sp, msg);
11471147
}
1148-
#[rustc_lint_diagnostics]
1149-
#[track_caller]
1150-
pub fn span_warn<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
1151-
self.sess.diagnostic().span_warn(sp, msg);
1152-
}
11531148
pub fn span_bug<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<String>) -> ! {
11541149
self.sess.diagnostic().span_bug(sp, msg);
11551150
}

0 commit comments

Comments
 (0)