File tree Expand file tree Collapse file tree 7 files changed +18
-35
lines changed Expand file tree Collapse file tree 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"
11951195source = " registry+https://github.com/rust-lang/crates.io-index"
11961196checksum = " 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 ]]
12091199name = " filetime"
12101200version = " 0.2.25"
@@ -2269,15 +2259,6 @@ dependencies = [
22692259 " libc" ,
22702260]
22712261
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-
22812262[[package ]]
22822263name = " mime"
22832264version = " 0.3.17"
@@ -4119,7 +4100,6 @@ version = "0.0.0"
41194100dependencies = [
41204101 " bitflags" ,
41214102 " either" ,
4122- " field-offset" ,
41234103 " gsgdt" ,
41244104 " polonius-engine" ,
41254105 " rustc-rayon-core" ,
@@ -4365,7 +4345,6 @@ dependencies = [
43654345name = " rustc_query_impl"
43664346version = " 0.0.0"
43674347dependencies = [
4368- " field-offset" ,
43694348 " measureme" ,
43704349 " rustc_data_structures" ,
43714350 " rustc_errors" ,
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ edition = "2021"
77# tidy-alphabetical-start
88bitflags = " 2.4.1"
99either = " 1.5.0"
10- field-offset = " 0.3.5"
1110gsgdt = " 0.1.2"
1211polonius-engine = " 0.13.0"
1312rustc-rayon-core = { version = " 0.5.0" }
Original file line number Diff line number Diff line change 11use std:: ops:: Deref ;
22
3- use field_offset:: FieldOffset ;
43use rustc_data_structures:: sync:: { AtomicU64 , WorkerLocal } ;
54use rustc_hir:: def_id:: { DefId , LocalDefId } ;
65use 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 : usize ,
27+ pub query_cache : usize ,
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 ,
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ edition = "2021"
55
66[dependencies ]
77# tidy-alphabetical-start
8- field-offset = " 0.3.5"
98measureme = " 11"
109rustc_data_structures = { path = " ../rustc_data_structures" }
1110rustc_errors = { path = " ../rustc_errors" }
Original file line number Diff line number Diff line change 1111#![ warn( unreachable_pub) ]
1212// tidy-alphabetical-end
1313
14- use field_offset:: offset_of;
1514use rustc_data_structures:: stable_hasher:: HashStable ;
1615use rustc_data_structures:: sync:: AtomicU64 ;
1716use rustc_middle:: arena:: Arena ;
@@ -89,15 +88,27 @@ where
8988 where
9089 QueryCtxt < ' tcx > : ' a ,
9190 {
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+ }
9398 }
9499
95100 #[ inline( always) ]
96101 fn query_cache < ' a > ( self , qcx : QueryCtxt < ' tcx > ) -> & ' a Self :: Cache
97102 where
98103 ' tcx : ' a ,
99104 {
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+ }
101112 }
102113
103114 #[ inline( always) ]
Original file line number Diff line number Diff 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: std :: mem :: offset_of!( QueryStates <' tcx>, $name) ,
609+ query_cache: std :: mem :: offset_of!( QueryCaches <' tcx>, $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| {
Original file line number Diff line number Diff line change @@ -285,7 +285,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
285285 "expect-test" ,
286286 "fallible-iterator" , // dependency of `thorin`
287287 "fastrand" ,
288- "field-offset" ,
289288 "flate2" ,
290289 "fluent-bundle" ,
291290 "fluent-langneg" ,
@@ -327,7 +326,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
327326 "measureme" ,
328327 "memchr" ,
329328 "memmap2" ,
330- "memoffset" ,
331329 "miniz_oxide" ,
332330 "nix" ,
333331 "nu-ansi-term" ,
@@ -367,14 +365,12 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
367365 "rustc-rayon-core" ,
368366 "rustc-stable-hash" ,
369367 "rustc_apfloat" ,
370- "rustc_version" ,
371368 "rustix" ,
372369 "ruzstd" , // via object in thorin-dwp
373370 "ryu" ,
374371 "scoped-tls" ,
375372 "scopeguard" ,
376373 "self_cell" ,
377- "semver" ,
378374 "serde" ,
379375 "serde_derive" ,
380376 "serde_json" ,
You can’t perform that action at this time.
0 commit comments