diff options
| author | Joshua Nelson <jnelson@cloudflare.com> | 2022-08-29 19:30:25 -0500 |
|---|---|---|
| committer | Joshua Nelson <jnelson@cloudflare.com> | 2022-09-06 21:41:01 -0500 |
| commit | d2c53caee218296482c11a56354688a9a7e9636f (patch) | |
| tree | 138ee3add6e72f78a98765e868bbd66b3cbc8e79 /compiler/rustc_query_impl | |
| parent | 699bfa882b34a73b333e684e96984c1c565d2eff (diff) | |
| download | rust-d2c53caee218296482c11a56354688a9a7e9636f.tar.gz rust-d2c53caee218296482c11a56354688a9a7e9636f.zip | |
Move `Queries::new` out of the macro
Diffstat (limited to 'compiler/rustc_query_impl')
| -rw-r--r-- | compiler/rustc_query_impl/src/plumbing.rs | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index 274df5b5e5e..f8e165a1fd5 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -5,7 +5,7 @@ use crate::keys::Key; use crate::{on_disk_cache, Queries}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; -use rustc_data_structures::sync::Lock; +use rustc_data_structures::sync::{AtomicU64, Lock}; use rustc_errors::{Diagnostic, Handler}; use rustc_middle::dep_graph::{ self, DepKind, DepKindStruct, DepNode, DepNodeIndex, SerializedDepNodeIndex, @@ -501,9 +501,28 @@ macro_rules! define_queries { } } +use crate::{ExternProviders, OnDiskCache, Providers}; + +impl<'tcx> Queries<'tcx> { + pub fn new( + local_providers: Providers, + extern_providers: ExternProviders, + on_disk_cache: Option<OnDiskCache<'tcx>>, + ) -> Self { + Queries { + local_providers: Box::new(local_providers), + extern_providers: Box::new(extern_providers), + on_disk_cache, + jobs: AtomicU64::new(1), + ..Queries::default() + } + } +} + macro_rules! define_queries_struct { ( input: ($(([$($modifiers:tt)*] [$($attr:tt)*] [$name:ident]))*)) => { + #[derive(Default)] pub struct Queries<'tcx> { local_providers: Box<Providers>, extern_providers: Box<ExternProviders>, @@ -516,20 +535,6 @@ macro_rules! define_queries_struct { } impl<'tcx> Queries<'tcx> { - pub fn new( - local_providers: Providers, - extern_providers: ExternProviders, - on_disk_cache: Option<OnDiskCache<'tcx>>, - ) -> Self { - Queries { - local_providers: Box::new(local_providers), - extern_providers: Box::new(extern_providers), - on_disk_cache, - jobs: AtomicU64::new(1), - $($name: Default::default()),* - } - } - pub(crate) fn try_collect_active_jobs( &'tcx self, tcx: TyCtxt<'tcx>, |
