Reserve necessary space for params in generics_of Always reserve space for the exact number of generic parameters we need in generics_of. As far as I can see, the default is 0/4 elements based on has_self, and the vector grows on after that.
For high-level intro to how type checking works in rustc, see the type checking chapter of the rustc dev guide.