Code generation for generics


#1

In C++, specialized code for generics can be generated by the compiler as it has access to the source code. How does Rust compiler generate specialized code, when the function/struct being generalized is part of a compiled rlib?


#2

Inlinable/generic code is included in the rlib. See @eddyb’s SO answer (different question but relevant answer): https://stackoverflow.com/questions/27999559/can-libraries-be-distributed-as-a-binary-so-the-end-user-cannot-see-the-source