diff options
| author | bors <bors@rust-lang.org> | 2025-02-10 11:38:45 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-02-10 11:38:45 +0000 |
| commit | 8c04e395952022a451138dc4dbead6dd6ae65203 (patch) | |
| tree | ad0062d7c194bb6841e3fa09c09fe6d28c08bdc0 /compiler/rustc_query_impl/src | |
| parent | 80c091958f05e573433df974f8d2f2bc3a3eadfb (diff) | |
| parent | ffa8a96040b8bb1ae8b856ae2a95159ffe1cb400 (diff) | |
| download | rust-8c04e395952022a451138dc4dbead6dd6ae65203.tar.gz rust-8c04e395952022a451138dc4dbead6dd6ae65203.zip | |
Auto merge of #136809 - workingjubilee:rollup-jk0pew1, r=workingjubilee
Rollup of 12 pull requests Successful merges: - #136053 (coverage: Defer part of counter-creation until codegen) - #136201 (Removed dependency on the field-offset crate, alternate approach) - #136228 (Simplify Rc::as_ptr docs + typo fix) - #136353 (fix(libtest): Enable Instant on Emscripten targets) - #136472 ([`compiletest`-related cleanups 2/7] Feed stage number to compiletest directly) - #136487 (ci: stop mysql before removing it) - #136552 (Use an `Option` for `FindNextFileHandle` in `ReadDir` instead of `INVALID_FILE_HANDLE` sentinel value) - #136705 (Some miscellaneous edition-related library tweaks) - #136707 (Bump `cc` to v1.2.13 for the compiler workspace) - #136790 (Git blame ignore recent formatting commit) - #136792 (Don't apply editorconfig to llvm) - #136805 (ignore win_delete_self test in Miri) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_query_impl/src')
| -rw-r--r-- | compiler/rustc_query_impl/src/lib.rs | 17 | ||||
| -rw-r--r-- | compiler/rustc_query_impl/src/plumbing.rs | 4 |
2 files changed, 16 insertions, 5 deletions
diff --git a/compiler/rustc_query_impl/src/lib.rs b/compiler/rustc_query_impl/src/lib.rs index bbc83cca99d..73c205fdb17 100644 --- a/compiler/rustc_query_impl/src/lib.rs +++ b/compiler/rustc_query_impl/src/lib.rs @@ -11,7 +11,6 @@ #![warn(unreachable_pub)] // tidy-alphabetical-end -use field_offset::offset_of; use rustc_data_structures::stable_hasher::HashStable; use rustc_data_structures::sync::AtomicU64; use rustc_middle::arena::Arena; @@ -89,7 +88,13 @@ where where QueryCtxt<'tcx>: 'a, { - self.dynamic.query_state.apply(&qcx.tcx.query_system.states) + // Safety: + // This is just manually doing the subfield referencing through pointer math. + unsafe { + &*(&qcx.tcx.query_system.states as *const QueryStates<'tcx>) + .byte_add(self.dynamic.query_state) + .cast::<QueryState<Self::Key>>() + } } #[inline(always)] @@ -97,7 +102,13 @@ where where 'tcx: 'a, { - self.dynamic.query_cache.apply(&qcx.tcx.query_system.caches) + // Safety: + // This is just manually doing the subfield referencing through pointer math. + unsafe { + &*(&qcx.tcx.query_system.caches as *const QueryCaches<'tcx>) + .byte_add(self.dynamic.query_cache) + .cast::<Self::Cache>() + } } #[inline(always)] diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index 46ec538735a..e95c186f6b6 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -605,8 +605,8 @@ macro_rules! define_queries { eval_always: is_eval_always!([$($modifiers)*]), dep_kind: dep_graph::dep_kinds::$name, handle_cycle_error: handle_cycle_error!([$($modifiers)*]), - query_state: offset_of!(QueryStates<'tcx> => $name), - query_cache: offset_of!(QueryCaches<'tcx> => $name), + query_state: std::mem::offset_of!(QueryStates<'tcx>, $name), + query_cache: std::mem::offset_of!(QueryCaches<'tcx>, $name), cache_on_disk: |tcx, key| ::rustc_middle::query::cached::$name(tcx, key), execute_query: |tcx, key| erase(tcx.$name(key)), compute: |tcx, key| { |
