Remove some unused code, and downgrade some pub
s.
This commit is contained in:
parent
32dc78ede8
commit
d51b3dbfc6
3 changed files with 6 additions and 49 deletions
|
@ -239,7 +239,7 @@ impl Diagnostic {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
pub fn new_with_code<M: Into<DiagnosticMessage>>(
|
pub(crate) fn new_with_code<M: Into<DiagnosticMessage>>(
|
||||||
level: Level,
|
level: Level,
|
||||||
code: Option<DiagnosticId>,
|
code: Option<DiagnosticId>,
|
||||||
message: M,
|
message: M,
|
||||||
|
@ -281,7 +281,7 @@ impl Diagnostic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_unstable_expectation_id(
|
pub(crate) fn update_unstable_expectation_id(
|
||||||
&mut self,
|
&mut self,
|
||||||
unstable_to_stable: &FxHashMap<LintExpectationId, LintExpectationId>,
|
unstable_to_stable: &FxHashMap<LintExpectationId, LintExpectationId>,
|
||||||
) {
|
) {
|
||||||
|
@ -307,14 +307,14 @@ impl Diagnostic {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Indicates whether this diagnostic should show up in cargo's future breakage report.
|
/// Indicates whether this diagnostic should show up in cargo's future breakage report.
|
||||||
pub fn has_future_breakage(&self) -> bool {
|
pub(crate) fn has_future_breakage(&self) -> bool {
|
||||||
match self.code {
|
match self.code {
|
||||||
Some(DiagnosticId::Lint { has_future_breakage, .. }) => has_future_breakage,
|
Some(DiagnosticId::Lint { has_future_breakage, .. }) => has_future_breakage,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_force_warn(&self) -> bool {
|
pub(crate) fn is_force_warn(&self) -> bool {
|
||||||
match self.code {
|
match self.code {
|
||||||
Some(DiagnosticId::Lint { is_force_warn, .. }) => is_force_warn,
|
Some(DiagnosticId::Lint { is_force_warn, .. }) => is_force_warn,
|
||||||
_ => false,
|
_ => false,
|
||||||
|
@ -391,29 +391,6 @@ impl Diagnostic {
|
||||||
self.note_expected_found_extra(expected_label, expected, found_label, found, &"", &"")
|
self.note_expected_found_extra(expected_label, expected, found_label, found, &"", &"")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn note_unsuccessful_coercion(
|
|
||||||
&mut self,
|
|
||||||
expected: DiagnosticStyledString,
|
|
||||||
found: DiagnosticStyledString,
|
|
||||||
) -> &mut Self {
|
|
||||||
let mut msg: Vec<_> =
|
|
||||||
vec![(Cow::from("required when trying to coerce from type `"), Style::NoStyle)];
|
|
||||||
msg.extend(expected.0.iter().map(|x| match *x {
|
|
||||||
StringPart::Normal(ref s) => (Cow::from(s.clone()), Style::NoStyle),
|
|
||||||
StringPart::Highlighted(ref s) => (Cow::from(s.clone()), Style::Highlight),
|
|
||||||
}));
|
|
||||||
msg.push((Cow::from("` to type '"), Style::NoStyle));
|
|
||||||
msg.extend(found.0.iter().map(|x| match *x {
|
|
||||||
StringPart::Normal(ref s) => (Cow::from(s.clone()), Style::NoStyle),
|
|
||||||
StringPart::Highlighted(ref s) => (Cow::from(s.clone()), Style::Highlight),
|
|
||||||
}));
|
|
||||||
msg.push((Cow::from("`"), Style::NoStyle));
|
|
||||||
|
|
||||||
// For now, just attach these as notes
|
|
||||||
self.highlighted_note(msg);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn note_expected_found_extra(
|
pub fn note_expected_found_extra(
|
||||||
&mut self,
|
&mut self,
|
||||||
expected_label: &dyn fmt::Display,
|
expected_label: &dyn fmt::Display,
|
||||||
|
@ -475,7 +452,7 @@ impl Diagnostic {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn highlighted_note<M: Into<SubdiagnosticMessage>>(
|
fn highlighted_note<M: Into<SubdiagnosticMessage>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
msg: Vec<(M, Style)>,
|
msg: Vec<(M, Style)>,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
|
@ -572,14 +549,6 @@ impl Diagnostic {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clear any existing suggestions.
|
|
||||||
pub fn clear_suggestions(&mut self) -> &mut Self {
|
|
||||||
if let Ok(suggestions) = &mut self.suggestions {
|
|
||||||
suggestions.clear();
|
|
||||||
}
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Helper for pushing to `self.suggestions`, if available (not disable).
|
/// Helper for pushing to `self.suggestions`, if available (not disable).
|
||||||
fn push_suggestion(&mut self, suggestion: CodeSuggestion) {
|
fn push_suggestion(&mut self, suggestion: CodeSuggestion) {
|
||||||
if let Ok(suggestions) = &mut self.suggestions {
|
if let Ok(suggestions) = &mut self.suggestions {
|
||||||
|
@ -992,7 +961,7 @@ impl Diagnostic {
|
||||||
/// Helper function that takes a `SubdiagnosticMessage` and returns a `DiagnosticMessage` by
|
/// Helper function that takes a `SubdiagnosticMessage` and returns a `DiagnosticMessage` by
|
||||||
/// combining it with the primary message of the diagnostic (if translatable, otherwise it just
|
/// combining it with the primary message of the diagnostic (if translatable, otherwise it just
|
||||||
/// passes the user's string along).
|
/// passes the user's string along).
|
||||||
pub(crate) fn subdiagnostic_message_to_diagnostic_message(
|
fn subdiagnostic_message_to_diagnostic_message(
|
||||||
&self,
|
&self,
|
||||||
attr: impl Into<SubdiagnosticMessage>,
|
attr: impl Into<SubdiagnosticMessage>,
|
||||||
) -> DiagnosticMessage {
|
) -> DiagnosticMessage {
|
||||||
|
|
|
@ -547,12 +547,6 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
|
||||||
found_extra: &dyn fmt::Display,
|
found_extra: &dyn fmt::Display,
|
||||||
) -> &mut Self);
|
) -> &mut Self);
|
||||||
|
|
||||||
forward!(pub fn note_unsuccessful_coercion(
|
|
||||||
&mut self,
|
|
||||||
expected: DiagnosticStyledString,
|
|
||||||
found: DiagnosticStyledString,
|
|
||||||
) -> &mut Self);
|
|
||||||
|
|
||||||
forward!(pub fn note(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self);
|
forward!(pub fn note(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self);
|
||||||
forward!(pub fn note_once(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self);
|
forward!(pub fn note_once(&mut self, msg: impl Into<SubdiagnosticMessage>) -> &mut Self);
|
||||||
forward!(pub fn span_note(
|
forward!(pub fn span_note(
|
||||||
|
@ -581,7 +575,6 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
|
||||||
forward!(pub fn set_is_lint(&mut self,) -> &mut Self);
|
forward!(pub fn set_is_lint(&mut self,) -> &mut Self);
|
||||||
|
|
||||||
forward!(pub fn disable_suggestions(&mut self,) -> &mut Self);
|
forward!(pub fn disable_suggestions(&mut self,) -> &mut Self);
|
||||||
forward!(pub fn clear_suggestions(&mut self,) -> &mut Self);
|
|
||||||
|
|
||||||
forward!(pub fn multipart_suggestion(
|
forward!(pub fn multipart_suggestion(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
|
@ -1145,11 +1145,6 @@ impl<'a> ExtCtxt<'a> {
|
||||||
pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
|
pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
|
||||||
self.sess.diagnostic().span_err(sp, msg);
|
self.sess.diagnostic().span_err(sp, msg);
|
||||||
}
|
}
|
||||||
#[rustc_lint_diagnostics]
|
|
||||||
#[track_caller]
|
|
||||||
pub fn span_warn<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<DiagnosticMessage>) {
|
|
||||||
self.sess.diagnostic().span_warn(sp, msg);
|
|
||||||
}
|
|
||||||
pub fn span_bug<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<String>) -> ! {
|
pub fn span_bug<S: Into<MultiSpan>>(&self, sp: S, msg: impl Into<String>) -> ! {
|
||||||
self.sess.diagnostic().span_bug(sp, msg);
|
self.sess.diagnostic().span_bug(sp, msg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue