Document how recursion is handled for ty::Ty

Based on this forum discussion:
https://internals.rust-lang.org/t/recursive-type-representation-in-rustc/15235/4
This commit is contained in:
Noah Lev
2021-11-03 11:12:39 -07:00
parent 473eaa42e9
commit 9931782a38
2 changed files with 25 additions and 1 deletions

View File

@@ -1700,7 +1700,7 @@ impl ReprOptions {
impl<'tcx> FieldDef {
/// Returns the type of this field. The resulting type is not normalized. The `subst` is
/// typically obtained via the second field of `TyKind::AdtDef`.
/// typically obtained via the second field of [`TyKind::Adt`].
pub fn ty(&self, tcx: TyCtxt<'tcx>, subst: SubstsRef<'tcx>) -> Ty<'tcx> {
tcx.type_of(self.did).subst(tcx, subst)
}