diff options
| author | Michael Goulet <michael@errs.io> | 2022-12-06 03:30:58 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-12-13 17:48:55 +0000 |
| commit | 0f9e41409290411ab656fe99b84474c786073691 (patch) | |
| tree | d6574ed9950db8dca145bb37eb878358806ebcf7 | |
| parent | 4b19a2c119a7764ec81a122c4d6257715462e956 (diff) | |
| download | rust-0f9e41409290411ab656fe99b84474c786073691.tar.gz rust-0f9e41409290411ab656fe99b84474c786073691.zip | |
nit: docs
| -rw-r--r-- | compiler/rustc_middle/src/ty/sty.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 2f1e32900e5..27de48c1f83 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -1148,14 +1148,23 @@ impl<'tcx, T: IntoIterator> Binder<'tcx, T> { #[derive(HashStable, TypeFoldable, TypeVisitable, Lift)] pub struct AliasTy<'tcx> { /// The parameters of the associated or opaque item. + /// + /// For a projection, these are the substitutions for the trait and the + /// GAT substitutions, if there are any. + /// + /// For RPIT the substitutions are for the generics of the function, + /// while for TAIT it is used for the generic parameters of the alias. pub substs: SubstsRef<'tcx>, /// The `DefId` of the `TraitItem` for the associated type `N` if this is a projection, /// or the `OpaqueType` item if this is an opaque. /// - /// Note that this is not the `DefId` of the `TraitRef` containing this - /// associated type, which is in `tcx.associated_item(item_def_id).container`, - /// aka. `tcx.parent(item_def_id).unwrap()`. + /// During codegen, `tcx.type_of(def_id)` can be used to get the type of the + /// underlying type if the type is an opaque. + /// + /// Note that if this is an associated type, this is not the `DefId` of the + /// `TraitRef` containing this associated type, which is in `tcx.associated_item(def_id).container`, + /// aka. `tcx.parent(def_id)`. pub def_id: DefId, } |
