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"
@@ -2269,15 +2259,6 @@ dependencies = [
2269
2259
" libc" ,
2270
2260
]
2271
2261
2272
- [[package ]]
2273
- name = " memoffset"
2274
- version = " 0.9.1"
2275
- source = " registry+https://github.com/rust-lang/crates.io-index"
2276
- checksum = " 488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
2277
- dependencies = [
2278
- " autocfg" ,
2279
- ]
2280
-
2281
2262
[[package ]]
2282
2263
name = " mime"
2283
2264
version = " 0.3.17"
@@ -4119,7 +4100,6 @@ version = "0.0.0"
4119
4100
dependencies = [
4120
4101
" bitflags" ,
4121
4102
" either" ,
4122
- " field-offset" ,
4123
4103
" gsgdt" ,
4124
4104
" polonius-engine" ,
4125
4105
" rustc-rayon-core" ,
@@ -4365,7 +4345,6 @@ dependencies = [
4365
4345
name = " rustc_query_impl"
4366
4346
version = " 0.0.0"
4367
4347
dependencies = [
4368
- " field-offset" ,
4369
4348
" measureme" ,
4370
4349
" rustc_data_structures" ,
4371
4350
" 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 @@ -285,7 +285,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
285
285
"expect-test" ,
286
286
"fallible-iterator" , // dependency of `thorin`
287
287
"fastrand" ,
288
- "field-offset" ,
289
288
"flate2" ,
290
289
"fluent-bundle" ,
291
290
"fluent-langneg" ,
@@ -327,7 +326,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
327
326
"measureme" ,
328
327
"memchr" ,
329
328
"memmap2" ,
330
- "memoffset" ,
331
329
"miniz_oxide" ,
332
330
"nix" ,
333
331
"nu-ansi-term" ,
@@ -367,14 +365,12 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
367
365
"rustc-rayon-core" ,
368
366
"rustc-stable-hash" ,
369
367
"rustc_apfloat" ,
370
- "rustc_version" ,
371
368
"rustix" ,
372
369
"ruzstd" , // via object in thorin-dwp
373
370
"ryu" ,
374
371
"scoped-tls" ,
375
372
"scopeguard" ,
376
373
"self_cell" ,
377
- "semver" ,
378
374
"serde" ,
379
375
"serde_derive" ,
380
376
"serde_json" ,
You can’t perform that action at this time.
0 commit comments