6
6
#![ feature( asm_unwind, linkage) ]
7
7
#![ crate_type = "lib" ]
8
8
9
- use std:: arch:: asm ;
9
+ use std:: arch:: naked_asm ;
10
10
11
11
#[ repr( C ) ]
12
12
pub struct P {
@@ -25,7 +25,7 @@ pub unsafe extern "C" fn patterns(
25
25
P { x, y } : P ,
26
26
//~^ ERROR patterns not allowed in naked function parameters
27
27
) {
28
- asm ! ( "" , options( noreturn) )
28
+ naked_asm ! ( "" , options( noreturn) )
29
29
}
30
30
31
31
#[ naked]
@@ -38,9 +38,8 @@ pub unsafe extern "C" fn inc(a: u32) -> u32 {
38
38
#[ naked]
39
39
#[ allow( asm_sub_register) ]
40
40
pub unsafe extern "C" fn inc_asm ( a : u32 ) -> u32 {
41
- asm ! ( "/* {0} */" , in( reg) a, options( noreturn) ) ;
42
- //~^ ERROR referencing function parameters is not allowed in naked functions
43
- //~| ERROR only `const` and `sym` operands are supported in naked functions
41
+ naked_asm ! ( "/* {0} */" , in( reg) a, options( noreturn) )
42
+ //~^ ERROR the `in` operand cannot be used with `naked_asm!`
44
43
}
45
44
46
45
#[ naked]
@@ -59,10 +58,9 @@ pub unsafe extern "C" fn unsupported_operands() {
59
58
let mut e = 0usize ;
60
59
const F : usize = 0usize ;
61
60
static G : usize = 0usize ;
62
- asm ! ( "/* {0} {1} {2} {3} {4} {5} {6} */" ,
63
- //~^ ERROR asm in naked functions must use `noreturn` option
61
+ naked_asm ! ( "/* {0} {1} {2} {3} {4} {5} {6} */" ,
64
62
in( reg) a,
65
- //~^ ERROR only `const` and `sym` operands are supported in naked functions
63
+ //~^ ERROR the `in` operand cannot be used with `naked_asm!`
66
64
inlateout( reg) b,
67
65
inout( reg) c,
68
66
lateout( reg) d,
@@ -81,13 +79,13 @@ pub extern "C" fn missing_assembly() {
81
79
pub extern "C" fn too_many_asm_blocks ( ) {
82
80
//~^ ERROR naked functions must contain a single asm block
83
81
unsafe {
84
- asm ! ( "" ) ;
82
+ naked_asm ! ( "" ) ;
85
83
//~^ ERROR asm in naked functions must use `noreturn` option
86
- asm ! ( "" ) ;
84
+ naked_asm ! ( "" ) ;
87
85
//~^ ERROR asm in naked functions must use `noreturn` option
88
- asm ! ( "" ) ;
86
+ naked_asm ! ( "" ) ;
89
87
//~^ ERROR asm in naked functions must use `noreturn` option
90
- asm ! ( "" , options( noreturn) ) ;
88
+ naked_asm ! ( "" , options( noreturn) ) ;
91
89
}
92
90
}
93
91
@@ -103,40 +101,42 @@ pub fn outer(x: u32) -> extern "C" fn(usize) -> usize {
103
101
104
102
#[ naked]
105
103
unsafe extern "C" fn invalid_options ( ) {
106
- asm ! ( "" , options( nomem, preserves_flags, noreturn) ) ;
107
- //~^ ERROR asm options unsupported in naked functions: `nomem`, `preserves_flags`
104
+ naked_asm ! ( "" , options( nomem, preserves_flags, noreturn) ) ;
105
+ //~^ ERROR the `nomem` option cannot be used with `naked_asm!`
106
+ //~| ERROR the `preserves_flags` option cannot be used with `naked_asm!`
108
107
}
109
108
110
109
#[ naked]
111
110
unsafe extern "C" fn invalid_options_continued ( ) {
112
- asm ! ( "" , options( readonly, nostack) , options( pure) ) ;
113
- //~^ ERROR asm with the `pure` option must have at least one output
114
- //~| ERROR asm options unsupported in naked functions: `pure`, `readonly`, `nostack`
111
+ naked_asm ! ( "" , options( readonly, nostack) , options( pure) ) ;
112
+ //~^ ERROR the `readonly` option cannot be used with `naked_asm!`
113
+ //~| ERROR the `nostack` option cannot be used with `naked_asm!`
114
+ //~| ERROR the `pure` option cannot be used with `naked_asm!`
115
115
//~| ERROR asm in naked functions must use `noreturn` option
116
116
}
117
117
118
118
#[ naked]
119
119
unsafe extern "C" fn invalid_may_unwind ( ) {
120
- asm ! ( "" , options( noreturn, may_unwind) ) ;
121
- //~^ ERROR asm options unsupported in naked functions: `may_unwind `
120
+ naked_asm ! ( "" , options( noreturn, may_unwind) ) ;
121
+ //~^ ERROR the `may_unwind` option cannot be used with `naked_asm! `
122
122
}
123
123
124
124
#[ naked]
125
125
pub unsafe fn default_abi ( ) {
126
126
//~^ WARN Rust ABI is unsupported in naked functions
127
- asm ! ( "" , options( noreturn) ) ;
127
+ naked_asm ! ( "" , options( noreturn) ) ;
128
128
}
129
129
130
130
#[ naked]
131
131
pub unsafe fn rust_abi ( ) {
132
132
//~^ WARN Rust ABI is unsupported in naked functions
133
- asm ! ( "" , options( noreturn) ) ;
133
+ naked_asm ! ( "" , options( noreturn) ) ;
134
134
}
135
135
136
136
#[ naked]
137
137
pub extern "C" fn valid_a < T > ( ) -> T {
138
138
unsafe {
139
- asm ! ( "" , options( noreturn) ) ;
139
+ naked_asm ! ( "" , options( noreturn) ) ;
140
140
}
141
141
}
142
142
@@ -145,21 +145,21 @@ pub extern "C" fn valid_b() {
145
145
unsafe {
146
146
{
147
147
{
148
- asm ! ( "" , options( noreturn) ) ;
148
+ naked_asm ! ( "" , options( noreturn) ) ;
149
149
} ;
150
150
} ;
151
151
}
152
152
}
153
153
154
154
#[ naked]
155
155
pub unsafe extern "C" fn valid_c ( ) {
156
- asm ! ( "" , options( noreturn) ) ;
156
+ naked_asm ! ( "" , options( noreturn) ) ;
157
157
}
158
158
159
159
#[ cfg( target_arch = "x86_64" ) ]
160
160
#[ naked]
161
161
pub unsafe extern "C" fn valid_att_syntax ( ) {
162
- asm ! ( "" , options( noreturn, att_syntax) ) ;
162
+ naked_asm ! ( "" , options( noreturn, att_syntax) ) ;
163
163
}
164
164
165
165
#[ naked]
@@ -173,20 +173,20 @@ pub unsafe extern "C" fn allow_compile_error(a: u32) -> u32 {
173
173
pub unsafe extern "C" fn allow_compile_error_and_asm ( a : u32 ) -> u32 {
174
174
compile_error ! ( "this is a user specified error" ) ;
175
175
//~^ ERROR this is a user specified error
176
- asm ! ( "" , options( noreturn) )
176
+ naked_asm ! ( "" , options( noreturn) )
177
177
}
178
178
179
179
#[ naked]
180
180
pub unsafe extern "C" fn invalid_asm_syntax ( a : u32 ) -> u32 {
181
- asm ! ( invalid_syntax)
181
+ naked_asm ! ( invalid_syntax)
182
182
//~^ ERROR asm template must be a string literal
183
183
}
184
184
185
185
#[ cfg( target_arch = "x86_64" ) ]
186
186
#[ cfg_attr( target_pointer_width = "64" , no_mangle) ]
187
187
#[ naked]
188
188
pub unsafe extern "C" fn compatible_cfg_attributes ( ) {
189
- asm ! ( "" , options( noreturn, att_syntax) ) ;
189
+ naked_asm ! ( "" , options( noreturn, att_syntax) ) ;
190
190
}
191
191
192
192
#[ allow( dead_code) ]
@@ -195,20 +195,20 @@ pub unsafe extern "C" fn compatible_cfg_attributes() {
195
195
#[ forbid( dead_code) ]
196
196
#[ naked]
197
197
pub unsafe extern "C" fn compatible_diagnostic_attributes ( ) {
198
- asm ! ( "" , options( noreturn, raw) ) ;
198
+ naked_asm ! ( "" , options( noreturn, raw) ) ;
199
199
}
200
200
201
201
#[ deprecated = "test" ]
202
202
#[ naked]
203
203
pub unsafe extern "C" fn compatible_deprecated_attributes ( ) {
204
- asm ! ( "" , options( noreturn, raw) ) ;
204
+ naked_asm ! ( "" , options( noreturn, raw) ) ;
205
205
}
206
206
207
207
#[ cfg( target_arch = "x86_64" ) ]
208
208
#[ must_use]
209
209
#[ naked]
210
210
pub unsafe extern "C" fn compatible_must_use_attributes ( ) -> u64 {
211
- asm ! (
211
+ naked_asm ! (
212
212
"
213
213
mov rax, 42
214
214
ret
@@ -222,20 +222,20 @@ pub unsafe extern "C" fn compatible_must_use_attributes() -> u64 {
222
222
#[ no_mangle]
223
223
#[ naked]
224
224
pub unsafe extern "C" fn compatible_ffi_attributes_1 ( ) {
225
- asm ! ( "" , options( noreturn, raw) ) ;
225
+ naked_asm ! ( "" , options( noreturn, raw) ) ;
226
226
}
227
227
228
228
#[ cold]
229
229
#[ naked]
230
230
pub unsafe extern "C" fn compatible_codegen_attributes ( ) {
231
- asm ! ( "" , options( noreturn, raw) ) ;
231
+ naked_asm ! ( "" , options( noreturn, raw) ) ;
232
232
}
233
233
234
234
#[ cfg( target_arch = "x86_64" ) ]
235
235
#[ target_feature( enable = "sse2" ) ]
236
236
#[ naked]
237
237
pub unsafe extern "C" fn compatible_target_feature ( ) {
238
- asm ! ( "" , options( noreturn) ) ;
238
+ naked_asm ! ( "" , options( noreturn) ) ;
239
239
}
240
240
241
241
#[ doc = "foo bar baz" ]
@@ -244,11 +244,11 @@ pub unsafe extern "C" fn compatible_target_feature() {
244
244
#[ doc( alias = "ADocAlias" ) ]
245
245
#[ naked]
246
246
pub unsafe extern "C" fn compatible_doc_attributes ( ) {
247
- asm ! ( "" , options( noreturn, raw) ) ;
247
+ naked_asm ! ( "" , options( noreturn, raw) ) ;
248
248
}
249
249
250
250
#[ linkage = "external" ]
251
251
#[ naked]
252
252
pub unsafe extern "C" fn compatible_linkage ( ) {
253
- asm ! ( "" , options( noreturn, raw) ) ;
253
+ naked_asm ! ( "" , options( noreturn, raw) ) ;
254
254
}
0 commit comments