Auto merge of #116144 - lcnr:subst-less, r=oli-obk
subst -> instantiate continues #110793, there are still quite a few uses of `subst` and `substitute`, but changing them all in the same PR was a bit too much, so I've stopped here for now.
This commit is contained in:
commit
5ae769f06b
25 changed files with 66 additions and 75 deletions
|
@ -162,14 +162,13 @@ fn foo<T>(x: T) {
|
|||
```
|
||||
|
||||
The machine code for `foo::<u8>()`, `foo::<bool>()`, `foo::<String>()`, or any
|
||||
other type substitution is different. Hence the compiler generates the
|
||||
other instantiation is different. Hence the compiler generates the
|
||||
implementation on-demand. If you call `foo()` with a `bool` parameter, the
|
||||
compiler will only generate code for `foo::<bool>()`. When we have additional
|
||||
type parameters, the number of monomorphized implementations the compiler
|
||||
generates does not grow drastically, since the compiler will only generate an
|
||||
implementation if the function is called with unparameterized substitutions
|
||||
(i.e., substitutions where none of the substituted types are themselves
|
||||
parameterized).
|
||||
implementation if the function is called with fully concrete arguments
|
||||
(i.e., arguments which do not contain any generic parameters).
|
||||
|
||||
However, with trait objects we have to make a table containing _every_ object
|
||||
that implements the trait. Now, if it has type parameters, we need to add
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue