@@ -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
@@ -200,19 +203,19 @@ r[items.extern.attributes.link.raw-dylib]
200
203
an import library to link against (see [ ` dylib ` versus ` raw-dylib ` ] below
201
204
for details). This is only valid for Windows targets.
202
205
203
- r[ items.extern.attributes.link.constraint ]
206
+ r[ items.extern.attributes.link.name-requirement ]
204
207
The ` name ` key must be included if ` kind ` is specified.
205
208
206
209
r[ items.extern.attributes.link.modifiers]
207
210
The optional ` modifiers ` argument is a way to specify linking modifiers for the
208
211
library to link.
209
212
210
- r[ items.extern.attributes.link.modifiers- syntax]
213
+ r[ items.extern.attributes.link.modifiers. syntax]
211
214
Modifiers are specified as a comma-delimited string with each modifier prefixed
212
215
with either a ` + ` or ` - ` to indicate that the modifier is enabled or disabled,
213
216
respectively.
214
217
215
- r[ items.extern.attributes.link.modifiers-constraint ]
218
+ r[ items.extern.attributes.link.modifiers.multiple ]
216
219
Specifying multiple ` modifiers ` arguments in a single ` link ` attribute,
217
220
or multiple identical modifiers in the same ` modifiers ` argument is not currently supported. \
218
221
Example: ` #[link(name = "mylib", kind = "static", modifiers = "+whole-archive")] ` .
@@ -249,69 +252,69 @@ block.
249
252
250
253
#### Linking modifiers: ` bundle `
251
254
252
- r[ items.extern.attributes.link.modifier- bundle]
255
+ r[ items.extern.attributes.link.modifiers. bundle]
253
256
254
- r[ items.extern.attributes.link.modifier- bundle.constraint ]
257
+ r[ items.extern.attributes.link.modifiers. bundle.allowed-kinds ]
255
258
This modifier is only compatible with the ` static ` linking kind.
256
259
Using any other kind will result in a compiler error.
257
260
258
- r[ items.extern.attributes.link.modifier- bundle.behaviour ]
261
+ r[ items.extern.attributes.link.modifiers. bundle.behavior ]
259
262
When building a rlib or staticlib ` +bundle ` means that the native static library
260
263
will be packed into the rlib or staticlib archive, and then retrieved from there
261
264
during linking of the final binary.
262
265
263
- r[ items.extern.attributes.link.modifier- bundle.behaviour -negative]
266
+ r[ items.extern.attributes.link.modifiers. bundle.behavior -negative]
264
267
When building a rlib ` -bundle ` means that the native static library is registered as a dependency
265
268
of that rlib "by name", and object files from it are included only during linking of the final
266
269
binary, the file search by that name is also performed during final linking. \
267
270
When building a staticlib ` -bundle ` means that the native static library is simply not included
268
271
into the archive and some higher level build system will need to add it later during linking of
269
272
the final binary.
270
273
271
- r[ items.extern.attributes.link.modifier- bundle.no-effect]
274
+ r[ items.extern.attributes.link.modifiers. bundle.no-effect]
272
275
This modifier has no effect when building other targets like executables or dynamic libraries.
273
276
274
- r[ items.extern.attributes.link.modifier- bundle.default]
277
+ r[ items.extern.attributes.link.modifiers. bundle.default]
275
278
The default for this modifier is ` +bundle ` .
276
279
277
280
More implementation details about this modifier can be found in
278
281
[ ` bundle ` documentation for rustc] .
279
282
280
283
#### Linking modifiers: ` whole-archive `
281
284
282
- r[ items.extern.attributes.link.modifier- whole-archive]
285
+ r[ items.extern.attributes.link.modifiers. whole-archive]
283
286
284
- r[ items.extern.attributes.link.modifier- whole-archive.constraint ]
287
+ r[ items.extern.attributes.link.modifiers. whole-archive.allowed-kinds ]
285
288
This modifier is only compatible with the ` static ` linking kind.
286
289
Using any other kind will result in a compiler error.
287
290
288
- r[ items.extern.attributes.link.modifier- whole-archive.behaviour ]
291
+ r[ items.extern.attributes.link.modifiers. whole-archive.behavior ]
289
292
` +whole-archive ` means that the static library is linked as a whole archive
290
293
without throwing any object files away.
291
294
292
- r[ items.extern.attributes.link.modifier- whole-archive.default]
295
+ r[ items.extern.attributes.link.modifiers. whole-archive.default]
293
296
The default for this modifier is ` -whole-archive ` .
294
297
295
298
More implementation details about this modifier can be found in
296
299
[ ` whole-archive ` documentation for rustc] .
297
300
298
301
### Linking modifiers: ` verbatim `
299
302
300
- r[ items.extern.attributes.link.modifier- verbatim]
303
+ r[ items.extern.attributes.link.modifiers. verbatim]
301
304
302
- r[ items.extern.attributes.link.modifier- verbatim.constraint ]
305
+ r[ items.extern.attributes.link.modifiers. verbatim.allowed-kinds ]
303
306
This modifier is compatible with all linking kinds.
304
307
305
- r[ items.extern.attributes.link.modifier- verbatim.behaviour ]
308
+ r[ items.extern.attributes.link.modifiers. verbatim.behavior ]
306
309
` +verbatim ` means that rustc itself won't add any target-specified library prefixes or suffixes
307
310
(like ` lib ` or ` .a ` ) to the library name, and will try its best to ask for the same thing from the
308
311
linker.
309
312
310
- r[ items.extern.attributes.link.modifier- verbatim.behaviour -negative]
313
+ r[ items.extern.attributes.link.modifiers. verbatim.behavior -negative]
311
314
` -verbatim ` means that rustc will either add a target-specific prefix and suffix to the library
312
315
name before passing it to linker, or won't prevent linker from implicitly adding it.
313
316
314
- r[ items.extern.attributes.link.modifier- verbatim.default]
317
+ r[ items.extern.attributes.link.modifiers. verbatim.default]
315
318
The default for this modifier is ` -verbatim ` .
316
319
317
320
More implementation details about this modifier can be found in
@@ -420,7 +423,7 @@ unsafe extern "stdcall" {
420
423
}
421
424
```
422
425
423
- r[ items.extern.attributes.link_ordinal.constraints ]
426
+ r[ items.extern.attributes.link_ordinal.allowed-kinds ]
424
427
This attribute is only used with the ` raw-dylib ` linking kind.
425
428
Using any other kind will result in a compiler error.
426
429
0 commit comments