Higher-Rank Trait Bounds (HRTBs)
If we try to naively desugar this code in the same way that we did in thelifetimes section, we run into some trouble:
This job requires The Magic of Higher-Rank Trait Bounds (HRTBs). The way wedesugar this is as follows:
for<'a>
can be read as “for all choices of 'a
“, and basically produces aninfinite list of trait bounds that F must satisfy. Intense. There aren’t manyplaces outside of the traits where we encounter HRTBs, and even forthose we have a nice magic sugar for the common cases.