Like @bjorn3 said, S
is represented as a TyKind::Adt
using a DefId
. Since the rustc representation of recursive types confused me recently, I'll mention that TyKind::Adt
s do not include the fields' types. Instead, a TyKind::Adt
looks roughly like this pseudocode:
struct S {
x
}
The type of S
includes the DefId
of S.x
, which can then be used to look up the type of the field.