privacy: port "in public interface" diag

Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
David Wood
2022-06-22 14:11:39 +01:00
parent 0557d02a9d
commit 74f3a965f4
3 changed files with 60 additions and 12 deletions

View File

@@ -45,3 +45,31 @@ pub struct UnnamedItemIsPrivate {
pub span: Span,
pub kind: &'static str,
}
// Duplicate of `InPublicInterface` but with a different error code, shares the same slug.
#[derive(SessionDiagnostic)]
#[error(privacy::in_public_interface, code = "E0445")]
pub struct InPublicInterfaceTraits<'a> {
#[primary_span]
#[label]
pub span: Span,
pub vis_descr: &'static str,
pub kind: &'a str,
pub descr: String,
#[label(privacy::visibility_label)]
pub vis_span: Span,
}
// Duplicate of `InPublicInterfaceTraits` but with a different error code, shares the same slug.
#[derive(SessionDiagnostic)]
#[error(privacy::in_public_interface, code = "E0446")]
pub struct InPublicInterface<'a> {
#[primary_span]
#[label]
pub span: Span,
pub vis_descr: &'static str,
pub kind: &'a str,
pub descr: String,
#[label(privacy::visibility_label)]
pub vis_span: Span,
}