diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-09-22 16:26:20 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-09-22 16:26:20 +0000 |
| commit | 2ba911c8329a4a8b6697cc6a25c02f0f06d58d8d (patch) | |
| tree | 7659337027d83c1b09500dbe664db0092e1f887c /compiler/rustc_middle/src/util | |
| parent | 9defc971f1e059e139e8719661560de4741a128e (diff) | |
Have a single struct for queries and hook
Diffstat (limited to 'compiler/rustc_middle/src/util')
| -rw-r--r-- | compiler/rustc_middle/src/util/mod.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/util/mod.rs b/compiler/rustc_middle/src/util/mod.rs index 53b4257899b..271b3dcb6dc 100644 --- a/compiler/rustc_middle/src/util/mod.rs +++ b/compiler/rustc_middle/src/util/mod.rs @@ -5,3 +5,26 @@ pub mod find_self_call; pub use call_kind::{call_kind, CallDesugaringKind, CallKind}; pub use find_self_call::find_self_call; + +#[derive(Default, Copy, Clone)] +pub struct Providers { + pub queries: rustc_middle::query::Providers, + pub hooks: rustc_middle::hooks::Providers, +} + +/// Backwards compatibility hack to keep the diff small. This +/// gives direct access to the `queries` field's fields, which +/// are what almost everything wants access to. +impl std::ops::DerefMut for Providers { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.queries + } +} + +impl std::ops::Deref for Providers { + type Target = rustc_middle::query::Providers; + + fn deref(&self) -> &Self::Target { + &self.queries + } +} |
