Add warn(unreachable_pub)
to rustc_privacy
.
This commit is contained in:
parent
653ee7bc3a
commit
71bffef4f9
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(privacy_field_is_private, code = E0451)]
|
#[diag(privacy_field_is_private, code = E0451)]
|
||||||
pub struct FieldIsPrivate {
|
pub(crate) struct FieldIsPrivate {
|
||||||
#[primary_span]
|
#[primary_span]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub field_name: Symbol,
|
pub field_name: Symbol,
|
||||||
@ -16,7 +16,7 @@ pub struct FieldIsPrivate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subdiagnostic)]
|
#[derive(Subdiagnostic)]
|
||||||
pub enum FieldIsPrivateLabel {
|
pub(crate) enum FieldIsPrivateLabel {
|
||||||
#[label(privacy_field_is_private_is_update_syntax_label)]
|
#[label(privacy_field_is_private_is_update_syntax_label)]
|
||||||
IsUpdateSyntax {
|
IsUpdateSyntax {
|
||||||
#[primary_span]
|
#[primary_span]
|
||||||
@ -32,7 +32,7 @@ pub enum FieldIsPrivateLabel {
|
|||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(privacy_item_is_private)]
|
#[diag(privacy_item_is_private)]
|
||||||
pub struct ItemIsPrivate<'a> {
|
pub(crate) struct ItemIsPrivate<'a> {
|
||||||
#[primary_span]
|
#[primary_span]
|
||||||
#[label]
|
#[label]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
@ -42,7 +42,7 @@ pub struct ItemIsPrivate<'a> {
|
|||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(privacy_unnamed_item_is_private)]
|
#[diag(privacy_unnamed_item_is_private)]
|
||||||
pub struct UnnamedItemIsPrivate {
|
pub(crate) struct UnnamedItemIsPrivate {
|
||||||
#[primary_span]
|
#[primary_span]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub kind: &'static str,
|
pub kind: &'static str,
|
||||||
@ -50,7 +50,7 @@ pub struct UnnamedItemIsPrivate {
|
|||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(privacy_in_public_interface, code = E0446)]
|
#[diag(privacy_in_public_interface, code = E0446)]
|
||||||
pub struct InPublicInterface<'a> {
|
pub(crate) struct InPublicInterface<'a> {
|
||||||
#[primary_span]
|
#[primary_span]
|
||||||
#[label]
|
#[label]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
@ -63,7 +63,7 @@ pub struct InPublicInterface<'a> {
|
|||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(privacy_report_effective_visibility)]
|
#[diag(privacy_report_effective_visibility)]
|
||||||
pub struct ReportEffectiveVisibility {
|
pub(crate) struct ReportEffectiveVisibility {
|
||||||
#[primary_span]
|
#[primary_span]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub descr: String,
|
pub descr: String,
|
||||||
@ -71,7 +71,7 @@ pub struct ReportEffectiveVisibility {
|
|||||||
|
|
||||||
#[derive(LintDiagnostic)]
|
#[derive(LintDiagnostic)]
|
||||||
#[diag(privacy_from_private_dep_in_public_interface)]
|
#[diag(privacy_from_private_dep_in_public_interface)]
|
||||||
pub struct FromPrivateDependencyInPublicInterface<'a> {
|
pub(crate) struct FromPrivateDependencyInPublicInterface<'a> {
|
||||||
pub kind: &'a str,
|
pub kind: &'a str,
|
||||||
pub descr: DiagArgFromDisplay<'a>,
|
pub descr: DiagArgFromDisplay<'a>,
|
||||||
pub krate: Symbol,
|
pub krate: Symbol,
|
||||||
@ -79,7 +79,7 @@ pub struct FromPrivateDependencyInPublicInterface<'a> {
|
|||||||
|
|
||||||
#[derive(LintDiagnostic)]
|
#[derive(LintDiagnostic)]
|
||||||
#[diag(privacy_unnameable_types_lint)]
|
#[diag(privacy_unnameable_types_lint)]
|
||||||
pub struct UnnameableTypesLint<'a> {
|
pub(crate) struct UnnameableTypesLint<'a> {
|
||||||
#[label]
|
#[label]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub kind: &'a str,
|
pub kind: &'a str,
|
||||||
@ -93,7 +93,7 @@ pub struct UnnameableTypesLint<'a> {
|
|||||||
// See https://rust-lang.github.io/rfcs/2145-type-privacy.html for more details.
|
// See https://rust-lang.github.io/rfcs/2145-type-privacy.html for more details.
|
||||||
#[derive(LintDiagnostic)]
|
#[derive(LintDiagnostic)]
|
||||||
#[diag(privacy_private_interface_or_bounds_lint)]
|
#[diag(privacy_private_interface_or_bounds_lint)]
|
||||||
pub struct PrivateInterfacesOrBoundsLint<'a> {
|
pub(crate) struct PrivateInterfacesOrBoundsLint<'a> {
|
||||||
#[label(privacy_item_label)]
|
#[label(privacy_item_label)]
|
||||||
pub item_span: Span,
|
pub item_span: Span,
|
||||||
pub item_kind: &'a str,
|
pub item_kind: &'a str,
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
#![feature(rustdoc_internals)]
|
#![feature(rustdoc_internals)]
|
||||||
#![feature(try_blocks)]
|
#![feature(try_blocks)]
|
||||||
|
#![warn(unreachable_pub)]
|
||||||
// tidy-alphabetical-end
|
// tidy-alphabetical-end
|
||||||
|
|
||||||
mod errors;
|
mod errors;
|
||||||
@ -1497,7 +1498,7 @@ fn get(&self, def_id: LocalDefId) -> Option<EffectiveVisibility> {
|
|||||||
self.effective_visibilities.effective_vis(def_id).copied()
|
self.effective_visibilities.effective_vis(def_id).copied()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check_item(&mut self, id: ItemId) {
|
fn check_item(&mut self, id: ItemId) {
|
||||||
let tcx = self.tcx;
|
let tcx = self.tcx;
|
||||||
let def_id = id.owner_id.def_id;
|
let def_id = id.owner_id.def_id;
|
||||||
let item_visibility = tcx.local_visibility(def_id);
|
let item_visibility = tcx.local_visibility(def_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user