about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2021-07-11 00:40:25 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2021-07-11 00:40:25 +0300
commit4ba91a063d2c22587bca2c89740214ac7f4ab8d9 (patch)
tree999bcf32648358498be9ab31a1bcac69064a2413
parentece6f681861e45abec5f07d9418d06dc267845d6 (diff)
downloadrust-4ba91a063d2c22587bca2c89740214ac7f4ab8d9.tar.gz
rust-4ba91a063d2c22587bca2c89740214ac7f4ab8d9.zip
rustc_span: Reorder some `ExpnData` fields in accordance with comments
A drive-by change.
-rw-r--r--compiler/rustc_span/src/hygiene.rs51
1 files changed, 25 insertions, 26 deletions
diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs
index fe25ba4f9ca..78b181aa330 100644
--- a/compiler/rustc_span/src/hygiene.rs
+++ b/compiler/rustc_span/src/hygiene.rs
@@ -709,31 +709,6 @@ pub struct ExpnData {
     /// call_site span would have its own ExpnData, with the call_site
     /// pointing to the `foo!` invocation.
     pub call_site: Span,
-
-    // --- The part specific to the macro/desugaring definition.
-    // --- It may be reasonable to share this part between expansions with the same definition,
-    // --- but such sharing is known to bring some minor inconveniences without also bringing
-    // --- noticeable perf improvements (PR #62898).
-    /// The span of the macro definition (possibly dummy).
-    /// This span serves only informational purpose and is not used for resolution.
-    pub def_site: Span,
-    /// List of `#[unstable]`/feature-gated features that the macro is allowed to use
-    /// internally without forcing the whole crate to opt-in
-    /// to them.
-    pub allow_internal_unstable: Option<Lrc<[Symbol]>>,
-    /// Whether the macro is allowed to use `unsafe` internally
-    /// even if the user crate has `#![forbid(unsafe_code)]`.
-    pub allow_internal_unsafe: bool,
-    /// Enables the macro helper hack (`ident!(...)` -> `$crate::ident!(...)`)
-    /// for a given macro.
-    pub local_inner_macros: bool,
-    /// Edition of the crate in which the macro is defined.
-    pub edition: Edition,
-    /// The `DefId` of the macro being invoked,
-    /// if this `ExpnData` corresponds to a macro invocation
-    pub macro_def_id: Option<DefId>,
-    /// The normal module (`mod`) in which the expanded macro was defined.
-    pub parent_module: Option<DefId>,
     /// The crate that originally created this `ExpnData`. During
     /// metadata serialization, we only encode `ExpnData`s that were
     /// created locally - when our serialized metadata is decoded,
@@ -748,7 +723,6 @@ pub struct ExpnData {
     // be considered equivalent.
     #[stable_hasher(ignore)]
     orig_id: Option<u32>,
-
     /// Used to force two `ExpnData`s to have different `Fingerprint`s.
     /// Due to macro expansion, it's possible to end up with two `ExpnId`s
     /// that have identical `ExpnData`s. This violates the contract of `HashStable`
@@ -760,6 +734,31 @@ pub struct ExpnData {
     /// `ExpnId`s would end up with the same `Fingerprint`. Since `ExpnData` includes
     /// a `krate` field, this value only needs to be unique within a single crate.
     disambiguator: u32,
+
+    // --- The part specific to the macro/desugaring definition.
+    // --- It may be reasonable to share this part between expansions with the same definition,
+    // --- but such sharing is known to bring some minor inconveniences without also bringing
+    // --- noticeable perf improvements (PR #62898).
+    /// The span of the macro definition (possibly dummy).
+    /// This span serves only informational purpose and is not used for resolution.
+    pub def_site: Span,
+    /// List of `#[unstable]`/feature-gated features that the macro is allowed to use
+    /// internally without forcing the whole crate to opt-in
+    /// to them.
+    pub allow_internal_unstable: Option<Lrc<[Symbol]>>,
+    /// Whether the macro is allowed to use `unsafe` internally
+    /// even if the user crate has `#![forbid(unsafe_code)]`.
+    pub allow_internal_unsafe: bool,
+    /// Enables the macro helper hack (`ident!(...)` -> `$crate::ident!(...)`)
+    /// for a given macro.
+    pub local_inner_macros: bool,
+    /// Edition of the crate in which the macro is defined.
+    pub edition: Edition,
+    /// The `DefId` of the macro being invoked,
+    /// if this `ExpnData` corresponds to a macro invocation
+    pub macro_def_id: Option<DefId>,
+    /// The normal module (`mod`) in which the expanded macro was defined.
+    pub parent_module: Option<DefId>,
 }
 
 // These would require special handling of `orig_id`.