@@ -76,15 +76,11 @@ pub unsafe fn _xend() {
7676/// [Intel's documentation](https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-xabort).
7777#[ inline]
7878#[ target_feature( enable = "rtm" ) ]
79- #[ cfg_attr( test, assert_instr( xabort, imm8 = 0x0 ) ) ]
80- #[ rustc_args_required_const( 0 ) ]
81- pub unsafe fn _xabort ( imm8 : u32 ) {
82- macro_rules! call {
83- ( $imm8: expr) => {
84- x86_xabort( $imm8)
85- } ;
86- }
87- constify_imm8 ! ( imm8, call)
79+ #[ cfg_attr( test, assert_instr( xabort, IMM8 = 0x0 ) ) ]
80+ #[ rustc_legacy_const_generics( 0 ) ]
81+ pub unsafe fn _xabort < const IMM8 : u32 > ( ) {
82+ static_assert_imm_u8 ! ( IMM8 ) ;
83+ x86_xabort ( IMM8 as i8 )
8884}
8985
9086/// Queries whether the processor is executing in a transactional region identified by restricted
@@ -130,14 +126,14 @@ mod tests {
130126 unsafe fn test_xabort ( ) {
131127 const ABORT_CODE : u32 = 42 ;
132128 // aborting outside a transactional region does nothing
133- _xabort ( ABORT_CODE ) ;
129+ _xabort :: < ABORT_CODE > ( ) ;
134130
135131 for _ in 0 ..10 {
136132 let mut x = 0 ;
137133 let code = rtm:: _xbegin ( ) ;
138134 if code == _XBEGIN_STARTED {
139135 x += 1 ;
140- rtm:: _xabort ( ABORT_CODE ) ;
136+ rtm:: _xabort :: < ABORT_CODE > ( ) ;
141137 } else if code & _XABORT_EXPLICIT != 0 {
142138 let test_abort_code = rtm:: _xabort_code ( code) ;
143139 assert_eq ! ( test_abort_code, ABORT_CODE ) ;
0 commit comments