diff options
| author | Wesley Wiser <wwiser@gmail.com> | 2019-08-26 21:07:58 -0400 |
|---|---|---|
| committer | Wesley Wiser <wwiser@gmail.com> | 2019-08-28 07:00:26 -0400 |
| commit | cca64e73399c02b2f964e3b34f969e826d061eed (patch) | |
| tree | 396bdbf8d9e269bd375f5ad6dc337a937e0715d1 | |
| parent | d6bf776bc69c766aa70c39f28f6c70ab7faf32b7 (diff) | |
| download | rust-cca64e73399c02b2f964e3b34f969e826d061eed.tar.gz rust-cca64e73399c02b2f964e3b34f969e826d061eed.zip | |
Add some comments to `mir::Static` and `mir::StaticKind`
| -rw-r--r-- | src/librustc/mir/mod.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 60efeaab976..a5ef3792c6b 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -1733,6 +1733,10 @@ pub enum PlaceBase<'tcx> { pub struct Static<'tcx> { pub ty: Ty<'tcx>, pub kind: StaticKind<'tcx>, + /// The `DefId` of the item this static was declared in. For promoted values, usually, this is + /// the same as the `DefId` of the `mir::Body` containing the `Place` this promoted appears in. + /// However, after inlining, that might no longer be the case as inlined `Place`s are copied + /// into the calling frame. pub def_id: DefId, } @@ -1740,6 +1744,9 @@ pub struct Static<'tcx> { Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable, RustcEncodable, RustcDecodable, )] pub enum StaticKind<'tcx> { + /// Promoted references consist of an id (`Promoted`) and the substs necessary to monomorphize + /// it. Usually, these substs are just the identity substs for the item. However, the inliner + /// will adjust these substs when it inlines a function based on the substs at the callsite. Promoted(Promoted, SubstsRef<'tcx>), Static, } |
