move DiagnosticArgFromDisplay into rustc_errors
This commit is contained in:
parent
0ad57d8502
commit
694a010a5c
4 changed files with 36 additions and 31 deletions
|
@ -1,6 +1,4 @@
|
|||
use std::fmt::Display;
|
||||
|
||||
use rustc_errors::IntoDiagnosticArg;
|
||||
use rustc_errors::DiagnosticArgFromDisplay;
|
||||
use rustc_macros::{LintDiagnostic, SessionDiagnostic, SessionSubdiagnostic};
|
||||
use rustc_span::{Span, Symbol};
|
||||
|
||||
|
@ -38,7 +36,7 @@ pub struct ItemIsPrivate<'a> {
|
|||
#[label]
|
||||
pub span: Span,
|
||||
pub kind: &'a str,
|
||||
pub descr: FromDisplay<'a>,
|
||||
pub descr: DiagnosticArgFromDisplay<'a>,
|
||||
}
|
||||
|
||||
#[derive(SessionDiagnostic)]
|
||||
|
@ -58,7 +56,7 @@ pub struct InPublicInterfaceTraits<'a> {
|
|||
pub span: Span,
|
||||
pub vis_descr: &'static str,
|
||||
pub kind: &'a str,
|
||||
pub descr: FromDisplay<'a>,
|
||||
pub descr: DiagnosticArgFromDisplay<'a>,
|
||||
#[label(privacy::visibility_label)]
|
||||
pub vis_span: Span,
|
||||
}
|
||||
|
@ -72,7 +70,7 @@ pub struct InPublicInterface<'a> {
|
|||
pub span: Span,
|
||||
pub vis_descr: &'static str,
|
||||
pub kind: &'a str,
|
||||
pub descr: FromDisplay<'a>,
|
||||
pub descr: DiagnosticArgFromDisplay<'a>,
|
||||
#[label(privacy::visibility_label)]
|
||||
pub vis_span: Span,
|
||||
}
|
||||
|
@ -81,7 +79,7 @@ pub struct InPublicInterface<'a> {
|
|||
#[lint(privacy::from_private_dep_in_public_interface)]
|
||||
pub struct FromPrivateDependencyInPublicInterface<'a> {
|
||||
pub kind: &'a str,
|
||||
pub descr: FromDisplay<'a>,
|
||||
pub descr: DiagnosticArgFromDisplay<'a>,
|
||||
pub krate: Symbol,
|
||||
}
|
||||
|
||||
|
@ -90,13 +88,5 @@ pub struct FromPrivateDependencyInPublicInterface<'a> {
|
|||
pub struct PrivateInPublicLint<'a> {
|
||||
pub vis_descr: &'static str,
|
||||
pub kind: &'a str,
|
||||
pub descr: FromDisplay<'a>,
|
||||
}
|
||||
|
||||
pub struct FromDisplay<'a>(pub &'a dyn Display);
|
||||
|
||||
impl IntoDiagnosticArg for FromDisplay<'_> {
|
||||
fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
|
||||
self.0.to_string().into_diagnostic_arg()
|
||||
}
|
||||
pub descr: DiagnosticArgFromDisplay<'a>,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue