about summary refs log tree commit diff
path: root/src/librustc
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-29 05:32:45 +0200
committerGitHub <noreply@github.com>2019-08-29 05:32:45 +0200
commitb6df8276f8dca6f3da04b6ddf324a68832ccaa3b (patch)
tree439261547d7f54690888844acbf0f23658084788 /src/librustc
parent4cae33a17631b4852453eec7a89d5c02b152e611 (diff)
parent009cce88ebcbdb5825c86fd7f3ff84216a2d3fec (diff)
downloadrust-b6df8276f8dca6f3da04b6ddf324a68832ccaa3b.tar.gz
rust-b6df8276f8dca6f3da04b6ddf324a68832ccaa3b.zip
Rollup merge of #63933 - wesleywiser:cleanup_from_move_promoted, r=oli-obk
Resolve some small issues related to #63580

This resolves some feedback left on #63580 after it was merged:

- Adds documentation to `mir::Static` and `mir::StaticKind`
- Simplifies `maybe_get_optimized_mir()` and `maybe_get_promoted_mir()`

cc @bjorn3 @RalfJung
Diffstat (limited to 'src/librustc')
-rw-r--r--src/librustc/mir/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index 858b77af804..5ac99ba1470 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,
 }