Skip to content

Commit 2681c12

Browse files
committed
Removed dependency on the field-offset crate.
1 parent 061ee95 commit 2681c12

File tree

6 files changed

+6
-31
lines changed

6 files changed

+6
-31
lines changed

Diff for: Cargo.lock

-21
Original file line numberDiff line numberDiff line change
@@ -1195,16 +1195,6 @@ version = "2.3.0"
11951195
source = "registry+https://github.com/rust-lang/crates.io-index"
11961196
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
11971197

1198-
[[package]]
1199-
name = "field-offset"
1200-
version = "0.3.6"
1201-
source = "registry+https://github.com/rust-lang/crates.io-index"
1202-
checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f"
1203-
dependencies = [
1204-
"memoffset",
1205-
"rustc_version",
1206-
]
1207-
12081198
[[package]]
12091199
name = "filetime"
12101200
version = "0.2.25"
@@ -2270,15 +2260,6 @@ dependencies = [
22702260
"libc",
22712261
]
22722262

2273-
[[package]]
2274-
name = "memoffset"
2275-
version = "0.9.1"
2276-
source = "registry+https://github.com/rust-lang/crates.io-index"
2277-
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
2278-
dependencies = [
2279-
"autocfg",
2280-
]
2281-
22822263
[[package]]
22832264
name = "mime"
22842265
version = "0.3.17"
@@ -4118,7 +4099,6 @@ version = "0.0.0"
41184099
dependencies = [
41194100
"bitflags",
41204101
"either",
4121-
"field-offset",
41224102
"gsgdt",
41234103
"polonius-engine",
41244104
"rustc-rayon-core",
@@ -4364,7 +4344,6 @@ dependencies = [
43644344
name = "rustc_query_impl"
43654345
version = "0.0.0"
43664346
dependencies = [
4367-
"field-offset",
43684347
"measureme",
43694348
"rustc_data_structures",
43704349
"rustc_errors",

Diff for: compiler/rustc_middle/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ edition = "2021"
77
# tidy-alphabetical-start
88
bitflags = "2.4.1"
99
either = "1.5.0"
10-
field-offset = "0.3.5"
1110
gsgdt = "0.1.2"
1211
polonius-engine = "0.13.0"
1312
rustc-rayon-core = { version = "0.5.0" }

Diff for: compiler/rustc_middle/src/query/plumbing.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::ops::Deref;
22

3-
use field_offset::FieldOffset;
43
use rustc_data_structures::sync::{AtomicU64, WorkerLocal};
54
use rustc_hir::def_id::{DefId, LocalDefId};
65
use rustc_hir::hir_id::OwnerId;
@@ -24,8 +23,8 @@ pub struct DynamicQuery<'tcx, C: QueryCache> {
2423
pub eval_always: bool,
2524
pub dep_kind: DepKind,
2625
pub handle_cycle_error: HandleCycleError,
27-
pub query_state: FieldOffset<QueryStates<'tcx>, QueryState<C::Key>>,
28-
pub query_cache: FieldOffset<QueryCaches<'tcx>, C>,
26+
pub query_state: for<'a> fn(&'a QueryStates<'tcx>)-> &'a QueryState<C::Key>,
27+
pub query_cache: for <'a> fn(&'a QueryCaches<'tcx>) -> &'a C,
2928
pub cache_on_disk: fn(tcx: TyCtxt<'tcx>, key: &C::Key) -> bool,
3029
pub execute_query: fn(tcx: TyCtxt<'tcx>, k: C::Key) -> C::Value,
3130
pub compute: fn(tcx: TyCtxt<'tcx>, key: C::Key) -> C::Value,

Diff for: compiler/rustc_query_impl/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ edition = "2021"
55

66
[dependencies]
77
# tidy-alphabetical-start
8-
field-offset = "0.3.5"
98
measureme = "11"
109
rustc_data_structures = { path = "../rustc_data_structures" }
1110
rustc_errors = { path = "../rustc_errors" }

Diff for: compiler/rustc_query_impl/src/lib.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#![warn(unreachable_pub)]
1212
// tidy-alphabetical-end
1313

14-
use field_offset::offset_of;
1514
use rustc_data_structures::stable_hasher::HashStable;
1615
use rustc_data_structures::sync::AtomicU64;
1716
use rustc_middle::arena::Arena;
@@ -89,15 +88,15 @@ where
8988
where
9089
QueryCtxt<'tcx>: 'a,
9190
{
92-
self.dynamic.query_state.apply(&qcx.tcx.query_system.states)
91+
(self.dynamic.query_state)(&qcx.tcx.query_system.states)
9392
}
9493

9594
#[inline(always)]
9695
fn query_cache<'a>(self, qcx: QueryCtxt<'tcx>) -> &'a Self::Cache
9796
where
9897
'tcx: 'a,
9998
{
100-
self.dynamic.query_cache.apply(&qcx.tcx.query_system.caches)
99+
(self.dynamic.query_cache)(&qcx.tcx.query_system.caches)
101100
}
102101

103102
#[inline(always)]

Diff for: compiler/rustc_query_impl/src/plumbing.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,8 @@ macro_rules! define_queries {
605605
eval_always: is_eval_always!([$($modifiers)*]),
606606
dep_kind: dep_graph::dep_kinds::$name,
607607
handle_cycle_error: handle_cycle_error!([$($modifiers)*]),
608-
query_state: offset_of!(QueryStates<'tcx> => $name),
609-
query_cache: offset_of!(QueryCaches<'tcx> => $name),
608+
query_state: |states| &states.$name,
609+
query_cache: |cache| &cache.$name,
610610
cache_on_disk: |tcx, key| ::rustc_middle::query::cached::$name(tcx, key),
611611
execute_query: |tcx, key| erase(tcx.$name(key)),
612612
compute: |tcx, key| {

0 commit comments

Comments
 (0)