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