@@ -76,15 +76,11 @@ pub unsafe fn _xend() {
76
76
/// [Intel's documentation](https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-xabort).
77
77
#[ inline]
78
78
#[ 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 )
88
84
}
89
85
90
86
/// Queries whether the processor is executing in a transactional region identified by restricted
@@ -130,14 +126,14 @@ mod tests {
130
126
unsafe fn test_xabort ( ) {
131
127
const ABORT_CODE : u32 = 42 ;
132
128
// aborting outside a transactional region does nothing
133
- _xabort ( ABORT_CODE ) ;
129
+ _xabort :: < ABORT_CODE > ( ) ;
134
130
135
131
for _ in 0 ..10 {
136
132
let mut x = 0 ;
137
133
let code = rtm:: _xbegin ( ) ;
138
134
if code == _XBEGIN_STARTED {
139
135
x += 1 ;
140
- rtm:: _xabort ( ABORT_CODE ) ;
136
+ rtm:: _xabort :: < ABORT_CODE > ( ) ;
141
137
} else if code & _XABORT_EXPLICIT != 0 {
142
138
let test_abort_code = rtm:: _xabort_code ( code) ;
143
139
assert_eq ! ( test_abort_code, ABORT_CODE ) ;
0 commit comments