mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 22:12:15 +00:00
Merge query property modules into one
This commit is contained in:
parent
77c836e1ae
commit
f6c6d10443
@ -253,7 +253,7 @@ fn add_query_desc_cached_impl(
|
|||||||
quote! {
|
quote! {
|
||||||
#[allow(unused_variables, unused_braces, rustc::pass_by_value)]
|
#[allow(unused_variables, unused_braces, rustc::pass_by_value)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn #name<'tcx>(#tcx: TyCtxt<'tcx>, #key: &crate::query::query_keys::#name<'tcx>) -> bool {
|
pub fn #name<'tcx>(#tcx: TyCtxt<'tcx>, #key: &crate::query::queries::#name::Key<'tcx>) -> bool {
|
||||||
#expr
|
#expr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,7 +262,7 @@ fn add_query_desc_cached_impl(
|
|||||||
// we're taking `key` by reference, but some rustc types usually prefer being passed by value
|
// we're taking `key` by reference, but some rustc types usually prefer being passed by value
|
||||||
#[allow(rustc::pass_by_value)]
|
#[allow(rustc::pass_by_value)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn #name<'tcx>(_: TyCtxt<'tcx>, _: &crate::query::query_keys::#name<'tcx>) -> bool {
|
pub fn #name<'tcx>(_: TyCtxt<'tcx>, _: &crate::query::queries::#name::Key<'tcx>) -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ fn add_query_desc_cached_impl(
|
|||||||
|
|
||||||
let desc = quote! {
|
let desc = quote! {
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
pub fn #name<'tcx>(tcx: TyCtxt<'tcx>, key: crate::query::query_keys::#name<'tcx>) -> String {
|
pub fn #name<'tcx>(tcx: TyCtxt<'tcx>, key: crate::query::queries::#name::Key<'tcx>) -> String {
|
||||||
let (#tcx, #key) = (tcx, key);
|
let (#tcx, #key) = (tcx, key);
|
||||||
::rustc_middle::ty::print::with_no_trimmed_paths!(
|
::rustc_middle::ty::print::with_no_trimmed_paths!(
|
||||||
format!(#desc)
|
format!(#desc)
|
||||||
|
@ -114,8 +114,8 @@ macro_rules! provide_one {
|
|||||||
($tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $name:ident => $compute:block) => {
|
($tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $name:ident => $compute:block) => {
|
||||||
fn $name<'tcx>(
|
fn $name<'tcx>(
|
||||||
$tcx: TyCtxt<'tcx>,
|
$tcx: TyCtxt<'tcx>,
|
||||||
def_id_arg: rustc_middle::query::query_keys::$name<'tcx>,
|
def_id_arg: rustc_middle::query::queries::$name::Key<'tcx>,
|
||||||
) -> rustc_middle::query::query_provided::$name<'tcx> {
|
) -> rustc_middle::query::queries::$name::ProvidedValue<'tcx> {
|
||||||
let _prof_timer =
|
let _prof_timer =
|
||||||
$tcx.prof.generic_activity(concat!("metadata_decode_entry_", stringify!($name)));
|
$tcx.prof.generic_activity(concat!("metadata_decode_entry_", stringify!($name)));
|
||||||
|
|
||||||
|
@ -221,8 +221,8 @@ macro_rules! separate_provide_extern_decl {
|
|||||||
([(separate_provide_extern) $($rest:tt)*][$name:ident]) => {
|
([(separate_provide_extern) $($rest:tt)*][$name:ident]) => {
|
||||||
for<'tcx> fn(
|
for<'tcx> fn(
|
||||||
TyCtxt<'tcx>,
|
TyCtxt<'tcx>,
|
||||||
query_keys::$name<'tcx>,
|
queries::$name::Key<'tcx>,
|
||||||
) -> query_provided::$name<'tcx>
|
) -> queries::$name::ProvidedValue<'tcx>
|
||||||
};
|
};
|
||||||
([$other:tt $($modifiers:tt)*][$($args:tt)*]) => {
|
([$other:tt $($modifiers:tt)*][$($args:tt)*]) => {
|
||||||
separate_provide_extern_decl!([$($modifiers)*][$($args)*])
|
separate_provide_extern_decl!([$($modifiers)*][$($args)*])
|
||||||
@ -252,60 +252,37 @@ macro_rules! define_callbacks {
|
|||||||
$($(#[$attr:meta])*
|
$($(#[$attr:meta])*
|
||||||
[$($modifiers:tt)*] fn $name:ident($($K:tt)*) -> $V:ty,)*) => {
|
[$($modifiers:tt)*] fn $name:ident($($K:tt)*) -> $V:ty,)*) => {
|
||||||
|
|
||||||
// HACK(eddyb) this is like the `impl QueryConfig for queries::$name`
|
#[allow(unused_lifetimes)]
|
||||||
// below, but using type aliases instead of associated types, to bypass
|
pub mod queries {
|
||||||
// the limitations around normalizing under HRTB - for example, this:
|
$(pub mod $name {
|
||||||
// `for<'tcx> fn(...) -> <queries::$name<'tcx> as QueryConfig<TyCtxt<'tcx>>>::Value`
|
use super::super::*;
|
||||||
// doesn't currently normalize to `for<'tcx> fn(...) -> query_values::$name<'tcx>`.
|
|
||||||
// This is primarily used by the `provide!` macro in `rustc_metadata`.
|
|
||||||
#[allow(nonstandard_style, unused_lifetimes)]
|
|
||||||
pub mod query_keys {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
$(pub type $name<'tcx> = $($K)*;)*
|
pub type Key<'tcx> = $($K)*;
|
||||||
}
|
pub type Value<'tcx> = $V;
|
||||||
#[allow(nonstandard_style, unused_lifetimes)]
|
|
||||||
pub mod query_keys_local {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
$(pub type $name<'tcx> = local_key_if_separate_extern!([$($modifiers)*] $($K)*);)*
|
pub type LocalKey<'tcx> = local_key_if_separate_extern!([$($modifiers)*] $($K)*);
|
||||||
}
|
|
||||||
#[allow(nonstandard_style, unused_lifetimes)]
|
|
||||||
pub mod query_values {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
$(pub type $name<'tcx> = $V;)*
|
/// This type alias specifies the type returned from query providers and the type
|
||||||
}
|
/// used for decoding. For regular queries this is the declared returned type `V`,
|
||||||
|
/// but `arena_cache` will use `<V as Deref>::Target` instead.
|
||||||
|
pub type ProvidedValue<'tcx> = query_if_arena!(
|
||||||
|
[$($modifiers)*]
|
||||||
|
(<$V as Deref>::Target)
|
||||||
|
($V)
|
||||||
|
);
|
||||||
|
|
||||||
/// This module specifies the type returned from query providers and the type used for
|
/// This function takes `ProvidedValue` and coverts it to an erased `Value` by
|
||||||
/// decoding. For regular queries this is the declared returned type `V`, but
|
/// allocating it on an arena if the query has the `arena_cache` modifier. The
|
||||||
/// `arena_cache` will use `<V as Deref>::Target` instead.
|
/// value is then erased and returned. This will happen when computing the query
|
||||||
#[allow(nonstandard_style, unused_lifetimes)]
|
/// using a provider or decoding a stored result.
|
||||||
pub mod query_provided {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
$(
|
|
||||||
pub type $name<'tcx> = query_if_arena!([$($modifiers)*] (<$V as Deref>::Target) ($V));
|
|
||||||
)*
|
|
||||||
}
|
|
||||||
|
|
||||||
/// This module has a function per query which takes a `query_provided` value and coverts
|
|
||||||
/// it to a regular `V` value by allocating it on an arena if the query has the
|
|
||||||
/// `arena_cache` modifier. This will happen when computing the query using a provider or
|
|
||||||
/// decoding a stored result.
|
|
||||||
#[allow(nonstandard_style, unused_lifetimes)]
|
|
||||||
pub mod query_provided_to_value {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
$(
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn $name<'tcx>(
|
pub fn provided_to_erased<'tcx>(
|
||||||
_tcx: TyCtxt<'tcx>,
|
_tcx: TyCtxt<'tcx>,
|
||||||
value: query_provided::$name<'tcx>,
|
value: ProvidedValue<'tcx>,
|
||||||
) -> Erase<query_values::$name<'tcx>> {
|
) -> Erase<Value<'tcx>> {
|
||||||
erase(query_if_arena!([$($modifiers)*]
|
erase(query_if_arena!([$($modifiers)*]
|
||||||
{
|
{
|
||||||
if mem::needs_drop::<query_provided::$name<'tcx>>() {
|
if mem::needs_drop::<ProvidedValue<'tcx>>() {
|
||||||
&*_tcx.query_system.arenas.$name.alloc(value)
|
&*_tcx.query_system.arenas.$name.alloc(value)
|
||||||
} else {
|
} else {
|
||||||
&*_tcx.arena.dropless.alloc(value)
|
&*_tcx.arena.dropless.alloc(value)
|
||||||
@ -314,46 +291,40 @@ macro_rules! define_callbacks {
|
|||||||
(value)
|
(value)
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
)*
|
|
||||||
|
pub type Storage<'tcx> = <
|
||||||
|
<$($K)* as keys::Key>::CacheSelector as CacheSelector<'tcx, Erase<$V>>
|
||||||
|
>::Cache;
|
||||||
|
|
||||||
|
// Ensure that keys grow no larger than 64 bytes
|
||||||
|
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||||
|
const _: () = {
|
||||||
|
if mem::size_of::<Key<'static>>() > 64 {
|
||||||
|
panic!("{}", concat!(
|
||||||
|
"the query `",
|
||||||
|
stringify!($name),
|
||||||
|
"` has a key type `",
|
||||||
|
stringify!($($K)*),
|
||||||
|
"` that is too large"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Ensure that values grow no larger than 64 bytes
|
||||||
|
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||||
|
const _: () = {
|
||||||
|
if mem::size_of::<Value<'static>>() > 64 {
|
||||||
|
panic!("{}", concat!(
|
||||||
|
"the query `",
|
||||||
|
stringify!($name),
|
||||||
|
"` has a value type `",
|
||||||
|
stringify!($V),
|
||||||
|
"` that is too large"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})*
|
||||||
}
|
}
|
||||||
#[allow(nonstandard_style, unused_lifetimes)]
|
|
||||||
pub mod query_storage {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
$(
|
|
||||||
pub type $name<'tcx> = <<$($K)* as Key>::CacheSelector as CacheSelector<'tcx, Erase<$V>>>::Cache;
|
|
||||||
)*
|
|
||||||
}
|
|
||||||
|
|
||||||
$(
|
|
||||||
// Ensure that keys grow no larger than 64 bytes
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
const _: () = {
|
|
||||||
if mem::size_of::<query_keys::$name<'static>>() > 64 {
|
|
||||||
panic!("{}", concat!(
|
|
||||||
"the query `",
|
|
||||||
stringify!($name),
|
|
||||||
"` has a key type `",
|
|
||||||
stringify!($($K)*),
|
|
||||||
"` that is too large"
|
|
||||||
));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Ensure that values grow no larger than 64 bytes
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
const _: () = {
|
|
||||||
if mem::size_of::<query_values::$name<'static>>() > 64 {
|
|
||||||
panic!("{}", concat!(
|
|
||||||
"the query `",
|
|
||||||
stringify!($name),
|
|
||||||
"` has a value type `",
|
|
||||||
stringify!($V),
|
|
||||||
"` that is too large"
|
|
||||||
));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
)*
|
|
||||||
|
|
||||||
pub struct QueryArenas<'tcx> {
|
pub struct QueryArenas<'tcx> {
|
||||||
$($(#[$attr])* pub $name: query_if_arena!([$($modifiers)*]
|
$($(#[$attr])* pub $name: query_if_arena!([$($modifiers)*]
|
||||||
@ -375,7 +346,7 @@ macro_rules! define_callbacks {
|
|||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct QueryCaches<'tcx> {
|
pub struct QueryCaches<'tcx> {
|
||||||
$($(#[$attr])* pub $name: query_storage::$name<'tcx>,)*
|
$($(#[$attr])* pub $name: queries::$name::Storage<'tcx>,)*
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> TyCtxtEnsure<'tcx> {
|
impl<'tcx> TyCtxtEnsure<'tcx> {
|
||||||
@ -433,7 +404,7 @@ macro_rules! define_callbacks {
|
|||||||
|
|
||||||
pub struct DynamicQueries<'tcx> {
|
pub struct DynamicQueries<'tcx> {
|
||||||
$(
|
$(
|
||||||
pub $name: DynamicQuery<'tcx, query_storage::$name<'tcx>>,
|
pub $name: DynamicQuery<'tcx, queries::$name::Storage<'tcx>>,
|
||||||
)*
|
)*
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,8 +418,8 @@ macro_rules! define_callbacks {
|
|||||||
pub struct Providers {
|
pub struct Providers {
|
||||||
$(pub $name: for<'tcx> fn(
|
$(pub $name: for<'tcx> fn(
|
||||||
TyCtxt<'tcx>,
|
TyCtxt<'tcx>,
|
||||||
query_keys_local::$name<'tcx>,
|
queries::$name::LocalKey<'tcx>,
|
||||||
) -> query_provided::$name<'tcx>,)*
|
) -> queries::$name::ProvidedValue<'tcx>,)*
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ExternProviders {
|
pub struct ExternProviders {
|
||||||
@ -493,7 +464,7 @@ macro_rules! define_callbacks {
|
|||||||
$(pub $name: for<'tcx> fn(
|
$(pub $name: for<'tcx> fn(
|
||||||
TyCtxt<'tcx>,
|
TyCtxt<'tcx>,
|
||||||
Span,
|
Span,
|
||||||
query_keys::$name<'tcx>,
|
queries::$name::Key<'tcx>,
|
||||||
QueryMode,
|
QueryMode,
|
||||||
) -> Option<Erase<$V>>,)*
|
) -> Option<Erase<$V>>,)*
|
||||||
}
|
}
|
||||||
@ -517,11 +488,11 @@ macro_rules! define_feedable {
|
|||||||
$(impl<'tcx, K: IntoQueryParam<$($K)*> + Copy> TyCtxtFeed<'tcx, K> {
|
$(impl<'tcx, K: IntoQueryParam<$($K)*> + Copy> TyCtxtFeed<'tcx, K> {
|
||||||
$(#[$attr])*
|
$(#[$attr])*
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn $name(self, value: query_provided::$name<'tcx>) {
|
pub fn $name(self, value: queries::$name::ProvidedValue<'tcx>) {
|
||||||
let key = self.key().into_query_param();
|
let key = self.key().into_query_param();
|
||||||
|
|
||||||
let tcx = self.tcx;
|
let tcx = self.tcx;
|
||||||
let erased = query_provided_to_value::$name(tcx, value);
|
let erased = queries::$name::provided_to_erased(tcx, value);
|
||||||
let value = restore::<$V>(erased);
|
let value = restore::<$V>(erased);
|
||||||
let cache = &tcx.query_system.caches.$name;
|
let cache = &tcx.query_system.caches.$name;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate rustc_middle;
|
extern crate rustc_middle;
|
||||||
|
|
||||||
use crate::plumbing::{encode_all_query_results, try_mark_green};
|
use crate::plumbing::{__rust_begin_short_backtrace, encode_all_query_results, try_mark_green};
|
||||||
use field_offset::offset_of;
|
use field_offset::offset_of;
|
||||||
use rustc_data_structures::stable_hasher::HashStable;
|
use rustc_data_structures::stable_hasher::HashStable;
|
||||||
use rustc_data_structures::sync::AtomicU64;
|
use rustc_data_structures::sync::AtomicU64;
|
||||||
@ -27,8 +27,7 @@ use rustc_middle::query::on_disk_cache::OnDiskCache;
|
|||||||
use rustc_middle::query::plumbing::{DynamicQuery, QuerySystem, QuerySystemFns};
|
use rustc_middle::query::plumbing::{DynamicQuery, QuerySystem, QuerySystemFns};
|
||||||
use rustc_middle::query::AsLocalKey;
|
use rustc_middle::query::AsLocalKey;
|
||||||
use rustc_middle::query::{
|
use rustc_middle::query::{
|
||||||
query_keys, query_provided, query_provided_to_value, query_storage, query_values,
|
queries, DynamicQueries, ExternProviders, Providers, QueryCaches, QueryEngine, QueryStates,
|
||||||
DynamicQueries, ExternProviders, Providers, QueryCaches, QueryEngine, QueryStates,
|
|
||||||
};
|
};
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
use rustc_query_system::dep_graph::SerializedDepNodeIndex;
|
use rustc_query_system::dep_graph::SerializedDepNodeIndex;
|
||||||
|
@ -518,11 +518,11 @@ macro_rules! define_queries {
|
|||||||
pub fn __rust_end_short_backtrace<'tcx>(
|
pub fn __rust_end_short_backtrace<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
span: Span,
|
span: Span,
|
||||||
key: query_keys::$name<'tcx>,
|
key: queries::$name::Key<'tcx>,
|
||||||
mode: QueryMode,
|
mode: QueryMode,
|
||||||
) -> Option<Erase<query_values::$name<'tcx>>> {
|
) -> Option<Erase<queries::$name::Value<'tcx>>> {
|
||||||
get_query_incr(
|
get_query_incr(
|
||||||
queries::$name::config(tcx),
|
query_config::$name::config(tcx),
|
||||||
QueryCtxt::new(tcx),
|
QueryCtxt::new(tcx),
|
||||||
span,
|
span,
|
||||||
key,
|
key,
|
||||||
@ -543,11 +543,11 @@ macro_rules! define_queries {
|
|||||||
pub fn __rust_end_short_backtrace<'tcx>(
|
pub fn __rust_end_short_backtrace<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
span: Span,
|
span: Span,
|
||||||
key: query_keys::$name<'tcx>,
|
key: queries::$name::Key<'tcx>,
|
||||||
__mode: QueryMode,
|
__mode: QueryMode,
|
||||||
) -> Option<Erase<query_values::$name<'tcx>>> {
|
) -> Option<Erase<queries::$name::Value<'tcx>>> {
|
||||||
Some(get_query_non_incr(
|
Some(get_query_non_incr(
|
||||||
queries::$name::config(tcx),
|
query_config::$name::config(tcx),
|
||||||
QueryCtxt::new(tcx),
|
QueryCtxt::new(tcx),
|
||||||
span,
|
span,
|
||||||
key,
|
key,
|
||||||
@ -570,7 +570,7 @@ macro_rules! define_queries {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(nonstandard_style)]
|
#[allow(nonstandard_style)]
|
||||||
mod queries {
|
mod query_config {
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
$(
|
$(
|
||||||
@ -586,7 +586,7 @@ macro_rules! define_queries {
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
$(
|
$(
|
||||||
pub(super) fn $name<'tcx>() -> DynamicQuery<'tcx, query_storage::$name<'tcx>> {
|
pub(super) fn $name<'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)*]),
|
||||||
@ -597,9 +597,8 @@ macro_rules! define_queries {
|
|||||||
cache_on_disk: |tcx, key| ::rustc_middle::query::cached::$name(tcx, key),
|
cache_on_disk: |tcx, key| ::rustc_middle::query::cached::$name(tcx, key),
|
||||||
execute_query: |tcx, key| erase(tcx.$name(key)),
|
execute_query: |tcx, key| erase(tcx.$name(key)),
|
||||||
compute: |tcx, key| {
|
compute: |tcx, key| {
|
||||||
use crate::plumbing::__rust_begin_short_backtrace;
|
|
||||||
__rust_begin_short_backtrace(||
|
__rust_begin_short_backtrace(||
|
||||||
query_provided_to_value::$name(
|
queries::$name::provided_to_erased(
|
||||||
tcx,
|
tcx,
|
||||||
call_provider!([$($modifiers)*][tcx, $name, key])
|
call_provider!([$($modifiers)*][tcx, $name, key])
|
||||||
)
|
)
|
||||||
@ -609,12 +608,14 @@ macro_rules! define_queries {
|
|||||||
try_load_from_disk: should_ever_cache_on_disk!([$($modifiers)*] {
|
try_load_from_disk: should_ever_cache_on_disk!([$($modifiers)*] {
|
||||||
|tcx, key, prev_index, index| {
|
|tcx, key, prev_index, index| {
|
||||||
if ::rustc_middle::query::cached::$name(tcx, key) {
|
if ::rustc_middle::query::cached::$name(tcx, key) {
|
||||||
let value = $crate::plumbing::try_load_from_disk::<query_provided::$name<'tcx>>(
|
let value = $crate::plumbing::try_load_from_disk::<
|
||||||
|
queries::$name::ProvidedValue<'tcx>
|
||||||
|
>(
|
||||||
tcx,
|
tcx,
|
||||||
prev_index,
|
prev_index,
|
||||||
index,
|
index,
|
||||||
);
|
);
|
||||||
value.map(|value| query_provided_to_value::$name(tcx, value))
|
value.map(|value| queries::$name::provided_to_erased(tcx, value))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
@ -623,7 +624,7 @@ macro_rules! define_queries {
|
|||||||
|_tcx, _key, _prev_index, _index| None
|
|_tcx, _key, _prev_index, _index| None
|
||||||
}),
|
}),
|
||||||
value_from_cycle_error: |tcx, cycle| {
|
value_from_cycle_error: |tcx, cycle| {
|
||||||
let result: query_values::$name<'tcx> = Value::from_cycle_error(tcx, cycle);
|
let result: queries::$name::Value<'tcx> = Value::from_cycle_error(tcx, cycle);
|
||||||
erase(result)
|
erase(result)
|
||||||
},
|
},
|
||||||
loadable_from_disk: |_tcx, _key, _index| {
|
loadable_from_disk: |_tcx, _key, _index| {
|
||||||
@ -634,18 +635,18 @@ macro_rules! define_queries {
|
|||||||
false
|
false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
hash_result: hash_result!([$($modifiers)*][query_values::$name<'tcx>]),
|
hash_result: hash_result!([$($modifiers)*][queries::$name::Value<'tcx>]),
|
||||||
format_value: |value| format!("{:?}", restore::<query_values::$name<'tcx>>(*value)),
|
format_value: |value| format!("{:?}", restore::<queries::$name::Value<'tcx>>(*value)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)*
|
)*
|
||||||
}
|
}
|
||||||
|
|
||||||
$(impl<'tcx> QueryConfigRestored<'tcx> for queries::$name<'tcx> {
|
$(impl<'tcx> QueryConfigRestored<'tcx> for query_config::$name<'tcx> {
|
||||||
type RestoredValue = query_values::$name<'tcx>;
|
type RestoredValue = queries::$name::Value<'tcx>;
|
||||||
type Config = DynamicConfig<
|
type Config = DynamicConfig<
|
||||||
'tcx,
|
'tcx,
|
||||||
query_storage::$name<'tcx>,
|
queries::$name::Storage<'tcx>,
|
||||||
{ is_anon!([$($modifiers)*]) },
|
{ is_anon!([$($modifiers)*]) },
|
||||||
{ depth_limit!([$($modifiers)*]) },
|
{ depth_limit!([$($modifiers)*]) },
|
||||||
{ feedable!([$($modifiers)*]) },
|
{ feedable!([$($modifiers)*]) },
|
||||||
@ -660,7 +661,7 @@ macro_rules! define_queries {
|
|||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn restore(value: <Self::Config as QueryConfig<QueryCtxt<'tcx>>>::Value) -> Self::RestoredValue {
|
fn restore(value: <Self::Config as QueryConfig<QueryCtxt<'tcx>>>::Value) -> Self::RestoredValue {
|
||||||
restore::<query_values::$name<'tcx>>(value)
|
restore::<queries::$name::Value<'tcx>>(value)
|
||||||
}
|
}
|
||||||
})*
|
})*
|
||||||
|
|
||||||
@ -730,7 +731,7 @@ macro_rules! define_queries {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(pub(crate) fn $name<'tcx>()-> DepKindStruct<'tcx> {
|
$(pub(crate) fn $name<'tcx>()-> DepKindStruct<'tcx> {
|
||||||
$crate::plumbing::query_callback::<queries::$name<'tcx>>(
|
$crate::plumbing::query_callback::<query_config::$name<'tcx>>(
|
||||||
is_anon!([$($modifiers)*]),
|
is_anon!([$($modifiers)*]),
|
||||||
is_eval_always!([$($modifiers)*]),
|
is_eval_always!([$($modifiers)*]),
|
||||||
)
|
)
|
||||||
@ -785,8 +786,8 @@ macro_rules! define_queries {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
encode_query_results: expand_if_cached!([$($modifiers)*], |tcx, encoder, query_result_index|
|
encode_query_results: expand_if_cached!([$($modifiers)*], |tcx, encoder, query_result_index|
|
||||||
$crate::plumbing::encode_query_results::<super::queries::$name<'tcx>>(
|
$crate::plumbing::encode_query_results::<super::query_config::$name<'tcx>>(
|
||||||
super::queries::$name::config(tcx),
|
super::query_config::$name::config(tcx),
|
||||||
QueryCtxt::new(tcx),
|
QueryCtxt::new(tcx),
|
||||||
encoder,
|
encoder,
|
||||||
query_result_index,
|
query_result_index,
|
||||||
|
@ -24,7 +24,7 @@ use rustc_hir::def::DefKind;
|
|||||||
use rustc_hir::def_id::LocalDefId;
|
use rustc_hir::def_id::LocalDefId;
|
||||||
use rustc_interface::interface::Compiler;
|
use rustc_interface::interface::Compiler;
|
||||||
use rustc_interface::{Config, Queries};
|
use rustc_interface::{Config, Queries};
|
||||||
use rustc_middle::query::query_values::mir_borrowck;
|
use rustc_middle::query::queries::mir_borrowck::ProvidedValue;
|
||||||
use rustc_middle::query::{ExternProviders, Providers};
|
use rustc_middle::query::{ExternProviders, Providers};
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
@ -126,7 +126,7 @@ thread_local! {
|
|||||||
RefCell::new(HashMap::new());
|
RefCell::new(HashMap::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> mir_borrowck<'tcx> {
|
fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> ProvidedValue<'tcx> {
|
||||||
let body_with_facts = rustc_borrowck::consumers::get_body_with_borrowck_facts(tcx, def_id);
|
let body_with_facts = rustc_borrowck::consumers::get_body_with_borrowck_facts(tcx, def_id);
|
||||||
// SAFETY: The reader casts the 'static lifetime to 'tcx before using it.
|
// SAFETY: The reader casts the 'static lifetime to 'tcx before using it.
|
||||||
let body_with_facts: BodyWithBorrowckFacts<'static> =
|
let body_with_facts: BodyWithBorrowckFacts<'static> =
|
||||||
|
Loading…
Reference in New Issue
Block a user