8
8
9
9
use std:: arch:: { asm, naked_asm} ;
10
10
11
- #[ naked]
11
+ #[ unsafe ( naked) ]
12
12
pub unsafe extern "C" fn inline_asm_macro ( ) {
13
13
asm ! ( "" , options( raw) ) ;
14
14
//~^ERROR the `asm!` macro is not allowed in naked functions
@@ -20,7 +20,7 @@ pub struct P {
20
20
y : u16 ,
21
21
}
22
22
23
- #[ naked]
23
+ #[ unsafe ( naked) ]
24
24
pub unsafe extern "C" fn patterns (
25
25
mut a : u32 ,
26
26
//~^ ERROR patterns not allowed in naked function parameters
@@ -34,27 +34,27 @@ pub unsafe extern "C" fn patterns(
34
34
naked_asm ! ( "" )
35
35
}
36
36
37
- #[ naked]
37
+ #[ unsafe ( naked) ]
38
38
pub unsafe extern "C" fn inc ( a : u32 ) -> u32 {
39
39
//~^ ERROR naked functions must contain a single `naked_asm!` invocation
40
40
a + 1
41
41
//~^ ERROR referencing function parameters is not allowed in naked functions
42
42
}
43
43
44
- #[ naked]
44
+ #[ unsafe ( naked) ]
45
45
#[ allow( asm_sub_register) ]
46
46
pub unsafe extern "C" fn inc_asm ( a : u32 ) -> u32 {
47
47
naked_asm ! ( "/* {0} */" , in( reg) a)
48
48
//~^ ERROR the `in` operand cannot be used with `naked_asm!`
49
49
}
50
50
51
- #[ naked]
51
+ #[ unsafe ( naked) ]
52
52
pub unsafe extern "C" fn inc_closure ( a : u32 ) -> u32 {
53
53
//~^ ERROR naked functions must contain a single `naked_asm!` invocation
54
54
( || a + 1 ) ( )
55
55
}
56
56
57
- #[ naked]
57
+ #[ unsafe ( naked) ]
58
58
pub unsafe extern "C" fn unsupported_operands ( ) {
59
59
//~^ ERROR naked functions must contain a single `naked_asm!` invocation
60
60
let mut a = 0usize ;
@@ -76,12 +76,12 @@ pub unsafe extern "C" fn unsupported_operands() {
76
76
) ;
77
77
}
78
78
79
- #[ naked]
79
+ #[ unsafe ( naked) ]
80
80
pub extern "C" fn missing_assembly ( ) {
81
81
//~^ ERROR naked functions must contain a single `naked_asm!` invocation
82
82
}
83
83
84
- #[ naked]
84
+ #[ unsafe ( naked) ]
85
85
pub extern "C" fn too_many_asm_blocks ( ) {
86
86
//~^ ERROR naked functions must contain a single `naked_asm!` invocation
87
87
unsafe {
@@ -92,7 +92,7 @@ pub extern "C" fn too_many_asm_blocks() {
92
92
}
93
93
94
94
pub fn outer ( x : u32 ) -> extern "C" fn ( usize ) -> usize {
95
- #[ naked]
95
+ #[ unsafe ( naked) ]
96
96
pub extern "C" fn inner ( y : usize ) -> usize {
97
97
//~^ ERROR naked functions must contain a single `naked_asm!` invocation
98
98
* & y
@@ -101,35 +101,35 @@ pub fn outer(x: u32) -> extern "C" fn(usize) -> usize {
101
101
inner
102
102
}
103
103
104
- #[ naked]
104
+ #[ unsafe ( naked) ]
105
105
unsafe extern "C" fn invalid_options ( ) {
106
106
naked_asm ! ( "" , options( nomem, preserves_flags) ) ;
107
107
//~^ ERROR the `nomem` option cannot be used with `naked_asm!`
108
108
//~| ERROR the `preserves_flags` option cannot be used with `naked_asm!`
109
109
}
110
110
111
- #[ naked]
111
+ #[ unsafe ( naked) ]
112
112
unsafe extern "C" fn invalid_options_continued ( ) {
113
113
naked_asm ! ( "" , options( readonly, nostack) , options( pure) ) ;
114
114
//~^ ERROR the `readonly` option cannot be used with `naked_asm!`
115
115
//~| ERROR the `nostack` option cannot be used with `naked_asm!`
116
116
//~| ERROR the `pure` option cannot be used with `naked_asm!`
117
117
}
118
118
119
- #[ naked]
119
+ #[ unsafe ( naked) ]
120
120
unsafe extern "C" fn invalid_may_unwind ( ) {
121
121
naked_asm ! ( "" , options( may_unwind) ) ;
122
122
//~^ ERROR the `may_unwind` option cannot be used with `naked_asm!`
123
123
}
124
124
125
- #[ naked]
125
+ #[ unsafe ( naked) ]
126
126
pub extern "C" fn valid_a < T > ( ) -> T {
127
127
unsafe {
128
128
naked_asm ! ( "" ) ;
129
129
}
130
130
}
131
131
132
- #[ naked]
132
+ #[ unsafe ( naked) ]
133
133
pub extern "C" fn valid_b ( ) {
134
134
unsafe {
135
135
{
@@ -140,40 +140,40 @@ pub extern "C" fn valid_b() {
140
140
}
141
141
}
142
142
143
- #[ naked]
143
+ #[ unsafe ( naked) ]
144
144
pub unsafe extern "C" fn valid_c ( ) {
145
145
naked_asm ! ( "" ) ;
146
146
}
147
147
148
148
#[ cfg( target_arch = "x86_64" ) ]
149
- #[ naked]
149
+ #[ unsafe ( naked) ]
150
150
pub unsafe extern "C" fn valid_att_syntax ( ) {
151
151
naked_asm ! ( "" , options( att_syntax) ) ;
152
152
}
153
153
154
- #[ naked]
155
- #[ naked]
154
+ #[ unsafe ( naked) ]
155
+ #[ unsafe ( naked) ]
156
156
pub unsafe extern "C" fn allow_compile_error ( a : u32 ) -> u32 {
157
157
compile_error ! ( "this is a user specified error" )
158
158
//~^ ERROR this is a user specified error
159
159
}
160
160
161
- #[ naked]
161
+ #[ unsafe ( naked) ]
162
162
pub unsafe extern "C" fn allow_compile_error_and_asm ( a : u32 ) -> u32 {
163
163
compile_error ! ( "this is a user specified error" ) ;
164
164
//~^ ERROR this is a user specified error
165
165
naked_asm ! ( "" )
166
166
}
167
167
168
- #[ naked]
168
+ #[ unsafe ( naked) ]
169
169
pub unsafe extern "C" fn invalid_asm_syntax ( a : u32 ) -> u32 {
170
170
naked_asm ! ( invalid_syntax)
171
171
//~^ ERROR asm template must be a string literal
172
172
}
173
173
174
174
#[ cfg( target_arch = "x86_64" ) ]
175
175
#[ cfg_attr( target_pointer_width = "64" , no_mangle) ]
176
- #[ naked]
176
+ #[ unsafe ( naked) ]
177
177
pub unsafe extern "C" fn compatible_cfg_attributes ( ) {
178
178
naked_asm ! ( "" , options( att_syntax) ) ;
179
179
}
@@ -182,20 +182,20 @@ pub unsafe extern "C" fn compatible_cfg_attributes() {
182
182
#[ warn( dead_code) ]
183
183
#[ deny( dead_code) ]
184
184
#[ forbid( dead_code) ]
185
- #[ naked]
185
+ #[ unsafe ( naked) ]
186
186
pub unsafe extern "C" fn compatible_diagnostic_attributes ( ) {
187
187
naked_asm ! ( "" , options( raw) ) ;
188
188
}
189
189
190
190
#[ deprecated = "test" ]
191
- #[ naked]
191
+ #[ unsafe ( naked) ]
192
192
pub unsafe extern "C" fn compatible_deprecated_attributes ( ) {
193
193
naked_asm ! ( "" , options( raw) ) ;
194
194
}
195
195
196
196
#[ cfg( target_arch = "x86_64" ) ]
197
197
#[ must_use]
198
- #[ naked]
198
+ #[ unsafe ( naked) ]
199
199
pub unsafe extern "C" fn compatible_must_use_attributes ( ) -> u64 {
200
200
naked_asm ! (
201
201
"
@@ -207,13 +207,13 @@ pub unsafe extern "C" fn compatible_must_use_attributes() -> u64 {
207
207
208
208
#[ export_name = "exported_function_name" ]
209
209
#[ link_section = ".custom_section" ]
210
- #[ naked]
210
+ #[ unsafe ( naked) ]
211
211
pub unsafe extern "C" fn compatible_ffi_attributes_1 ( ) {
212
212
naked_asm ! ( "" , options( raw) ) ;
213
213
}
214
214
215
215
#[ cold]
216
- #[ naked]
216
+ #[ unsafe ( naked) ]
217
217
pub unsafe extern "C" fn compatible_codegen_attributes ( ) {
218
218
naked_asm ! ( "" , options( raw) ) ;
219
219
}
@@ -222,13 +222,13 @@ pub unsafe extern "C" fn compatible_codegen_attributes() {
222
222
/// a doc comment
223
223
// a normal comment
224
224
#[ doc( alias = "ADocAlias" ) ]
225
- #[ naked]
225
+ #[ unsafe ( naked) ]
226
226
pub unsafe extern "C" fn compatible_doc_attributes ( ) {
227
227
naked_asm ! ( "" , options( raw) ) ;
228
228
}
229
229
230
230
#[ linkage = "external" ]
231
- #[ naked]
231
+ #[ unsafe ( naked) ]
232
232
pub unsafe extern "C" fn compatible_linkage ( ) {
233
233
naked_asm ! ( "" , options( raw) ) ;
234
234
}
0 commit comments