diff options
| author | Tshepang Mbambo <tshepang@gmail.com> | 2023-08-22 08:52:20 +0200 |
|---|---|---|
| committer | Tshepang Mbambo <tshepang@gmail.com> | 2023-08-22 08:52:56 +0200 |
| commit | 0ac8746d5b70057e2fd5bb679fff0f08f3852a03 (patch) | |
| tree | 9f0469dccf447a4f76c1345d28aa720c4afc1795 /src/doc/rustc-dev-guide | |
| parent | 8916ca67b11ac52a31f3a824187da7050a0e56c5 (diff) | |
| download | rust-0ac8746d5b70057e2fd5bb679fff0f08f3852a03.tar.gz rust-0ac8746d5b70057e2fd5bb679fff0f08f3852a03.zip | |
avoid repetition
Diffstat (limited to 'src/doc/rustc-dev-guide')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/generics.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/doc/rustc-dev-guide/src/generics.md b/src/doc/rustc-dev-guide/src/generics.md index 91d12cef9fb..2badc113644 100644 --- a/src/doc/rustc-dev-guide/src/generics.md +++ b/src/doc/rustc-dev-guide/src/generics.md @@ -127,7 +127,7 @@ You may have a couple of followup questions… `MyStruct`: `Adt(Foo, &[Param(0), Param(1)])`. **`instantiate`** How do we actually do the substitutions? There is a function for that too! You -use [`instantiate`][instantiate] to replace a `GenericArgsRef` with another list of types. +use [`instantiate`] to replace a `GenericArgsRef` with another list of types. [Here is an example of actually using `instantiate` in the compiler][instantiatex]. The exact details are not too important, but in this piece of code, we happen to be @@ -135,7 +135,7 @@ converting from the `rustc_hir::Ty` to a real `ty::Ty`. You can see that we firs (`args`). Then we call `type_of` to get a type and call `ty.instantiate(tcx, args)` to get a new version of `ty` with the args made. -[instantiate]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/generic_args/struct.EarlyBinder.html#method.instantiate +[`instantiate`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/generic_args/struct.EarlyBinder.html#method.instantiate [instantiatex]: https://github.com/rust-lang/rust/blob/8a562f9671e36cf29c9c794c2646bcf252d55535/compiler/rustc_hir_analysis/src/astconv/mod.rs#L905-L927 **Note on indices:** It is possible for the indices in `Param` to not match with what we expect. For |
