about summary refs log tree commit diff
path: root/compiler/rustc_target/src
diff options
context:
space:
mode:
authorErik Desjardins <erikdesjardins@users.noreply.github.com>2023-06-11 13:43:49 -0400
committerErik Desjardins <erikdesjardins@users.noreply.github.com>2023-07-10 19:19:39 -0400
commit00b3eca0dfab4ccebbfb6614b83235cc82f9245f (patch)
treea985425ec577fd3beaf124db9af85f18de99f299 /compiler/rustc_target/src
parent65d11b5c6562c57d61bf0db88736da06b8b77423 (diff)
downloadrust-00b3eca0dfab4ccebbfb6614b83235cc82f9245f.tar.gz
rust-00b3eca0dfab4ccebbfb6614b83235cc82f9245f.zip
move has_repr to layout, handle repr(transparent) properly
Diffstat (limited to 'compiler/rustc_target/src')
-rw-r--r--compiler/rustc_target/src/abi/call/x86.rs9
-rw-r--r--compiler/rustc_target/src/abi/mod.rs8
2 files changed, 2 insertions, 15 deletions
diff --git a/compiler/rustc_target/src/abi/call/x86.rs b/compiler/rustc_target/src/abi/call/x86.rs
index dd52b3cb520..9d3f9413afd 100644
--- a/compiler/rustc_target/src/abi/call/x86.rs
+++ b/compiler/rustc_target/src/abi/call/x86.rs
@@ -63,8 +63,8 @@ where
 
         if t.is_like_msvc
             && arg.layout.is_adt()
-            && let Some(requested_align) = arg.layout.repr_options().align
-            && requested_align > align_4
+            && arg.layout.has_repr_align
+            && arg.layout.align.abi > align_4
         {
             // MSVC has special rules for overaligned arguments: https://reviews.llvm.org/D72114.
             // Summarized here:
@@ -72,11 +72,6 @@ where
             // - For backwards compatibility, arguments with natural alignment > 4 are still passed
             //   on stack (via `byval`). For example, this includes `double`, `int64_t`,
             //   and structs containing them, provided they lack an explicit alignment attribute.
-            assert!(arg.layout.align.abi >= requested_align,
-                "abi alignment {:?} less than requested alignment {:?}",
-                arg.layout.align.abi,
-                requested_align
-            );
             arg.make_indirect();
         } else if arg.layout.is_aggregate() {
             // We need to compute the alignment of the `byval` argument. The rules can be found in
diff --git a/compiler/rustc_target/src/abi/mod.rs b/compiler/rustc_target/src/abi/mod.rs
index aecf8b339f0..589cd3cf96b 100644
--- a/compiler/rustc_target/src/abi/mod.rs
+++ b/compiler/rustc_target/src/abi/mod.rs
@@ -55,7 +55,6 @@ pub trait TyAbiInterface<'a, C>: Sized {
     fn is_never(this: TyAndLayout<'a, Self>) -> bool;
     fn is_tuple(this: TyAndLayout<'a, Self>) -> bool;
     fn is_unit(this: TyAndLayout<'a, Self>) -> bool;
-    fn repr_options(this: TyAndLayout<'a, Self>) -> ReprOptions;
 }
 
 impl<'a, Ty> TyAndLayout<'a, Ty> {
@@ -126,13 +125,6 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
         Ty::is_unit(self)
     }
 
-    pub fn repr_options<C>(self) -> ReprOptions
-    where
-        Ty: TyAbiInterface<'a, C>,
-    {
-        Ty::repr_options(self)
-    }
-
     pub fn offset_of_subfield<C>(self, cx: &C, indices: impl Iterator<Item = usize>) -> Size
     where
         Ty: TyAbiInterface<'a, C>,