You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ty_module/instantiating_binders.md
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -105,7 +105,8 @@ the `RePlaceholder` for the `'b` parameter is in a higher universe to track the
105
105
106
106
## Instantiating with `ReLateParam`
107
107
108
-
As discussed in a previous chapter, `RegionKind` has two variants for representing generic parameters, `ReLateParam` and `ReEarlyParam`. `ReLateParam` is conceptually a `Placeholder` that is always in the root universe (`U0`). It is used when instantiating late bound parameters of functions/closures while inside of them. Its actual representation is relatively different from both `ReEarlyParam` and `RePlaceholder`:
108
+
As discussed in [the chapter about representing types][representing-types], `RegionKind` has two variants for representing generic parameters, `ReLateParam` and `ReEarlyParam`.
109
+
`ReLateParam` is conceptually a `Placeholder` that is always in the root universe (`U0`). It is used when instantiating late bound parameters of functions/closures while inside of them. Its actual representation is relatively different from both `ReEarlyParam` and `RePlaceholder`:
109
110
- A `DefId` for the item that introduced the late bound generic parameter
110
111
- A [`BoundRegionKind`] which either specifies the `DefId` of the generic parameter and its name (via a `Symbol`), or that this placeholder is representing the anonymous lifetime of a `Fn`/`FnMut` closure's self borrow. There is also a variant for `BrAnon` but this is not used for `ReLateParam`.
111
112
@@ -133,6 +134,7 @@ Generally whenever we have a `Binder` for late bound parameters on a function/cl
133
134
As a concrete example, accessing the signature of a function we are type checking will be represented as `EarlyBinder<Binder<FnSig>>`. As we are already "inside" of these binders, we would call `instantiate_identity` followed by `liberate_late_bound_regions`.
Copy file name to clipboardExpand all lines: src/ty_module/param_ty_const_regions.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -11,15 +11,15 @@ TyKind::Ref(
11
11
12
12
There are three separate ways we represent usages of generic parameters:
13
13
-[`TyKind::Param`]/[`ConstKind::Param`]/[`RegionKind::EarlyParam`] for early bound generic parameters (note: all type and const parameters are considered early bound, see the [chapter on early vs late bound parameters][ch_early_late_bound] for more information)
14
-
-[`TyKind::Bound`]/[`ConstKind::Bound`]/[`RegionKind::Bound`] for references to parameters introduced via higher ranked bounds or higher ranked types i.e. `for<'a> fn(&'a u32)` or `for<'a> T: Trait<'a>`. This will be discussed in the [chapter on `Binder`s][ch_binders].
15
-
-[`RegionKind::LateParam`] for late bound lifetime parameters, `LateParam`will be discussed in the [chapter on instantiating `Binder`s][ch_instantiating_binders].
14
+
-[`TyKind::Bound`]/[`ConstKind::Bound`]/[`RegionKind::Bound`] for references to parameters introduced via higher ranked bounds or higher ranked types i.e. `for<'a> fn(&'a u32)` or `for<'a> T: Trait<'a>`. This is discussed in the [chapter on `Binder`s][ch_binders].
15
+
-[`RegionKind::LateParam`] for late bound lifetime parameters, `LateParam`is discussed in the [chapter on instantiating `Binder`s][ch_instantiating_binders].
16
16
17
-
This chapter will only cover`TyKind::Param``ConstKind::Param` and `RegionKind::EarlyParam`.
17
+
This chapter only covers`TyKind::Param``ConstKind::Param` and `RegionKind::EarlyParam`.
18
18
19
19
## Ty/Const Parameters
20
20
21
-
As `TyKind::Param` and `ConstKind::Param` are implemented identically this section will only refer to `TyKind::Param` for simplicity. However
22
-
you should keep in mind that everything here also is true of `ConstKind::Param`
21
+
As `TyKind::Param` and `ConstKind::Param` are implemented identically this section only refers to `TyKind::Param` for simplicity.
22
+
However you should keep in mind that everything here also is true of `ConstKind::Param`
23
23
24
24
Each `TyKind::Param` contains two things: the name of the parameter and an index.
0 commit comments