@@ -16,6 +16,7 @@ macro_rules! pattern_type {
1616/// A trait implemented for integer types and `char`.
1717/// Useful in the future for generic pattern types, but
1818/// used right now to simplify ast lowering of pattern type ranges.
19+ #[ cfg_attr( flux, flux:: assoc( fn sub_ok( self : Self ) -> bool { true } ) ) ]
1920#[ unstable( feature = "pattern_type_range_trait" , issue = "123646" ) ]
2021#[ rustc_const_unstable( feature = "pattern_type_range_trait" , issue = "123646" ) ]
2122#[ const_trait]
@@ -33,6 +34,7 @@ pub trait RangePattern {
3334 const MAX : Self ;
3435
3536 /// A compile-time helper to subtract 1 for exclusive ranges.
37+ #[ cfg_attr( flux, flux:: spec( fn ( self : Self { <Self as RangePattern >:: sub_ok( self ) } ) -> Self ) ) ]
3638 #[ lang = "RangeSub" ]
3739 #[ track_caller]
3840 fn sub_one ( self ) -> Self ;
@@ -61,12 +63,14 @@ impl_range_pat! {
6163 u8 , u16 , u32 , u64 , u128 , usize ,
6264}
6365
66+ #[ cfg_attr( flux, flux:: assoc( fn sub_ok( self : char ) -> bool { 0 < char_to_int( self ) } ) ) ]
6467#[ rustc_const_unstable( feature = "pattern_type_range_trait" , issue = "123646" ) ]
6568impl const RangePattern for char {
6669 const MIN : Self = char:: MIN ;
6770
6871 const MAX : Self = char:: MAX ;
6972
73+ #[ cfg_attr( flux, flux:: spec( fn ( self : char { <char as RangePattern >:: sub_ok( self ) } ) -> char ) ) ]
7074 fn sub_one ( self ) -> Self {
7175 match char:: from_u32 ( self as u32 - 1 ) {
7276 None => panic ! ( "exclusive range to start of valid chars" ) ,
0 commit comments