Skip to content

Commit 4ba91a0

Browse files
committed
rustc_span: Reorder some ExpnData fields in accordance with comments
A drive-by change.
1 parent ece6f68 commit 4ba91a0

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

compiler/rustc_span/src/hygiene.rs

+25-26
Original file line numberDiff line numberDiff line change
@@ -709,31 +709,6 @@ pub struct ExpnData {
709709
/// call_site span would have its own ExpnData, with the call_site
710710
/// pointing to the `foo!` invocation.
711711
pub call_site: Span,
712-
713-
// --- The part specific to the macro/desugaring definition.
714-
// --- It may be reasonable to share this part between expansions with the same definition,
715-
// --- but such sharing is known to bring some minor inconveniences without also bringing
716-
// --- noticeable perf improvements (PR #62898).
717-
/// The span of the macro definition (possibly dummy).
718-
/// This span serves only informational purpose and is not used for resolution.
719-
pub def_site: Span,
720-
/// List of `#[unstable]`/feature-gated features that the macro is allowed to use
721-
/// internally without forcing the whole crate to opt-in
722-
/// to them.
723-
pub allow_internal_unstable: Option<Lrc<[Symbol]>>,
724-
/// Whether the macro is allowed to use `unsafe` internally
725-
/// even if the user crate has `#![forbid(unsafe_code)]`.
726-
pub allow_internal_unsafe: bool,
727-
/// Enables the macro helper hack (`ident!(...)` -> `$crate::ident!(...)`)
728-
/// for a given macro.
729-
pub local_inner_macros: bool,
730-
/// Edition of the crate in which the macro is defined.
731-
pub edition: Edition,
732-
/// The `DefId` of the macro being invoked,
733-
/// if this `ExpnData` corresponds to a macro invocation
734-
pub macro_def_id: Option<DefId>,
735-
/// The normal module (`mod`) in which the expanded macro was defined.
736-
pub parent_module: Option<DefId>,
737712
/// The crate that originally created this `ExpnData`. During
738713
/// metadata serialization, we only encode `ExpnData`s that were
739714
/// created locally - when our serialized metadata is decoded,
@@ -748,7 +723,6 @@ pub struct ExpnData {
748723
// be considered equivalent.
749724
#[stable_hasher(ignore)]
750725
orig_id: Option<u32>,
751-
752726
/// Used to force two `ExpnData`s to have different `Fingerprint`s.
753727
/// Due to macro expansion, it's possible to end up with two `ExpnId`s
754728
/// that have identical `ExpnData`s. This violates the contract of `HashStable`
@@ -760,6 +734,31 @@ pub struct ExpnData {
760734
/// `ExpnId`s would end up with the same `Fingerprint`. Since `ExpnData` includes
761735
/// a `krate` field, this value only needs to be unique within a single crate.
762736
disambiguator: u32,
737+
738+
// --- The part specific to the macro/desugaring definition.
739+
// --- It may be reasonable to share this part between expansions with the same definition,
740+
// --- but such sharing is known to bring some minor inconveniences without also bringing
741+
// --- noticeable perf improvements (PR #62898).
742+
/// The span of the macro definition (possibly dummy).
743+
/// This span serves only informational purpose and is not used for resolution.
744+
pub def_site: Span,
745+
/// List of `#[unstable]`/feature-gated features that the macro is allowed to use
746+
/// internally without forcing the whole crate to opt-in
747+
/// to them.
748+
pub allow_internal_unstable: Option<Lrc<[Symbol]>>,
749+
/// Whether the macro is allowed to use `unsafe` internally
750+
/// even if the user crate has `#![forbid(unsafe_code)]`.
751+
pub allow_internal_unsafe: bool,
752+
/// Enables the macro helper hack (`ident!(...)` -> `$crate::ident!(...)`)
753+
/// for a given macro.
754+
pub local_inner_macros: bool,
755+
/// Edition of the crate in which the macro is defined.
756+
pub edition: Edition,
757+
/// The `DefId` of the macro being invoked,
758+
/// if this `ExpnData` corresponds to a macro invocation
759+
pub macro_def_id: Option<DefId>,
760+
/// The normal module (`mod`) in which the expanded macro was defined.
761+
pub parent_module: Option<DefId>,
763762
}
764763

765764
// These would require special handling of `orig_id`.

0 commit comments

Comments
 (0)