@@ -42,7 +42,7 @@ wasteful.
42
42
Often, we wish to write code that explicitly asserts that it is not
43
43
taking place during inference. In that case, there is no "local"
44
44
arena, and all the types that you can access are allocated in the
45
- global arena. To express this, the idea is to us the same lifetime
45
+ global arena. To express this, the idea is to use the same lifetime
46
46
for the ` 'gcx ` and ` 'tcx ` parameters of ` TyCtxt ` . Just to be a touch
47
47
confusing, we tend to use the name ` 'tcx ` in such contexts. Here is an
48
48
example:
@@ -100,10 +100,10 @@ fn test_type<'tcx>(ty: Ty<'tcx>) {
100
100
101
101
The ` sty ` field (the origin of this name is unclear to me; perhaps
102
102
structural type?) is of type ` TypeVariants<'tcx> ` , which is an enum
103
- definined all of the different kinds of types in the compiler.
103
+ defining all of the different kinds of types in the compiler.
104
104
105
105
> NB: inspecting the ` sty ` field on types during type inference can be
106
- > risky, as there are may be inference variables and other things to
106
+ > risky, as there may be inference variables and other things to
107
107
> consider, or sometimes types are not yet known that will become
108
108
> known later.).
109
109
@@ -132,7 +132,7 @@ a safe approximation, so that is what you get back.
132
132
> you are going to be testing for type equality, you probably need to
133
133
> start looking into the inference code to do it right.
134
134
135
- You can also find various common types in the tcx itself by accessing
135
+ You can also find various common types in the ` tcx ` itself by accessing
136
136
` tcx.types.bool ` , ` tcx.types.char ` , etc (see ` CommonTypes ` for more).
137
137
138
138
### Beyond types: Other kinds of arena-allocated data structures
@@ -143,7 +143,7 @@ module. Here are a few examples:
143
143
144
144
- ` Substs ` , allocated with ` mk_substs ` -- this will intern a slice of types, often used to
145
145
specify the values to be substituted for generics (e.g., ` HashMap<i32, u32> `
146
- would be represented as a slice ` &'tcx [tcx.types.i32, tcx.types.u32] ` .
146
+ would be represented as a slice ` &'tcx [tcx.types.i32, tcx.types.u32] ` ) .
147
147
- ` TraitRef ` , typically passed by value -- a ** trait reference**
148
148
consists of a reference to a trait along with its various type
149
149
parameters (including ` Self ` ), like ` i32: Display ` (here, the def-id
0 commit comments