@@ -1082,46 +1082,46 @@ impl<'a, 'gcx, 'tcx> ParamConst {
10821082 }
10831083}
10841084
1085- /// A [De Bruijn index][dbi] is a standard means of representing
1086- /// regions (and perhaps later types) in a higher-ranked setting. In
1087- /// particular, imagine a type like this:
1088- ///
1089- /// for<'a> fn(for<'b> fn(&'b isize, &'a isize), &'a char)
1090- /// ^ ^ | | |
1091- /// | | | | |
1092- /// | +------------+ 0 | |
1093- /// | | |
1094- /// +--------------------------------+ 1 |
1095- /// | |
1096- /// +------------------------------------------+ 0
1097- ///
1098- /// In this type, there are two binders (the outer fn and the inner
1099- /// fn). We need to be able to determine, for any given region, which
1100- /// fn type it is bound by, the inner or the outer one. There are
1101- /// various ways you can do this, but a De Bruijn index is one of the
1102- /// more convenient and has some nice properties. The basic idea is to
1103- /// count the number of binders, inside out. Some examples should help
1104- /// clarify what I mean.
1105- ///
1106- /// Let's start with the reference type `&'b isize` that is the first
1107- /// argument to the inner function. This region `'b` is assigned a De
1108- /// Bruijn index of 0, meaning "the innermost binder" (in this case, a
1109- /// fn). The region `'a` that appears in the second argument type (`&'a
1110- /// isize`) would then be assigned a De Bruijn index of 1, meaning "the
1111- /// second-innermost binder". (These indices are written on the arrays
1112- /// in the diagram).
1113- ///
1114- /// What is interesting is that De Bruijn index attached to a particular
1115- /// variable will vary depending on where it appears. For example,
1116- /// the final type `&'a char` also refers to the region `'a` declared on
1117- /// the outermost fn. But this time, this reference is not nested within
1118- /// any other binders (i.e., it is not an argument to the inner fn, but
1119- /// rather the outer one). Therefore, in this case, it is assigned a
1120- /// De Bruijn index of 0, because the innermost binder in that location
1121- /// is the outer fn.
1122- ///
1123- /// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index
11241085newtype_index ! {
1086+ /// A [De Bruijn index][dbi] is a standard means of representing
1087+ /// regions (and perhaps later types) in a higher-ranked setting. In
1088+ /// particular, imagine a type like this:
1089+ ///
1090+ /// for<'a> fn(for<'b> fn(&'b isize, &'a isize), &'a char)
1091+ /// ^ ^ | | |
1092+ /// | | | | |
1093+ /// | +------------+ 0 | |
1094+ /// | | |
1095+ /// +--------------------------------+ 1 |
1096+ /// | |
1097+ /// +------------------------------------------+ 0
1098+ ///
1099+ /// In this type, there are two binders (the outer fn and the inner
1100+ /// fn). We need to be able to determine, for any given region, which
1101+ /// fn type it is bound by, the inner or the outer one. There are
1102+ /// various ways you can do this, but a De Bruijn index is one of the
1103+ /// more convenient and has some nice properties. The basic idea is to
1104+ /// count the number of binders, inside out. Some examples should help
1105+ /// clarify what I mean.
1106+ ///
1107+ /// Let's start with the reference type `&'b isize` that is the first
1108+ /// argument to the inner function. This region `'b` is assigned a De
1109+ /// Bruijn index of 0, meaning "the innermost binder" (in this case, a
1110+ /// fn). The region `'a` that appears in the second argument type (`&'a
1111+ /// isize`) would then be assigned a De Bruijn index of 1, meaning "the
1112+ /// second-innermost binder". (These indices are written on the arrays
1113+ /// in the diagram).
1114+ ///
1115+ /// What is interesting is that De Bruijn index attached to a particular
1116+ /// variable will vary depending on where it appears. For example,
1117+ /// the final type `&'a char` also refers to the region `'a` declared on
1118+ /// the outermost fn. But this time, this reference is not nested within
1119+ /// any other binders (i.e., it is not an argument to the inner fn, but
1120+ /// rather the outer one). Therefore, in this case, it is assigned a
1121+ /// De Bruijn index of 0, because the innermost binder in that location
1122+ /// is the outer fn.
1123+ ///
1124+ /// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index
11251125 pub struct DebruijnIndex {
11261126 DEBUG_FORMAT = "DebruijnIndex({})" ,
11271127 const INNERMOST = 0 ,
0 commit comments