Skip to content

Commit 196b7f4

Browse files
committed
avoid repetition
1 parent 844d581 commit 196b7f4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/generics.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ You may have a couple of followup questions…
127127
`MyStruct`: `Adt(Foo, &[Param(0), Param(1)])`.
128128

129129
**`instantiate`** How do we actually do the substitutions? There is a function for that too! You
130-
use [`instantiate`][instantiate] to replace a `GenericArgsRef` with another list of types.
130+
use [`instantiate`] to replace a `GenericArgsRef` with another list of types.
131131

132132
[Here is an example of actually using `instantiate` in the compiler][instantiatex].
133133
The exact details are not too important, but in this piece of code, we happen to be
134134
converting from the `rustc_hir::Ty` to a real `ty::Ty`. You can see that we first get some args
135135
(`args`). Then we call `type_of` to get a type and call `ty.instantiate(tcx, args)` to get a new
136136
version of `ty` with the args made.
137137

138-
[instantiate]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/generic_args/struct.EarlyBinder.html#method.instantiate
138+
[`instantiate`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/generic_args/struct.EarlyBinder.html#method.instantiate
139139
[instantiatex]: https://github.com/rust-lang/rust/blob/8a562f9671e36cf29c9c794c2646bcf252d55535/compiler/rustc_hir_analysis/src/astconv/mod.rs#L905-L927
140140

141141
**Note on indices:** It is possible for the indices in `Param` to not match with what we expect. For

0 commit comments

Comments
 (0)