Skip to content

Commit cbc2edc

Browse files
committed
Update link_ordinal to use the attribute template
1 parent c362c89 commit cbc2edc

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/items/external-blocks.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,29 @@ The *`link_ordinal` [attribute][attributes]* can be applied on declarations insi
431431
> }
432432
> ```
433433
434+
r[items.extern.attributes.link_ordinal.syntax]
435+
The syntax for the `link_ordinal` attribute is:
436+
437+
```grammar,attributes
438+
@root LinkOrdinalAttribute -> `link_ordinal` `(` LinkOrdinal `)`
439+
440+
LinkOrdinal -> DEC_LITERAL | BIN_LITERAL | OCT_LITERAL | HEX_LITERAL
441+
```
442+
443+
r[items.extern.attributes.link_ordinal.max]
444+
The ordinal must be less than or equal to [`u16::MAX`].
445+
446+
r[items.extern.attributes.link_ordinal.allowed-positions]
447+
The `link_ordinal` attribute may be specified on a function or static in an `extern` block.
448+
449+
r[items.extern.attributes.link_ordinal.duplicates]
450+
The `link_ordinal` attribute may only be specified once on an item.
451+
434452
r[items.extern.attributes.link_ordinal.allowed-kinds]
435-
This attribute is only used with the `raw-dylib` linking kind. Using any other kind will result in a compiler error.
453+
The `link_ordinal` attribute may only be used with the [`raw-dylib` linking kind][items.extern.attributes.link.raw-dylib].
436454

437-
r[items.extern.attributes.link_ordinal.exclusive]
438-
Using this attribute with the `link_name` attribute will result in a compiler error.
455+
r[items.extern.attributes.link_ordinal.link_name]
456+
The `link_ordinal` attribute may not be used with the [`link_name`] attribute.
439457

440458
r[items.extern.attributes.fn-parameters]
441459
### Attributes on function parameters
@@ -456,3 +474,4 @@ restrictions as [regular function parameters].
456474
[statics]: static-items.md
457475
[unwind-behavior]: functions.md#unwinding
458476
[value namespace]: ../names/namespaces.md
477+
[`link_name`]: items.extern.attributes.link_name

0 commit comments

Comments
 (0)