Skip to content

Commit 0f9e414

Browse files
nit: docs
1 parent 4b19a2c commit 0f9e414

File tree

1 file changed

+12
-3
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+12
-3
lines changed

compiler/rustc_middle/src/ty/sty.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,14 +1148,23 @@ impl<'tcx, T: IntoIterator> Binder<'tcx, T> {
11481148
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
11491149
pub struct AliasTy<'tcx> {
11501150
/// The parameters of the associated or opaque item.
1151+
///
1152+
/// For a projection, these are the substitutions for the trait and the
1153+
/// GAT substitutions, if there are any.
1154+
///
1155+
/// For RPIT the substitutions are for the generics of the function,
1156+
/// while for TAIT it is used for the generic parameters of the alias.
11511157
pub substs: SubstsRef<'tcx>,
11521158

11531159
/// The `DefId` of the `TraitItem` for the associated type `N` if this is a projection,
11541160
/// or the `OpaqueType` item if this is an opaque.
11551161
///
1156-
/// Note that this is not the `DefId` of the `TraitRef` containing this
1157-
/// associated type, which is in `tcx.associated_item(item_def_id).container`,
1158-
/// aka. `tcx.parent(item_def_id).unwrap()`.
1162+
/// During codegen, `tcx.type_of(def_id)` can be used to get the type of the
1163+
/// underlying type if the type is an opaque.
1164+
///
1165+
/// Note that if this is an associated type, this is not the `DefId` of the
1166+
/// `TraitRef` containing this associated type, which is in `tcx.associated_item(def_id).container`,
1167+
/// aka. `tcx.parent(def_id)`.
11591168
pub def_id: DefId,
11601169
}
11611170

0 commit comments

Comments
 (0)