File tree 7 files changed +18
-35
lines changed
7 files changed +18
-35
lines changed Original file line number Diff line number Diff line change @@ -1195,16 +1195,6 @@ version = "2.3.0"
1195
1195
source = " registry+https://github.com/rust-lang/crates.io-index"
1196
1196
checksum = " 37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
1197
1197
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
-
1208
1198
[[package ]]
1209
1199
name = " filetime"
1210
1200
version = " 0.2.25"
@@ -2270,15 +2260,6 @@ dependencies = [
2270
2260
" libc" ,
2271
2261
]
2272
2262
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
-
2282
2263
[[package ]]
2283
2264
name = " mime"
2284
2265
version = " 0.3.17"
@@ -4118,7 +4099,6 @@ version = "0.0.0"
4118
4099
dependencies = [
4119
4100
" bitflags" ,
4120
4101
" either" ,
4121
- " field-offset" ,
4122
4102
" gsgdt" ,
4123
4103
" polonius-engine" ,
4124
4104
" rustc-rayon-core" ,
@@ -4364,7 +4344,6 @@ dependencies = [
4364
4344
name = " rustc_query_impl"
4365
4345
version = " 0.0.0"
4366
4346
dependencies = [
4367
- " field-offset" ,
4368
4347
" measureme" ,
4369
4348
" rustc_data_structures" ,
4370
4349
" rustc_errors" ,
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ edition = "2021"
7
7
# tidy-alphabetical-start
8
8
bitflags = " 2.4.1"
9
9
either = " 1.5.0"
10
- field-offset = " 0.3.5"
11
10
gsgdt = " 0.1.2"
12
11
polonius-engine = " 0.13.0"
13
12
rustc-rayon-core = { version = " 0.5.0" }
Original file line number Diff line number Diff line change 1
1
use std:: ops:: Deref ;
2
2
3
- use field_offset:: FieldOffset ;
4
3
use rustc_data_structures:: sync:: { AtomicU64 , WorkerLocal } ;
5
4
use rustc_hir:: def_id:: { DefId , LocalDefId } ;
6
5
use rustc_hir:: hir_id:: OwnerId ;
@@ -24,8 +23,8 @@ pub struct DynamicQuery<'tcx, C: QueryCache> {
24
23
pub eval_always : bool ,
25
24
pub dep_kind : DepKind ,
26
25
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 : usize ,
27
+ pub query_cache : usize ,
29
28
pub cache_on_disk : fn ( tcx : TyCtxt < ' tcx > , key : & C :: Key ) -> bool ,
30
29
pub execute_query : fn ( tcx : TyCtxt < ' tcx > , k : C :: Key ) -> C :: Value ,
31
30
pub compute : fn ( tcx : TyCtxt < ' tcx > , key : C :: Key ) -> C :: Value ,
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ edition = "2021"
5
5
6
6
[dependencies ]
7
7
# tidy-alphabetical-start
8
- field-offset = " 0.3.5"
9
8
measureme = " 11"
10
9
rustc_data_structures = { path = " ../rustc_data_structures" }
11
10
rustc_errors = { path = " ../rustc_errors" }
Original file line number Diff line number Diff line change 11
11
#![ warn( unreachable_pub) ]
12
12
// tidy-alphabetical-end
13
13
14
- use field_offset:: offset_of;
15
14
use rustc_data_structures:: stable_hasher:: HashStable ;
16
15
use rustc_data_structures:: sync:: AtomicU64 ;
17
16
use rustc_middle:: arena:: Arena ;
@@ -89,15 +88,27 @@ where
89
88
where
90
89
QueryCtxt < ' tcx > : ' a ,
91
90
{
92
- self . dynamic . query_state . apply ( & qcx. tcx . query_system . states )
91
+ // Safety:
92
+ // This is just manually doing the subfield referencing through pointer math.
93
+ unsafe {
94
+ & * ( & qcx. tcx . query_system . states as * const QueryStates < ' tcx > )
95
+ . byte_add ( self . dynamic . query_state )
96
+ . cast :: < QueryState < Self :: Key > > ( )
97
+ }
93
98
}
94
99
95
100
#[ inline( always) ]
96
101
fn query_cache < ' a > ( self , qcx : QueryCtxt < ' tcx > ) -> & ' a Self :: Cache
97
102
where
98
103
' tcx : ' a ,
99
104
{
100
- self . dynamic . query_cache . apply ( & qcx. tcx . query_system . caches )
105
+ // Safety:
106
+ // This is just manually doing the subfield referencing through pointer math.
107
+ unsafe {
108
+ & * ( & qcx. tcx . query_system . caches as * const QueryCaches < ' tcx > )
109
+ . byte_add ( self . dynamic . query_cache )
110
+ . cast :: < Self :: Cache > ( )
111
+ }
101
112
}
102
113
103
114
#[ inline( always) ]
Original file line number Diff line number Diff line change @@ -605,8 +605,8 @@ macro_rules! define_queries {
605
605
eval_always: is_eval_always!( [ $( $modifiers) * ] ) ,
606
606
dep_kind: dep_graph:: dep_kinds:: $name,
607
607
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: std :: mem :: offset_of!( QueryStates <' tcx>, $name) ,
609
+ query_cache: std :: mem :: offset_of!( QueryCaches <' tcx>, $name) ,
610
610
cache_on_disk: |tcx, key| :: rustc_middle:: query:: cached:: $name( tcx, key) ,
611
611
execute_query: |tcx, key| erase( tcx. $name( key) ) ,
612
612
compute: |tcx, key| {
Original file line number Diff line number Diff line change @@ -284,7 +284,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
284
284
"expect-test" ,
285
285
"fallible-iterator" , // dependency of `thorin`
286
286
"fastrand" ,
287
- "field-offset" ,
288
287
"flate2" ,
289
288
"fluent-bundle" ,
290
289
"fluent-langneg" ,
@@ -326,7 +325,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
326
325
"measureme" ,
327
326
"memchr" ,
328
327
"memmap2" ,
329
- "memoffset" ,
330
328
"miniz_oxide" ,
331
329
"nix" ,
332
330
"nu-ansi-term" ,
@@ -366,14 +364,12 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
366
364
"rustc-rayon-core" ,
367
365
"rustc-stable-hash" ,
368
366
"rustc_apfloat" ,
369
- "rustc_version" ,
370
367
"rustix" ,
371
368
"ruzstd" , // via object in thorin-dwp
372
369
"ryu" ,
373
370
"scoped-tls" ,
374
371
"scopeguard" ,
375
372
"self_cell" ,
376
- "semver" ,
377
373
"serde" ,
378
374
"serde_derive" ,
379
375
"serde_json" ,
You can’t perform that action at this time.
0 commit comments