@@ -239,13 +239,35 @@ pub enum Ty {
239
239
/// In the chalk parser, the traits that the object represents is parsed as
240
240
/// a QuantifiedInlineBound, and is then changed to a list of where clauses
241
241
/// during lowering.
242
+ ///
243
+ /// See the `Opaque` variant for a discussion about the use of
244
+ /// binders here.
242
245
Dyn ( Binders < Vec < QuantifiedWhereClause > > ) ,
243
246
244
247
/// An "opaque" type is one that is created via the "impl Trait" syntax.
245
248
/// They are named so because the concrete type implementing the trait
246
249
/// is unknown, and hence the type is opaque to us. The only information
247
250
/// that we know of is that this type implements the traits listed by the
248
251
/// user.
252
+ ///
253
+ /// The "binder" here represents the unknown self type. So, a type like
254
+ /// `impl for<'a> Fn(&'a u32)` would be represented with two-levels of
255
+ /// binder, as "depicted" here:
256
+ ///
257
+ /// ```
258
+ /// exists<type> {
259
+ /// vec![
260
+ /// // A QuantifiedWhereClause:
261
+ /// forall<region> { ^1: Fn(&^2 u32) }
262
+ /// ]
263
+ /// }
264
+ /// ```
265
+ ///
266
+ /// The outer `exists<type>` binder indicates that there exists
267
+ /// some type that meets the criteria within, but that type is not
268
+ /// known. It is referenced within the type using `^1`, indicating
269
+ /// a bound type with debruijn index 1 (i.e., skipping through one
270
+ /// level of binder).
249
271
Opaque ( Binders < Vec < QuantifiedWhereClause > > ) ,
250
272
251
273
/// A "projection" type corresponds to an (unnormalized)
0 commit comments