Add warn(unreachable_pub) to rustc_incremental.

This commit is contained in:
Nicholas Nethercote 2024-08-27 14:30:20 +10:00
parent 7fc0444340
commit 37becf7bdc
7 changed files with 50 additions and 49 deletions

View File

@ -55,7 +55,7 @@
use crate::errors;
#[allow(missing_docs)]
pub fn assert_dep_graph(tcx: TyCtxt<'_>) {
pub(crate) fn assert_dep_graph(tcx: TyCtxt<'_>) {
tcx.dep_graph.with_ignore(|| {
if tcx.sess.opts.unstable_opts.dump_dep_graph {
tcx.dep_graph.with_query(dump_graph);
@ -261,7 +261,7 @@ fn dump_graph(query: &DepGraphQuery) {
}
#[allow(missing_docs)]
pub struct GraphvizDepGraph(FxIndexSet<DepKind>, Vec<(DepKind, DepKind)>);
struct GraphvizDepGraph(FxIndexSet<DepKind>, Vec<(DepKind, DepKind)>);
impl<'a> dot::GraphWalk<'a> for GraphvizDepGraph {
type Node = DepKind;

View File

@ -6,7 +6,7 @@
#[derive(Diagnostic)]
#[diag(incremental_unrecognized_depnode)]
pub struct UnrecognizedDepNode {
pub(crate) struct UnrecognizedDepNode {
#[primary_span]
pub span: Span,
pub name: Symbol,
@ -14,28 +14,28 @@ pub struct UnrecognizedDepNode {
#[derive(Diagnostic)]
#[diag(incremental_missing_depnode)]
pub struct MissingDepNode {
pub(crate) struct MissingDepNode {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(incremental_missing_if_this_changed)]
pub struct MissingIfThisChanged {
pub(crate) struct MissingIfThisChanged {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(incremental_ok)]
pub struct Ok {
pub(crate) struct Ok {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(incremental_no_path)]
pub struct NoPath {
pub(crate) struct NoPath {
#[primary_span]
pub span: Span,
pub target: Symbol,
@ -44,7 +44,7 @@ pub struct NoPath {
#[derive(Diagnostic)]
#[diag(incremental_assertion_auto)]
pub struct AssertionAuto<'a> {
pub(crate) struct AssertionAuto<'a> {
#[primary_span]
pub span: Span,
pub name: &'a str,
@ -53,7 +53,7 @@ pub struct AssertionAuto<'a> {
#[derive(Diagnostic)]
#[diag(incremental_undefined_clean_dirty_assertions_item)]
pub struct UndefinedCleanDirtyItem {
pub(crate) struct UndefinedCleanDirtyItem {
#[primary_span]
pub span: Span,
pub kind: String,
@ -61,7 +61,7 @@ pub struct UndefinedCleanDirtyItem {
#[derive(Diagnostic)]
#[diag(incremental_undefined_clean_dirty_assertions)]
pub struct UndefinedCleanDirty {
pub(crate) struct UndefinedCleanDirty {
#[primary_span]
pub span: Span,
pub kind: String,
@ -69,7 +69,7 @@ pub struct UndefinedCleanDirty {
#[derive(Diagnostic)]
#[diag(incremental_repeated_depnode_label)]
pub struct RepeatedDepNodeLabel<'a> {
pub(crate) struct RepeatedDepNodeLabel<'a> {
#[primary_span]
pub span: Span,
pub label: &'a str,
@ -77,7 +77,7 @@ pub struct RepeatedDepNodeLabel<'a> {
#[derive(Diagnostic)]
#[diag(incremental_unrecognized_depnode_label)]
pub struct UnrecognizedDepNodeLabel<'a> {
pub(crate) struct UnrecognizedDepNodeLabel<'a> {
#[primary_span]
pub span: Span,
pub label: &'a str,
@ -85,7 +85,7 @@ pub struct UnrecognizedDepNodeLabel<'a> {
#[derive(Diagnostic)]
#[diag(incremental_not_dirty)]
pub struct NotDirty<'a> {
pub(crate) struct NotDirty<'a> {
#[primary_span]
pub span: Span,
pub dep_node_str: &'a str,
@ -93,7 +93,7 @@ pub struct NotDirty<'a> {
#[derive(Diagnostic)]
#[diag(incremental_not_clean)]
pub struct NotClean<'a> {
pub(crate) struct NotClean<'a> {
#[primary_span]
pub span: Span,
pub dep_node_str: &'a str,
@ -101,7 +101,7 @@ pub struct NotClean<'a> {
#[derive(Diagnostic)]
#[diag(incremental_not_loaded)]
pub struct NotLoaded<'a> {
pub(crate) struct NotLoaded<'a> {
#[primary_span]
pub span: Span,
pub dep_node_str: &'a str,
@ -109,7 +109,7 @@ pub struct NotLoaded<'a> {
#[derive(Diagnostic)]
#[diag(incremental_unknown_item)]
pub struct UnknownItem {
pub(crate) struct UnknownItem {
#[primary_span]
pub span: Span,
pub name: Symbol,
@ -117,14 +117,14 @@ pub struct UnknownItem {
#[derive(Diagnostic)]
#[diag(incremental_no_cfg)]
pub struct NoCfg {
pub(crate) struct NoCfg {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(incremental_associated_value_expected_for)]
pub struct AssociatedValueExpectedFor {
pub(crate) struct AssociatedValueExpectedFor {
#[primary_span]
pub span: Span,
pub ident: Ident,
@ -132,21 +132,21 @@ pub struct AssociatedValueExpectedFor {
#[derive(Diagnostic)]
#[diag(incremental_associated_value_expected)]
pub struct AssociatedValueExpected {
pub(crate) struct AssociatedValueExpected {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(incremental_unchecked_clean)]
pub struct UncheckedClean {
pub(crate) struct UncheckedClean {
#[primary_span]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(incremental_delete_old)]
pub struct DeleteOld<'a> {
pub(crate) struct DeleteOld<'a> {
pub name: &'a str,
pub path: PathBuf,
pub err: std::io::Error,
@ -154,7 +154,7 @@ pub struct DeleteOld<'a> {
#[derive(Diagnostic)]
#[diag(incremental_create_new)]
pub struct CreateNew<'a> {
pub(crate) struct CreateNew<'a> {
pub name: &'a str,
pub path: PathBuf,
pub err: std::io::Error,
@ -162,7 +162,7 @@ pub struct CreateNew<'a> {
#[derive(Diagnostic)]
#[diag(incremental_write_new)]
pub struct WriteNew<'a> {
pub(crate) struct WriteNew<'a> {
pub name: &'a str,
pub path: PathBuf,
pub err: std::io::Error,
@ -170,14 +170,14 @@ pub struct WriteNew<'a> {
#[derive(Diagnostic)]
#[diag(incremental_canonicalize_path)]
pub struct CanonicalizePath {
pub(crate) struct CanonicalizePath {
pub path: PathBuf,
pub err: std::io::Error,
}
#[derive(Diagnostic)]
#[diag(incremental_create_incr_comp_dir)]
pub struct CreateIncrCompDir<'a> {
pub(crate) struct CreateIncrCompDir<'a> {
pub tag: &'a str,
pub path: &'a Path,
pub err: std::io::Error,
@ -185,7 +185,7 @@ pub struct CreateIncrCompDir<'a> {
#[derive(Diagnostic)]
#[diag(incremental_create_lock)]
pub struct CreateLock<'a> {
pub(crate) struct CreateLock<'a> {
pub lock_err: std::io::Error,
pub session_dir: &'a Path,
#[note(incremental_lock_unsupported)]
@ -197,84 +197,84 @@ pub struct CreateLock<'a> {
#[derive(Diagnostic)]
#[diag(incremental_delete_lock)]
pub struct DeleteLock<'a> {
pub(crate) struct DeleteLock<'a> {
pub path: &'a Path,
pub err: std::io::Error,
}
#[derive(Diagnostic)]
#[diag(incremental_hard_link_failed)]
pub struct HardLinkFailed<'a> {
pub(crate) struct HardLinkFailed<'a> {
pub path: &'a Path,
}
#[derive(Diagnostic)]
#[diag(incremental_delete_partial)]
pub struct DeletePartial<'a> {
pub(crate) struct DeletePartial<'a> {
pub path: &'a Path,
pub err: std::io::Error,
}
#[derive(Diagnostic)]
#[diag(incremental_delete_full)]
pub struct DeleteFull<'a> {
pub(crate) struct DeleteFull<'a> {
pub path: &'a Path,
pub err: std::io::Error,
}
#[derive(Diagnostic)]
#[diag(incremental_finalize)]
pub struct Finalize<'a> {
pub(crate) struct Finalize<'a> {
pub path: &'a Path,
pub err: std::io::Error,
}
#[derive(Diagnostic)]
#[diag(incremental_invalid_gc_failed)]
pub struct InvalidGcFailed<'a> {
pub(crate) struct InvalidGcFailed<'a> {
pub path: &'a Path,
pub err: std::io::Error,
}
#[derive(Diagnostic)]
#[diag(incremental_finalized_gc_failed)]
pub struct FinalizedGcFailed<'a> {
pub(crate) struct FinalizedGcFailed<'a> {
pub path: &'a Path,
pub err: std::io::Error,
}
#[derive(Diagnostic)]
#[diag(incremental_session_gc_failed)]
pub struct SessionGcFailed<'a> {
pub(crate) struct SessionGcFailed<'a> {
pub path: &'a Path,
pub err: std::io::Error,
}
#[derive(Diagnostic)]
#[diag(incremental_assert_not_loaded)]
pub struct AssertNotLoaded;
pub(crate) struct AssertNotLoaded;
#[derive(Diagnostic)]
#[diag(incremental_assert_loaded)]
pub struct AssertLoaded;
pub(crate) struct AssertLoaded;
#[derive(Diagnostic)]
#[diag(incremental_delete_incompatible)]
pub struct DeleteIncompatible {
pub(crate) struct DeleteIncompatible {
pub path: PathBuf,
pub err: std::io::Error,
}
#[derive(Diagnostic)]
#[diag(incremental_load_dep_graph)]
pub struct LoadDepGraph {
pub(crate) struct LoadDepGraph {
pub path: PathBuf,
pub err: std::io::Error,
}
#[derive(Diagnostic)]
#[diag(incremental_move_dep_graph)]
pub struct MoveDepGraph<'a> {
pub(crate) struct MoveDepGraph<'a> {
pub from: &'a Path,
pub to: &'a Path,
pub err: std::io::Error,
@ -282,14 +282,14 @@ pub struct MoveDepGraph<'a> {
#[derive(Diagnostic)]
#[diag(incremental_create_dep_graph)]
pub struct CreateDepGraph<'a> {
pub(crate) struct CreateDepGraph<'a> {
pub path: &'a Path,
pub err: std::io::Error,
}
#[derive(Diagnostic)]
#[diag(incremental_copy_workproduct_to_cache)]
pub struct CopyWorkProductToCache<'a> {
pub(crate) struct CopyWorkProductToCache<'a> {
pub from: &'a Path,
pub to: &'a Path,
pub err: std::io::Error,
@ -297,13 +297,13 @@ pub struct CopyWorkProductToCache<'a> {
#[derive(Diagnostic)]
#[diag(incremental_delete_workproduct)]
pub struct DeleteWorkProduct<'a> {
pub(crate) struct DeleteWorkProduct<'a> {
pub path: &'a Path,
pub err: std::io::Error,
}
#[derive(Diagnostic)]
#[diag(incremental_corrupt_file)]
pub struct CorruptFile<'a> {
pub(crate) struct CorruptFile<'a> {
pub path: &'a Path,
}

View File

@ -6,6 +6,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(rustdoc_internals)]
#![warn(unreachable_pub)]
// tidy-alphabetical-end
mod assert_dep_graph;

View File

@ -4,7 +4,7 @@
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
#[derive(Debug, Encodable, Decodable)]
pub struct SerializedWorkProduct {
pub(crate) struct SerializedWorkProduct {
/// node that produced the work-product
pub id: WorkProductId,

View File

@ -133,7 +133,7 @@ struct Assertion {
loaded_from_disk: Labels,
}
pub fn check_dirty_clean_annotations(tcx: TyCtxt<'_>) {
pub(crate) fn check_dirty_clean_annotations(tcx: TyCtxt<'_>) {
if !tcx.sess.opts.unstable_opts.query_dep_graph {
return;
}
@ -174,7 +174,7 @@ pub fn check_dirty_clean_annotations(tcx: TyCtxt<'_>) {
})
}
pub struct DirtyCleanVisitor<'tcx> {
struct DirtyCleanVisitor<'tcx> {
tcx: TyCtxt<'tcx>,
checked_attrs: FxHashSet<ast::AttrId>,
}
@ -429,7 +429,7 @@ fn expect_associated_value(tcx: TyCtxt<'_>, item: &NestedMetaItem) -> Symbol {
/// A visitor that collects all `#[rustc_clean]` attributes from
/// the HIR. It is used to verify that we really ran checks for all annotated
/// nodes.
pub struct FindAllAttrs<'tcx> {
struct FindAllAttrs<'tcx> {
tcx: TyCtxt<'tcx>,
found_attrs: Vec<&'tcx Attribute>,
}

View File

@ -89,7 +89,7 @@ pub(crate) fn save_in<F>(sess: &Session, path_buf: PathBuf, name: &str, encode:
/// incompatible version of the compiler.
/// - Returns `Err(..)` if some kind of IO error occurred while reading the
/// file.
pub fn read_file(
pub(crate) fn read_file(
path: &Path,
report_incremental_info: bool,
is_nightly_build: bool,

View File

@ -157,7 +157,7 @@ pub(crate) fn work_products_path(sess: &Session) -> PathBuf {
}
/// Returns the path to a session's query cache.
pub fn query_cache_path(sess: &Session) -> PathBuf {
pub(crate) fn query_cache_path(sess: &Session) -> PathBuf {
in_incr_comp_dir_sess(sess, QUERY_CACHE_FILENAME)
}