mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Add warn(unreachable_pub)
to rustc_query_impl
.
This commit is contained in:
parent
71bffef4f9
commit
2eea2d2cf1
@ -8,6 +8,7 @@
|
|||||||
#![feature(min_specialization)]
|
#![feature(min_specialization)]
|
||||||
#![feature(rustc_attrs)]
|
#![feature(rustc_attrs)]
|
||||||
#![feature(rustdoc_internals)]
|
#![feature(rustdoc_internals)]
|
||||||
|
#![warn(unreachable_pub)]
|
||||||
// tidy-alphabetical-end
|
// tidy-alphabetical-end
|
||||||
|
|
||||||
use field_offset::offset_of;
|
use field_offset::offset_of;
|
||||||
|
@ -541,7 +541,7 @@ macro_rules! expand_if_cached {
|
|||||||
/// Don't show the backtrace for query system by default
|
/// Don't show the backtrace for query system by default
|
||||||
/// use `RUST_BACKTRACE=full` to show all the backtraces
|
/// use `RUST_BACKTRACE=full` to show all the backtraces
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
pub fn __rust_begin_short_backtrace<F, T>(f: F) -> T
|
pub(crate) fn __rust_begin_short_backtrace<F, T>(f: F) -> T
|
||||||
where
|
where
|
||||||
F: FnOnce() -> T,
|
F: FnOnce() -> T,
|
||||||
{
|
{
|
||||||
@ -557,17 +557,17 @@ macro_rules! define_queries {
|
|||||||
$($(#[$attr:meta])*
|
$($(#[$attr:meta])*
|
||||||
[$($modifiers:tt)*] fn $name:ident($($K:tt)*) -> $V:ty,)*) => {
|
[$($modifiers:tt)*] fn $name:ident($($K:tt)*) -> $V:ty,)*) => {
|
||||||
|
|
||||||
pub(crate) mod query_impl { $(pub mod $name {
|
pub(crate) mod query_impl { $(pub(crate) mod $name {
|
||||||
use super::super::*;
|
use super::super::*;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
pub mod get_query_incr {
|
pub(crate) mod get_query_incr {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
// Adding `__rust_end_short_backtrace` marker to backtraces so that we emit the frames
|
// Adding `__rust_end_short_backtrace` marker to backtraces so that we emit the frames
|
||||||
// when `RUST_BACKTRACE=1`, add a new mod with `$name` here is to allow duplicate naming
|
// when `RUST_BACKTRACE=1`, add a new mod with `$name` here is to allow duplicate naming
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
pub fn __rust_end_short_backtrace<'tcx>(
|
pub(crate) fn __rust_end_short_backtrace<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
span: Span,
|
span: Span,
|
||||||
key: queries::$name::Key<'tcx>,
|
key: queries::$name::Key<'tcx>,
|
||||||
@ -585,11 +585,11 @@ macro_rules! define_queries {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod get_query_non_incr {
|
pub(crate) mod get_query_non_incr {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[inline(never)]
|
#[inline(never)]
|
||||||
pub fn __rust_end_short_backtrace<'tcx>(
|
pub(crate) fn __rust_end_short_backtrace<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
span: Span,
|
span: Span,
|
||||||
key: queries::$name::Key<'tcx>,
|
key: queries::$name::Key<'tcx>,
|
||||||
@ -604,7 +604,9 @@ macro_rules! define_queries {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dynamic_query<'tcx>() -> DynamicQuery<'tcx, queries::$name::Storage<'tcx>> {
|
pub(crate) fn dynamic_query<'tcx>()
|
||||||
|
-> DynamicQuery<'tcx, queries::$name::Storage<'tcx>>
|
||||||
|
{
|
||||||
DynamicQuery {
|
DynamicQuery {
|
||||||
name: stringify!($name),
|
name: stringify!($name),
|
||||||
eval_always: is_eval_always!([$($modifiers)*]),
|
eval_always: is_eval_always!([$($modifiers)*]),
|
||||||
@ -667,7 +669,7 @@ macro_rules! define_queries {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Default)]
|
#[derive(Copy, Clone, Default)]
|
||||||
pub struct QueryType<'tcx> {
|
pub(crate) struct QueryType<'tcx> {
|
||||||
data: PhantomData<&'tcx ()>
|
data: PhantomData<&'tcx ()>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,7 +698,7 @@ macro_rules! define_queries {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn try_collect_active_jobs<'tcx>(tcx: TyCtxt<'tcx>, qmap: &mut QueryMap) {
|
pub(crate) fn try_collect_active_jobs<'tcx>(tcx: TyCtxt<'tcx>, qmap: &mut QueryMap) {
|
||||||
let make_query = |tcx, key| {
|
let make_query = |tcx, key| {
|
||||||
let kind = rustc_middle::dep_graph::dep_kinds::$name;
|
let kind = rustc_middle::dep_graph::dep_kinds::$name;
|
||||||
let name = stringify!($name);
|
let name = stringify!($name);
|
||||||
@ -711,11 +713,17 @@ macro_rules! define_queries {
|
|||||||
// don't `unwrap()` here, just manually check for `None` and do best-effort error
|
// don't `unwrap()` here, just manually check for `None` and do best-effort error
|
||||||
// reporting.
|
// reporting.
|
||||||
if res.is_none() {
|
if res.is_none() {
|
||||||
tracing::warn!("Failed to collect active jobs for query with name `{}`!", stringify!($name));
|
tracing::warn!(
|
||||||
|
"Failed to collect active jobs for query with name `{}`!",
|
||||||
|
stringify!($name)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alloc_self_profile_query_strings<'tcx>(tcx: TyCtxt<'tcx>, string_cache: &mut QueryKeyStringCache) {
|
pub(crate) fn alloc_self_profile_query_strings<'tcx>(
|
||||||
|
tcx: TyCtxt<'tcx>,
|
||||||
|
string_cache: &mut QueryKeyStringCache
|
||||||
|
) {
|
||||||
$crate::profiling_support::alloc_self_profile_query_strings_for_query_cache(
|
$crate::profiling_support::alloc_self_profile_query_strings_for_query_cache(
|
||||||
tcx,
|
tcx,
|
||||||
stringify!($name),
|
stringify!($name),
|
||||||
@ -725,7 +733,7 @@ macro_rules! define_queries {
|
|||||||
}
|
}
|
||||||
|
|
||||||
item_if_cached! { [$($modifiers)*] {
|
item_if_cached! { [$($modifiers)*] {
|
||||||
pub fn encode_query_results<'tcx>(
|
pub(crate) fn encode_query_results<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
encoder: &mut CacheEncoder<'_, 'tcx>,
|
encoder: &mut CacheEncoder<'_, 'tcx>,
|
||||||
query_result_index: &mut EncodedDepNodeIndex
|
query_result_index: &mut EncodedDepNodeIndex
|
||||||
@ -739,7 +747,7 @@ macro_rules! define_queries {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
pub fn query_key_hash_verify<'tcx>(tcx: TyCtxt<'tcx>) {
|
pub(crate) fn query_key_hash_verify<'tcx>(tcx: TyCtxt<'tcx>) {
|
||||||
$crate::plumbing::query_key_hash_verify(
|
$crate::plumbing::query_key_hash_verify(
|
||||||
query_impl::$name::QueryType::config(tcx),
|
query_impl::$name::QueryType::config(tcx),
|
||||||
QueryCtxt::new(tcx),
|
QueryCtxt::new(tcx),
|
||||||
@ -795,7 +803,7 @@ macro_rules! define_queries {
|
|||||||
use rustc_query_system::dep_graph::FingerprintStyle;
|
use rustc_query_system::dep_graph::FingerprintStyle;
|
||||||
|
|
||||||
// We use this for most things when incr. comp. is turned off.
|
// We use this for most things when incr. comp. is turned off.
|
||||||
pub fn Null<'tcx>() -> DepKindStruct<'tcx> {
|
pub(crate) fn Null<'tcx>() -> DepKindStruct<'tcx> {
|
||||||
DepKindStruct {
|
DepKindStruct {
|
||||||
is_anon: false,
|
is_anon: false,
|
||||||
is_eval_always: false,
|
is_eval_always: false,
|
||||||
@ -807,7 +815,7 @@ macro_rules! define_queries {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We use this for the forever-red node.
|
// We use this for the forever-red node.
|
||||||
pub fn Red<'tcx>() -> DepKindStruct<'tcx> {
|
pub(crate) fn Red<'tcx>() -> DepKindStruct<'tcx> {
|
||||||
DepKindStruct {
|
DepKindStruct {
|
||||||
is_anon: false,
|
is_anon: false,
|
||||||
is_eval_always: false,
|
is_eval_always: false,
|
||||||
@ -818,7 +826,7 @@ macro_rules! define_queries {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn TraitSelect<'tcx>() -> DepKindStruct<'tcx> {
|
pub(crate) fn TraitSelect<'tcx>() -> DepKindStruct<'tcx> {
|
||||||
DepKindStruct {
|
DepKindStruct {
|
||||||
is_anon: true,
|
is_anon: true,
|
||||||
is_eval_always: false,
|
is_eval_always: false,
|
||||||
@ -829,7 +837,7 @@ macro_rules! define_queries {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn CompileCodegenUnit<'tcx>() -> DepKindStruct<'tcx> {
|
pub(crate) fn CompileCodegenUnit<'tcx>() -> DepKindStruct<'tcx> {
|
||||||
DepKindStruct {
|
DepKindStruct {
|
||||||
is_anon: false,
|
is_anon: false,
|
||||||
is_eval_always: false,
|
is_eval_always: false,
|
||||||
@ -840,7 +848,7 @@ macro_rules! define_queries {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn CompileMonoItem<'tcx>() -> DepKindStruct<'tcx> {
|
pub(crate) fn CompileMonoItem<'tcx>() -> DepKindStruct<'tcx> {
|
||||||
DepKindStruct {
|
DepKindStruct {
|
||||||
is_anon: false,
|
is_anon: false,
|
||||||
is_eval_always: false,
|
is_eval_always: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user