Compiler for today's Rust - yes.
It should be possible to design a different language or extend Rust with more features so that the compiler would be able to do better. Ocaml can apply functors at module level level generatively.
I understand at PL theory level generative functors are actually simpler to reason about than applicative ones.