diff options
| author | Ralf Jung <post@ralfj.de> | 2025-04-02 08:31:42 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-04-07 23:30:55 +0200 |
| commit | 2678d04dd97444cf444c31be92bfd281f9986a47 (patch) | |
| tree | f11b92295a76bf8fd52819987ef033023a4a2ecf /compiler/rustc_ty_utils/src | |
| parent | e643f59f6da3a84f43e75dea99afaa5b041ea6bf (diff) | |
| download | rust-2678d04dd97444cf444c31be92bfd281f9986a47.tar.gz rust-2678d04dd97444cf444c31be92bfd281f9986a47.zip | |
mitigate MSVC unsoundness by not emitting alignment attributes on win32-msvc targets
also mention the MSVC alignment issue in platform-support.md
Diffstat (limited to 'compiler/rustc_ty_utils/src')
| -rw-r--r-- | compiler/rustc_ty_utils/src/abi.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs index 3d4ab33240a..63ea035bd0e 100644 --- a/compiler/rustc_ty_utils/src/abi.rs +++ b/compiler/rustc_ty_utils/src/abi.rs @@ -347,7 +347,8 @@ fn adjust_for_rust_scalar<'tcx>( None }; if let Some(kind) = kind { - attrs.pointee_align = Some(pointee.align); + attrs.pointee_align = + Some(pointee.align.min(cx.tcx().sess.target.max_reliable_alignment())); // `Box` are not necessarily dereferenceable for the entire duration of the function as // they can be deallocated at any time. Same for non-frozen shared references (see |
