From 56aba3c6259b54551ecc9560717f2024bf605caf Mon Sep 17 00:00:00 2001 From: Mizobrook-kan Date: Fri, 18 Feb 2022 12:37:48 +0800 Subject: [PATCH 1/2] document rustc_middle::mir::Field --- compiler/rustc_middle/src/mir/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 0688d7d2569f5..45bed85aac33c 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[{}]" From 621020892e1b03c467dbe4d29d9b89e4c8751a01 Mon Sep 17 00:00:00 2001 From: Mizobrook-kan Date: Fri, 18 Feb 2022 15:38:03 +0800 Subject: [PATCH 2/2] fix some typos --- compiler/rustc_middle/src/mir/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 45bed85aac33c..b1552ef96477a 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -1844,8 +1844,8 @@ 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. + /// rustc can identify that a field projection refers to either 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