@@ -1060,46 +1060,46 @@ impl<'a, 'gcx, 'tcx> ParamTy {
1060
1060
}
1061
1061
}
1062
1062
1063
- /// A [De Bruijn index][dbi] is a standard means of representing
1064
- /// regions (and perhaps later types) in a higher-ranked setting. In
1065
- /// particular, imagine a type like this:
1066
- ///
1067
- /// for<'a> fn(for<'b> fn(&'b isize, &'a isize), &'a char)
1068
- /// ^ ^ | | |
1069
- /// | | | | |
1070
- /// | +------------+ 0 | |
1071
- /// | | |
1072
- /// +--------------------------------+ 1 |
1073
- /// | |
1074
- /// +------------------------------------------+ 0
1075
- ///
1076
- /// In this type, there are two binders (the outer fn and the inner
1077
- /// fn). We need to be able to determine, for any given region, which
1078
- /// fn type it is bound by, the inner or the outer one. There are
1079
- /// various ways you can do this, but a De Bruijn index is one of the
1080
- /// more convenient and has some nice properties. The basic idea is to
1081
- /// count the number of binders, inside out. Some examples should help
1082
- /// clarify what I mean.
1083
- ///
1084
- /// Let's start with the reference type `&'b isize` that is the first
1085
- /// argument to the inner function. This region `'b` is assigned a De
1086
- /// Bruijn index of 0, meaning "the innermost binder" (in this case, a
1087
- /// fn). The region `'a` that appears in the second argument type (`&'a
1088
- /// isize`) would then be assigned a De Bruijn index of 1, meaning "the
1089
- /// second-innermost binder". (These indices are written on the arrays
1090
- /// in the diagram).
1091
- ///
1092
- /// What is interesting is that De Bruijn index attached to a particular
1093
- /// variable will vary depending on where it appears. For example,
1094
- /// the final type `&'a char` also refers to the region `'a` declared on
1095
- /// the outermost fn. But this time, this reference is not nested within
1096
- /// any other binders (i.e., it is not an argument to the inner fn, but
1097
- /// rather the outer one). Therefore, in this case, it is assigned a
1098
- /// De Bruijn index of 0, because the innermost binder in that location
1099
- /// is the outer fn.
1100
- ///
1101
- /// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index
1102
1063
newtype_index ! {
1064
+ /// A [De Bruijn index][dbi] is a standard means of representing
1065
+ /// regions (and perhaps later types) in a higher-ranked setting. In
1066
+ /// particular, imagine a type like this:
1067
+ ///
1068
+ /// for<'a> fn(for<'b> fn(&'b isize, &'a isize), &'a char)
1069
+ /// ^ ^ | | |
1070
+ /// | | | | |
1071
+ /// | +------------+ 0 | |
1072
+ /// | | |
1073
+ /// +--------------------------------+ 1 |
1074
+ /// | |
1075
+ /// +------------------------------------------+ 0
1076
+ ///
1077
+ /// In this type, there are two binders (the outer fn and the inner
1078
+ /// fn). We need to be able to determine, for any given region, which
1079
+ /// fn type it is bound by, the inner or the outer one. There are
1080
+ /// various ways you can do this, but a De Bruijn index is one of the
1081
+ /// more convenient and has some nice properties. The basic idea is to
1082
+ /// count the number of binders, inside out. Some examples should help
1083
+ /// clarify what I mean.
1084
+ ///
1085
+ /// Let's start with the reference type `&'b isize` that is the first
1086
+ /// argument to the inner function. This region `'b` is assigned a De
1087
+ /// Bruijn index of 0, meaning "the innermost binder" (in this case, a
1088
+ /// fn). The region `'a` that appears in the second argument type (`&'a
1089
+ /// isize`) would then be assigned a De Bruijn index of 1, meaning "the
1090
+ /// second-innermost binder". (These indices are written on the arrays
1091
+ /// in the diagram).
1092
+ ///
1093
+ /// What is interesting is that De Bruijn index attached to a particular
1094
+ /// variable will vary depending on where it appears. For example,
1095
+ /// the final type `&'a char` also refers to the region `'a` declared on
1096
+ /// the outermost fn. But this time, this reference is not nested within
1097
+ /// any other binders (i.e., it is not an argument to the inner fn, but
1098
+ /// rather the outer one). Therefore, in this case, it is assigned a
1099
+ /// De Bruijn index of 0, because the innermost binder in that location
1100
+ /// is the outer fn.
1101
+ ///
1102
+ /// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index
1103
1103
pub struct DebruijnIndex {
1104
1104
DEBUG_FORMAT = "DebruijnIndex({})" ,
1105
1105
const INNERMOST = 0 ,
0 commit comments