@@ -96,9 +96,11 @@ bitflags! {
9696 /// If true, the type is always passed indirectly by non-Rustic ABIs.
9797 /// See [`TyAndLayout::pass_indirectly_in_non_rustic_abis`] for details.
9898 const PASS_INDIRECTLY_IN_NON_RUSTIC_ABIS = 1 << 5 ;
99- /// Any of these flags being set prevent field reordering optimisation.
100- const FIELD_ORDER_UNOPTIMIZABLE = ReprFlags :: IS_C . bits( )
99+ const IS_SCALABLE = 1 << 6 ;
100+ // Any of these flags being set prevent field reordering optimisation.
101+ const FIELD_ORDER_UNOPTIMIZABLE = ReprFlags :: IS_C . bits( )
101102 | ReprFlags :: IS_SIMD . bits( )
103+ | ReprFlags :: IS_SCALABLE . bits( )
102104 | ReprFlags :: IS_LINEAR . bits( ) ;
103105 const ABI_UNOPTIMIZABLE = ReprFlags :: IS_C . bits( ) | ReprFlags :: IS_SIMD . bits( ) ;
104106 }
@@ -135,6 +137,19 @@ impl IntegerType {
135137 }
136138}
137139
140+ #[ derive( Copy , Clone , Debug , Eq , PartialEq ) ]
141+ #[ cfg_attr(
142+ feature = "nightly" ,
143+ derive( Encodable_NoContext , Decodable_NoContext , HashStable_Generic )
144+ ) ]
145+ pub enum ScalableElt {
146+ /// `N` in `rustc_scalable_vector(N)` - the element count of the scalable vector
147+ ElementCount ( u128 ) ,
148+ /// `rustc_scalable_vector` w/out `N`, used for tuple types of scalable vectors that only
149+ /// contain other scalable vectors
150+ Container ,
151+ }
152+
138153/// Represents the repr options provided by the user.
139154#[ derive( Copy , Clone , Debug , Eq , PartialEq , Default ) ]
140155#[ cfg_attr(
@@ -146,6 +161,8 @@ pub struct ReprOptions {
146161 pub align : Option < Align > ,
147162 pub pack : Option < Align > ,
148163 pub flags : ReprFlags ,
164+ /// `#[rustc_scalable_vector]`
165+ pub scalable : Option < ScalableElt > ,
149166 /// The seed to be used for randomizing a type's layout
150167 ///
151168 /// Note: This could technically be a `u128` which would
@@ -162,6 +179,11 @@ impl ReprOptions {
162179 self . flags . contains ( ReprFlags :: IS_SIMD )
163180 }
164181
182+ #[ inline]
183+ pub fn scalable ( & self ) -> bool {
184+ self . flags . contains ( ReprFlags :: IS_SCALABLE )
185+ }
186+
165187 #[ inline]
166188 pub fn c ( & self ) -> bool {
167189 self . flags . contains ( ReprFlags :: IS_C )
0 commit comments