diff options
| author | lcnr <rust@lcnr.de> | 2023-09-25 15:46:38 +0200 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2023-09-26 09:37:55 +0200 |
| commit | 3c52a3e280a5fd1e8e4b48a5ec349aa00dcd859c (patch) | |
| tree | a3fba4b376549219f6c14cb165be2009d3236207 /compiler/rustc_error_codes | |
| parent | af685931799459879b2a8995524755a06ffb5eec (diff) | |
| download | rust-3c52a3e280a5fd1e8e4b48a5ec349aa00dcd859c.tar.gz rust-3c52a3e280a5fd1e8e4b48a5ec349aa00dcd859c.zip | |
subst -> instantiate
Diffstat (limited to 'compiler/rustc_error_codes')
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0038.md | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0038.md b/compiler/rustc_error_codes/src/error_codes/E0038.md index 584b78554ef..8f8eabb1519 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0038.md +++ b/compiler/rustc_error_codes/src/error_codes/E0038.md @@ -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 |
