diff options
| author | FractalFir <fractalfirdev@gmail.com> | 2025-07-27 20:55:45 +0200 |
|---|---|---|
| committer | FractalFir <fractalfirdev@gmail.com> | 2025-07-27 20:55:45 +0200 |
| commit | 72927f6eb74550e24f0fdeecd5f21201fd970d12 (patch) | |
| tree | 49cf62f34c32e5e50fb11b06497429d94eefb0cb | |
| parent | edc3841c5d28e0f54c6d3c7e906ad083129f3903 (diff) | |
| download | rust-72927f6eb74550e24f0fdeecd5f21201fd970d12.tar.gz rust-72927f6eb74550e24f0fdeecd5f21201fd970d12.zip | |
Ensure correct aligement of rustc_hir::Lifetime on platforms with lower default alignments.
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index e83f6a1df72..36bada15db1 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -148,6 +148,11 @@ impl From<Ident> for LifetimeSyntax { /// `LifetimeSource::OutlivesBound` or `LifetimeSource::PreciseCapturing` /// — there's no way to "elide" these lifetimes. #[derive(Debug, Copy, Clone, HashStable_Generic)] +// Raise the aligement to at least 4 bytes - this is relied on in other parts of the compiler(for pointer tagging): +// https://github.com/rust-lang/rust/blob/ce5fdd7d42aba9a2925692e11af2bd39cf37798a/compiler/rustc_data_structures/src/tagged_ptr.rs#L163 +// Removing this `repr(4)` will cause the compiler to not build on platforms like `m68k` Linux, where the aligement of u32 and usize is only 2. +// Since `repr(align)` may only raise aligement, this has no effect on platforms where the aligement is already sufficient. +#[repr(align(4))] pub struct Lifetime { #[stable_hasher(ignore)] pub hir_id: HirId, |
