Skip to content

Commit d4c24e3

Browse files
committed
Update link_ordinal to use the attribute template
1 parent 9437ba8 commit d4c24e3

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

src/items/external-blocks.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,11 +516,29 @@ The *`link_ordinal` [attribute][attributes]* can be applied on declarations insi
516516
> }
517517
> ```
518518
519+
r[items.extern.attributes.link_ordinal.syntax]
520+
The syntax for the `link_ordinal` attribute is:
521+
522+
```grammar,attributes
523+
@root LinkOrdinalAttribute -> `link_ordinal` `(` LinkOrdinal `)`
524+
525+
LinkOrdinal -> DEC_LITERAL | BIN_LITERAL | OCT_LITERAL | HEX_LITERAL
526+
```
527+
528+
r[items.extern.attributes.link_ordinal.max]
529+
The ordinal must be less than or equal to [`u16::MAX`].
530+
531+
r[items.extern.attributes.link_ordinal.allowed-positions]
532+
The `link_ordinal` attribute may be specified on a function or static in an `extern` block.
533+
534+
r[items.extern.attributes.link_ordinal.duplicates]
535+
The `link_ordinal` attribute may only be specified once on an item.
536+
519537
r[items.extern.attributes.link_ordinal.allowed-kinds]
520-
This attribute is only used with the `raw-dylib` linking kind. Using any other kind will result in a compiler error.
538+
The `link_ordinal` attribute may only be used with the [`raw-dylib` linking kind][items.extern.attributes.link.raw-dylib].
521539

522-
r[items.extern.attributes.link_ordinal.exclusive]
523-
Using this attribute with the `link_name` attribute will result in a compiler error.
540+
r[items.extern.attributes.link_ordinal.link_name]
541+
The `link_ordinal` attribute may not be used with the [`link_name`] attribute.
524542

525543
r[items.extern.attributes.fn-parameters]
526544
### Attributes on function parameters
@@ -535,6 +553,8 @@ restrictions as [regular function parameters].
535553
[`bundle` documentation for rustc]: ../../rustc/command-line-arguments.html#linking-modifiers-bundle
536554
[`dylib` versus `raw-dylib`]: #dylib-versus-raw-dylib
537555
[`extern fn`]: items.fn.extern
556+
[`link_name`]: items.extern.attributes.link_name
557+
[`link_ordinal`]: items.extern.attributes.link_ordinal
538558
[`unsafe` context]: ../unsafe-keyword.md
539559
[`verbatim` documentation for rustc]: ../../rustc/command-line-arguments.html#linking-modifiers-verbatim
540560
[`whole-archive` documentation for rustc]: ../../rustc/command-line-arguments.html#linking-modifiers-whole-archive
@@ -545,4 +565,3 @@ restrictions as [regular function parameters].
545565
[unwind-behavior]: functions.md#unwinding
546566
[value namespace]: ../names/namespaces.md
547567
[win32 api]: https://learn.microsoft.com/en-us/windows/win32/api/
548-
[`link_ordinal`]: items.extern.attributes.link_ordinal

0 commit comments

Comments
 (0)