diff options
| author | Shoyu Vanilla <modulo641@gmail.com> | 2024-02-12 15:39:32 +0900 |
|---|---|---|
| committer | Shoyu Vanilla <modulo641@gmail.com> | 2024-02-12 15:46:35 +0900 |
| commit | 3856df059ed90b8fd19a82efbfb9da36f68e6bb9 (patch) | |
| tree | 7a43e8e838ec0c6fc06a3e9f9b77c4e77246f179 /compiler/rustc_error_codes | |
| parent | 084ce5bdb5f7dc1c725f6770a8de281165ba3b0a (diff) | |
| download | rust-3856df059ed90b8fd19a82efbfb9da36f68e6bb9.tar.gz rust-3856df059ed90b8fd19a82efbfb9da36f68e6bb9.zip | |
Dejargnonize subst
Diffstat (limited to 'compiler/rustc_error_codes')
5 files changed, 14 insertions, 14 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0139.md b/compiler/rustc_error_codes/src/error_codes/E0139.md index a116cf29395..4f7f65689c6 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0139.md +++ b/compiler/rustc_error_codes/src/error_codes/E0139.md @@ -22,9 +22,9 @@ fn foo<T>(x: Vec<T>) { In this specific case there's a good chance that the transmute is harmless (but this is not guaranteed by Rust). However, when alignment and enum optimizations come into the picture, it's quite likely that the sizes may or may not match -with different type parameter substitutions. It's not possible to check this for -_all_ possible types, so `transmute()` simply only accepts types without any -unsubstituted type parameters. +with different type parameter instantiations. It's not possible to check this +for _all_ possible types, so `transmute()` simply only accepts types without any +uninstantiated type parameters. If you need this, there's a good chance you're doing something wrong. Keep in mind that Rust doesn't guarantee much about the layout of different structs @@ -32,7 +32,7 @@ mind that Rust doesn't guarantee much about the layout of different structs there is a solution that avoids the transmute entirely, try it instead. If it's possible, hand-monomorphize the code by writing the function for each -possible type substitution. It's possible to use traits to do this cleanly, +possible type instantiation. It's possible to use traits to do this cleanly, for example: ``` diff --git a/compiler/rustc_error_codes/src/error_codes/E0230.md b/compiler/rustc_error_codes/src/error_codes/E0230.md index 87ea90e73c9..c30a7e38e9c 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0230.md +++ b/compiler/rustc_error_codes/src/error_codes/E0230.md @@ -15,9 +15,9 @@ There will be an error about `bool` not implementing `Index<u8>`, followed by a note saying "the type `bool` cannot be indexed by `u8`". As you can see, you can specify type parameters in curly braces for -substitution with the actual types (using the regular format string syntax) in -a given situation. Furthermore, `{Self}` will substitute to the type (in this -case, `bool`) that we tried to use. +instantiation with the actual types (using the regular format string syntax) in +a given situation. Furthermore, `{Self}` will be instantiated to the type (in +this case, `bool`) that we tried to use. This error appears when the curly braces contain an identifier which doesn't match with any of the type parameters or the string `Self`. This might happen diff --git a/compiler/rustc_error_codes/src/error_codes/E0231.md b/compiler/rustc_error_codes/src/error_codes/E0231.md index a1aaf90df49..b22e3c7082a 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0231.md +++ b/compiler/rustc_error_codes/src/error_codes/E0231.md @@ -15,9 +15,9 @@ there will be an error about `bool` not implementing `Index<u8>`, followed by a note saying "the type `bool` cannot be indexed by `u8`". As you can see, you can specify type parameters in curly braces for -substitution with the actual types (using the regular format string syntax) in -a given situation. Furthermore, `{Self}` will substitute to the type (in this -case, `bool`) that we tried to use. +instantiation with the actual types (using the regular format string syntax) in +a given situation. Furthermore, `{Self}` will be instantiated to the type (in +this case, `bool`) that we tried to use. This error appears when the curly braces do not contain an identifier. Please add one of the same name as a type parameter. If you intended to use literal diff --git a/compiler/rustc_error_codes/src/error_codes/E0393.md b/compiler/rustc_error_codes/src/error_codes/E0393.md index 3e853cf1b8a..50225b25163 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0393.md +++ b/compiler/rustc_error_codes/src/error_codes/E0393.md @@ -12,12 +12,12 @@ fn together_we_will_rule_the_galaxy(son: &A) {} ``` A trait object is defined over a single, fully-defined trait. With a regular -default parameter, this parameter can just be substituted in. However, if the +default parameter, this parameter can just be instantiated in. However, if the default parameter is `Self`, the trait changes for each concrete type; i.e. `i32` will be expected to implement `A<i32>`, `bool` will be expected to implement `A<bool>`, etc... These types will not share an implementation of a fully-defined trait; instead they share implementations of a trait with -different parameters substituted in for each implementation. This is +different parameters instantiated in for each implementation. This is irreconcilable with what we need to make a trait object work, and is thus disallowed. Making the trait concrete by explicitly specifying the value of the defaulted parameter will fix this issue. Fixed example: diff --git a/compiler/rustc_error_codes/src/error_codes/E0794.md b/compiler/rustc_error_codes/src/error_codes/E0794.md index c8f73de95a2..dcbe2b97c85 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0794.md +++ b/compiler/rustc_error_codes/src/error_codes/E0794.md @@ -14,7 +14,7 @@ let _ = foo::<'static>; The type of a concrete instance of a generic function is universally quantified over late-bound lifetime parameters. This is because we want the function to -work for any lifetime substituted for the late-bound lifetime parameter, no +work for any lifetime instantiated for the late-bound lifetime parameter, no matter where the function is called. Consequently, it doesn't make sense to specify arguments for late-bound lifetime parameters, since they are not resolved until the function's call site(s). @@ -56,7 +56,7 @@ let bar_fn3 = bar::<Bar>; // OK In the definition of `bar`, the lifetime parameter `'a` is late-bound, while `'b` is early-bound. This is reflected in the type annotation for `bar_fn`, -where `'a` is universally quantified and `'b` is substituted by a specific +where `'a` is universally quantified and `'b` is instantiated with a specific lifetime. It is not allowed to explicitly specify early-bound lifetime arguments when late-bound lifetime parameters are present (as for `bar_fn2`, see [issue #42868](https://github.com/rust-lang/rust/issues/42868)), although |
