@@ -21,7 +21,7 @@ External blocks provide _declarations_ of items that are not _defined_ in the
21
21
current crate and are the basis of Rust's foreign function interface. These are
22
22
akin to unchecked imports.
23
23
24
- r[ items.extern.restriction ]
24
+ r[ items.extern.allowed-kinds ]
25
25
Two kinds of item _ declarations_ are allowed in external blocks: [ functions] and
26
26
[ statics] .
27
27
@@ -38,10 +38,13 @@ r[items.extern.fn]
38
38
r[ items.extern.fn.body]
39
39
Functions within external blocks are declared in the same way as other Rust
40
40
functions, with the exception that they must not have a body and are instead
41
- terminated by a semicolon
41
+ terminated by a semicolon.
42
42
43
- r[ items.extern.fn.restriction]
44
- Patterns are not allowed in parameters, only [ IDENTIFIER] or ` _ ` may be used. The ` safe ` and ` unsafe ` function qualifiers are
43
+ r[ items.extern.fn.param-patterns]
44
+ Patterns are not allowed in parameters, only [ IDENTIFIER] or ` _ ` may be used.
45
+
46
+ r[ items.extern.fn.qualifiers]
47
+ The ` safe ` and ` unsafe ` function qualifiers are
45
48
allowed, but other function qualifiers (e.g. ` const ` , ` async ` , ` extern ` ) are
46
49
not.
47
50
@@ -199,19 +202,19 @@ r[items.extern.attributes.link.raw-dylib]
199
202
an import library to link against (see [ ` dylib ` versus ` raw-dylib ` ] below
200
203
for details). This is only valid for Windows targets.
201
204
202
- r[ items.extern.attributes.link.constraint ]
205
+ r[ items.extern.attributes.link.name-requirement ]
203
206
The ` name ` key must be included if ` kind ` is specified.
204
207
205
208
r[ items.extern.attributes.link.modifiers]
206
209
The optional ` modifiers ` argument is a way to specify linking modifiers for the
207
210
library to link.
208
211
209
- r[ items.extern.attributes.link.modifiers- syntax]
212
+ r[ items.extern.attributes.link.modifiers. syntax]
210
213
Modifiers are specified as a comma-delimited string with each modifier prefixed
211
214
with either a ` + ` or ` - ` to indicate that the modifier is enabled or disabled,
212
215
respectively.
213
216
214
- r[ items.extern.attributes.link.modifiers-constraint ]
217
+ r[ items.extern.attributes.link.modifiers.multiple ]
215
218
Specifying multiple ` modifiers ` arguments in a single ` link ` attribute,
216
219
or multiple identical modifiers in the same ` modifiers ` argument is not currently supported. \
217
220
Example: ` #[link(name = "mylib", kind = "static", modifiers = "+whole-archive")] ` .
@@ -248,69 +251,69 @@ block.
248
251
249
252
#### Linking modifiers: ` bundle `
250
253
251
- r[ items.extern.attributes.link.modifier- bundle]
254
+ r[ items.extern.attributes.link.modifiers. bundle]
252
255
253
- r[ items.extern.attributes.link.modifier- bundle.constraint ]
256
+ r[ items.extern.attributes.link.modifiers. bundle.allowed-kinds ]
254
257
This modifier is only compatible with the ` static ` linking kind.
255
258
Using any other kind will result in a compiler error.
256
259
257
- r[ items.extern.attributes.link.modifier- bundle.behaviour ]
260
+ r[ items.extern.attributes.link.modifiers. bundle.behavior ]
258
261
When building a rlib or staticlib ` +bundle ` means that the native static library
259
262
will be packed into the rlib or staticlib archive, and then retrieved from there
260
263
during linking of the final binary.
261
264
262
- r[ items.extern.attributes.link.modifier- bundle.behaviour -negative]
265
+ r[ items.extern.attributes.link.modifiers. bundle.behavior -negative]
263
266
When building a rlib ` -bundle ` means that the native static library is registered as a dependency
264
267
of that rlib "by name", and object files from it are included only during linking of the final
265
268
binary, the file search by that name is also performed during final linking. \
266
269
When building a staticlib ` -bundle ` means that the native static library is simply not included
267
270
into the archive and some higher level build system will need to add it later during linking of
268
271
the final binary.
269
272
270
- r[ items.extern.attributes.link.modifier- bundle.no-effect]
273
+ r[ items.extern.attributes.link.modifiers. bundle.no-effect]
271
274
This modifier has no effect when building other targets like executables or dynamic libraries.
272
275
273
- r[ items.extern.attributes.link.modifier- bundle.default]
276
+ r[ items.extern.attributes.link.modifiers. bundle.default]
274
277
The default for this modifier is ` +bundle ` .
275
278
276
279
More implementation details about this modifier can be found in
277
280
[ ` bundle ` documentation for rustc] .
278
281
279
282
#### Linking modifiers: ` whole-archive `
280
283
281
- r[ items.extern.attributes.link.modifier- whole-archive]
284
+ r[ items.extern.attributes.link.modifiers. whole-archive]
282
285
283
- r[ items.extern.attributes.link.modifier- whole-archive.constraint ]
286
+ r[ items.extern.attributes.link.modifiers. whole-archive.allowed-kinds ]
284
287
This modifier is only compatible with the ` static ` linking kind.
285
288
Using any other kind will result in a compiler error.
286
289
287
- r[ items.extern.attributes.link.modifier- whole-archive.behaviour ]
290
+ r[ items.extern.attributes.link.modifiers. whole-archive.behavior ]
288
291
` +whole-archive ` means that the static library is linked as a whole archive
289
292
without throwing any object files away.
290
293
291
- r[ items.extern.attributes.link.modifier- whole-archive.default]
294
+ r[ items.extern.attributes.link.modifiers. whole-archive.default]
292
295
The default for this modifier is ` -whole-archive ` .
293
296
294
297
More implementation details about this modifier can be found in
295
298
[ ` whole-archive ` documentation for rustc] .
296
299
297
300
### Linking modifiers: ` verbatim `
298
301
299
- r[ items.extern.attributes.link.modifier- verbatim]
302
+ r[ items.extern.attributes.link.modifiers. verbatim]
300
303
301
- r[ items.extern.attributes.link.modifier- verbatim.constraint ]
304
+ r[ items.extern.attributes.link.modifiers. verbatim.allowed-kinds ]
302
305
This modifier is compatible with all linking kinds.
303
306
304
- r[ items.extern.attributes.link.modifier- verbatim.behaviour ]
307
+ r[ items.extern.attributes.link.modifiers. verbatim.behavior ]
305
308
` +verbatim ` means that rustc itself won't add any target-specified library prefixes or suffixes
306
309
(like ` lib ` or ` .a ` ) to the library name, and will try its best to ask for the same thing from the
307
310
linker.
308
311
309
- r[ items.extern.attributes.link.modifier- verbatim.behaviour -negative]
312
+ r[ items.extern.attributes.link.modifiers. verbatim.behavior -negative]
310
313
` -verbatim ` means that rustc will either add a target-specific prefix and suffix to the library
311
314
name before passing it to linker, or won't prevent linker from implicitly adding it.
312
315
313
- r[ items.extern.attributes.link.modifier- verbatim.default]
316
+ r[ items.extern.attributes.link.modifiers. verbatim.default]
314
317
The default for this modifier is ` -verbatim ` .
315
318
316
319
More implementation details about this modifier can be found in
@@ -425,7 +428,7 @@ unsafe extern "stdcall" {
425
428
}
426
429
```
427
430
428
- r[ items.extern.attributes.link_ordinal.constraints ]
431
+ r[ items.extern.attributes.link_ordinal.allowed-kinds ]
429
432
This attribute is only used with the ` raw-dylib ` linking kind.
430
433
Using any other kind will result in a compiler error.
431
434
0 commit comments