about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMizobrook-kan <akaricesti@gmail.com>2022-02-18 12:37:48 +0800
committerMizobrook-kan <akaricesti@gmail.com>2022-02-18 12:37:48 +0800
commit56aba3c6259b54551ecc9560717f2024bf605caf (patch)
tree9228cc6e39e2aa6c2feee725a2dfefc79df8d9bd
parent0c3f0cddde337ef596b45a8ac53aae4c8845237b (diff)
downloadrust-56aba3c6259b54551ecc9560717f2024bf605caf.tar.gz
rust-56aba3c6259b54551ecc9560717f2024bf605caf.zip
document rustc_middle::mir::Field
-rw-r--r--compiler/rustc_middle/src/mir/mod.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs
index 0688d7d2569..45bed85aac3 100644
--- a/compiler/rustc_middle/src/mir/mod.rs
+++ b/compiler/rustc_middle/src/mir/mod.rs
@@ -1841,6 +1841,15 @@ static_assert_size!(PlaceElem<'_>, 24);
 pub type ProjectionKind = ProjectionElem<(), ()>;
 
 rustc_index::newtype_index! {
+    /// A [newtype'd][wrapper] index type in the MIR [control-flow graph][CFG]
+    ///
+    /// A field (e.g., `f` in `_1.f`) is one variant of [`ProjectionElem`]. Conceptually,
+    /// rustc can identify that a field projection refers to two different regions of memory
+    /// or the same one between the base and the projection element.
+    /// Read more about projections in the [rustc-dev-guide][mir-datatypes]
+    /// [wrapper]: https://rustc-dev-guide.rust-lang.org/appendix/glossary.html#newtype
+    /// [CFG]: https://rustc-dev-guide.rust-lang.org/appendix/background.html#cfg
+    /// [mir-datatypes]: https://rustc-dev-guide.rust-lang.org/mir/index.html#mir-data-types
     pub struct Field {
         derive [HashStable]
         DEBUG_FORMAT = "field[{}]"