name mangling
How the compiler renames functions to encode extra information, which C can't read.
Rust mangles symbol names to encode paths and generics; #[unsafe(no_mangle)] keeps the plain name so C code can link to the function.
Loading interactive…
Examples
#[unsafe(no_mangle)]keepsparcel_costunder its own name so C can link to it; in edition 2024 the bare#[no_mangle]is an error.
See also