]> git.lizzy.rs Git - rust.git/commitdiff
Add size assertions for `FnAbi` and `ArgAbi`.
authorNicholas Nethercote <n.nethercote@gmail.com>
Thu, 25 Aug 2022 07:55:21 +0000 (17:55 +1000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Thu, 25 Aug 2022 23:30:30 +0000 (09:30 +1000)
compiler/rustc_target/src/abi/call/mod.rs

index 639ce64a9f557c3b404383ea1b78751bb735b8cd..ab53ea6101dbfda8bd6b4b840c5d97400e58fa42 100644 (file)
@@ -730,3 +730,13 @@ pub fn adjust_for_foreign_abi<C>(
         Ok(())
     }
 }
+
+// Some types are used a lot. Make sure they don't unintentionally get bigger.
+#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
+mod size_asserts {
+    use super::*;
+    use rustc_data_structures::static_assert_size;
+    // These are in alphabetical order, which is easy to maintain.
+    static_assert_size!(ArgAbi<'_, usize>, 208);
+    static_assert_size!(FnAbi<'_, usize>, 248);
+}