New lints: functions with explicit ABI export names #502
Labels
A-lint
Area: new or existing lint
E-help-wanted
Call for participation: Help is requested to fix this issue.
E-mentor
Call for participation: Mentorship is available for this issue.
Consider a function like this:
The following change is non-breaking, since it's equivalent:
However, changing to any other
export_name
value (one that does not match the original name of the function) is breaking.Example code where you can play with
#[no_mangle]
and#[export_name]
: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=64663d9ca343dee3ba9d2c7cabe61ab4We have an
export_name
property on functions which sorts out#[no_mangle]
and#[export_name]
under the hood, and presents the actual export name (if any) of the function: https://github.com/obi1kenobi/trustfall-rustdoc-adapter/blob/rustdoc-v27/src/rustdoc_schema.graphql#L618We want the following lints:
Additional work items:
#[no_mangle]
and#[export_name]
can appear on associated functions ("methods"), not just top-level functions. Make it possible for our lints to cover those as well — it doesn't appear to be a breaking change per se to change whether an ABI-exported function is top-level vs associated with a type.The text was updated successfully, but these errors were encountered: