Skip to content

Commit a33d999

Browse files
committed
Add template rules for export_name
1 parent 677d600 commit a33d999

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/abi.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,23 @@ The *`export_name` [attribute]* specifies the name of the symbol that will be ex
126126
r[abi.export_name.syntax]
127127
The `export_name` attribute uses the [MetaNameValueStr] syntax to specify the symbol name.
128128
129+
r[abi.export_name.allowed-positions]
130+
The `export_name` attribute may only be applied to:
131+
132+
- [Static items][items.static]
133+
- [Free functions][items.fn]
134+
- [Inherent associated functions][items.associated.fn]
135+
- [Trait impl functions][items.impl.trait]
136+
137+
> [!NOTE]
138+
> `rustc` currently ignores `export_name` in some positions, but this may be rejected in the future.
139+
140+
r[abi.export_name.duplicates]
141+
Only the last instance of `export_name` on an item is honored. Previous `export_name` attributes are ignored.
142+
143+
> [!NOTE]
144+
> `rustc` currently warns on preceding duplicate `export_name` attributes. This may become an error in the future.
145+
129146
r[abi.export_name.unsafe]
130147
This attribute is unsafe as a symbol with a custom name may collide with another symbol with the same name (or with a well-known symbol), leading to undefined behavior.
131148

0 commit comments

Comments
 (0)