Conversation
This comment has been minimized.
This comment has been minimized.
fd9a817 to
652be0c
Compare
This comment has been minimized.
This comment has been minimized.
| /// well-known symbol, which may cause undefined behavior. | ||
| /// | ||
| /// Starting with the 2024 edition, the attribute must be written using the `unsafe(...)` syntax. | ||
| /// Earlier editions also permit `#[export_name = "..."]`. |
There was a problem hiding this comment.
Why "also"?
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
652be0c to
c9d3bb5
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
| /// pub extern "C" fn initialize() {} | ||
| /// ``` | ||
| /// | ||
| /// The attribute controls the symbol name and export behavior, but does not change the function's |
There was a problem hiding this comment.
| /// | ||
| /// ```rust | ||
| /// #[unsafe(no_mangle)] | ||
| /// pub extern "C" fn initialize() {} |
There was a problem hiding this comment.
Since below you mention that no_mangle is usually used on extern "C" function, maybe only write:
| /// pub extern "C" fn initialize() {} | |
| pub fn initialize() {} |
here?
| /// Rust normally changes an item's symbol name to encode information such as its module path. | ||
| /// Applying `no_mangle` instead uses the item's identifier as the exported symbol name. | ||
| /// | ||
| /// ```rust |
There was a problem hiding this comment.
| /// ```rust | |
| /// ``` |
And same on all rust code blocks.
| /// ``` | ||
| /// | ||
| /// In this example, Rust code uses `name_in_rust`, while the linker resolves | ||
| /// `actual_symbol_name`. The attribute can only be applied to function and static declarations |
There was a problem hiding this comment.
| /// `actual_symbol_name`. The attribute can only be applied to function and static declarations | |
| /// `actual_symbol_name`. The attribute can only be applied to declarations of static variables and of functions. |
|
Reminder, once the PR becomes ready for a review, use |
Signed-off-by: Amirhossein Akhlaghpour <m9.akhlaghpoor@gmail.com>
|
@rustbot ready |
|
@GuillaumeGomez Thanks , updated |
|
☔ The latest upstream changes (presumably #163465) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
Documents the no_mangle, export_name, link_name attributes
Part of #157604
r? @GuillaumeGomez