Code generation for generics

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?

Inlinable/generic code is included in the rlib. See @eddyb's SO answer (different question but relevant answer): rust - Can libraries be distributed as a binary, so the end user cannot see the source code? - Stack Overflow

1 Like