This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
compiler/rustc_middle/src/ty Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -250,6 +250,36 @@ macro_rules! define_callbacks {
250250 ) *
251251 }
252252
253+ $(
254+ // Ensure that keys grow no larger than 64 bytes
255+ #[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
256+ const _: ( ) = {
257+ if mem:: size_of:: <query_keys:: $name<' static >>( ) > 64 {
258+ panic!( "{}" , concat!(
259+ "the query `" ,
260+ stringify!( $name) ,
261+ "` has a key type `" ,
262+ stringify!( $( $K) * ) ,
263+ "` that is too large"
264+ ) ) ;
265+ }
266+ } ;
267+
268+ // Ensure that values grow no larger than 64 bytes
269+ #[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
270+ const _: ( ) = {
271+ if mem:: size_of:: <query_values:: $name<' static >>( ) > 64 {
272+ panic!( "{}" , concat!(
273+ "the query `" ,
274+ stringify!( $name) ,
275+ "` has a value type `" ,
276+ stringify!( $V) ,
277+ "` that is too large"
278+ ) ) ;
279+ }
280+ } ;
281+ ) *
282+
253283 pub struct QueryArenas <' tcx> {
254284 $( $( #[ $attr] ) * pub $name: query_if_arena!( [ $( $modifiers) * ]
255285 ( WorkerLocal <TypedArena <<$V as Deref >:: Target >>)
You can’t perform that action at this time.
0 commit comments