Commit 196b7f4 1 parent 844d581 commit 196b7f4 Copy full SHA for 196b7f4
File tree 1 file changed +2
-2
lines changed
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -127,15 +127,15 @@ You may have a couple of followup questions…
127
127
` MyStruct ` : ` Adt(Foo, &[Param(0), Param(1)]) ` .
128
128
129
129
** ` 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.
131
131
132
132
[ Here is an example of actually using ` instantiate ` in the compiler] [ instantiatex ] .
133
133
The exact details are not too important, but in this piece of code, we happen to be
134
134
converting from the ` rustc_hir::Ty ` to a real ` ty::Ty ` . You can see that we first get some args
135
135
(` args ` ). Then we call ` type_of ` to get a type and call ` ty.instantiate(tcx, args) ` to get a new
136
136
version of ` ty ` with the args made.
137
137
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
139
139
[ instantiatex ] : https://github.com/rust-lang/rust/blob/8a562f9671e36cf29c9c794c2646bcf252d55535/compiler/rustc_hir_analysis/src/astconv/mod.rs#L905-L927
140
140
141
141
** Note on indices:** It is possible for the indices in ` Param ` to not match with what we expect. For
You can’t perform that action at this time.
0 commit comments