File tree 2 files changed +6
-7
lines changed
2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 1
- /// A simple static assertion macro. The first argument should be a unique
2
- /// ALL_CAPS identifier that describes the condition.
1
+ /// A simple static assertion macro.
3
2
#[ macro_export]
4
- #[ allow_internal_unstable( type_ascription) ]
3
+ #[ allow_internal_unstable( type_ascription, underscore_const_names ) ]
5
4
macro_rules! static_assert {
6
- ( $name : ident : $ test: expr) => {
5
+ ( $test: expr) => {
7
6
// Use the bool to access an array such that if the bool is false, the access
8
7
// is out-of-bounds.
9
8
#[ allow( dead_code) ]
10
- static $name : ( ) = [ ( ) ] [ !( $test: bool ) as usize ] ;
9
+ const _ : ( ) = [ ( ) ] [ !( $test: bool ) as usize ] ;
11
10
}
12
11
}
13
12
Original file line number Diff line number Diff line change @@ -544,14 +544,14 @@ impl Qualif for IsNotImplicitlyPromotable {
544
544
// Ensure the `IDX` values are sequential (`0..QUALIF_COUNT`).
545
545
macro_rules! static_assert_seq_qualifs {
546
546
( $i: expr => $first: ident $( , $rest: ident) * ) => {
547
- static_assert!( SEQ_QUALIFS : {
547
+ static_assert!( {
548
548
static_assert_seq_qualifs!( $i + 1 => $( $rest) ,* ) ;
549
549
550
550
$first:: IDX == $i
551
551
} ) ;
552
552
} ;
553
553
( $i: expr =>) => {
554
- static_assert!( SEQ_QUALIFS : QUALIF_COUNT == $i) ;
554
+ static_assert!( QUALIF_COUNT == $i) ;
555
555
} ;
556
556
}
557
557
static_assert_seq_qualifs ! (
You can’t perform that action at this time.
0 commit comments