Skip to content

Commit 1fb40c0

Browse files
ehusstraviscross
authored andcommitted
Update link_name to use the attribute template
1 parent 83f6b91 commit 1fb40c0

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/items/external-blocks.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,22 @@ The *`link_name` [attribute][attributes]* may be specified on declarations insid
406406
> ```
407407
408408
r[items.extern.attributes.link_name.syntax]
409-
It uses the [MetaNameValueStr] syntax to specify the name of the symbol.
409+
The `link_name` attribute uses the [MetaNameValueStr] syntax to specify the name of the symbol.
410410
411-
r[items.extern.attributes.link_name.exclusive]
412-
Using this attribute with the `link_ordinal` attribute will result in a compiler error.
411+
r[items.extern.attributes.link_name.allowed-positions]
412+
The `link_name` attribute may be specified on a function or static in an `extern` block.
413+
414+
> [!NOTE]
415+
> `rustc` currently warns in other positions, but this may be rejected in the future.
416+
417+
r[items.extern.attributes.link_name.duplicates]
418+
Only the last instance of `link_name` on an item is used to determine the symbol name.
419+
420+
> [!NOTE]
421+
> `rustc` currently warns on preceding duplicate `link_name` attributes. This may become an error in the future.
422+
423+
r[items.extern.attributes.link_name.link_ordinal]
424+
The `link_name` attribute may not be used with the [`link_ordinal`] attribute.
413425
414426
r[items.extern.attributes.link_ordinal]
415427
### The `link_ordinal` attribute
@@ -460,3 +472,4 @@ restrictions as [regular function parameters].
460472
[statics]: static-items.md
461473
[unwind-behavior]: functions.md#unwinding
462474
[value namespace]: ../names/namespaces.md
475+
[`link_ordinal`]: items.extern.attributes.link_ordinal

0 commit comments

Comments
 (0)