Context
The inner state of a generator contains so-called "witness" types.
Those types influence which auto types a generator implements:
a generator may not be Send if its inner state contains a non-Send type.
Generators are currently type-checked as follows.
The generator has type Generator(parent_substs, resume ty, yield ty, return ty, witness, upvars types).
During most of typeck, witness is a type variable.
Once most inference is done, the set of captured types is computed on HIR.