From 040cb585e88583cba8a15f30eea07bfd2f135515 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 14 Jul 2022 23:24:57 -0700 Subject: LLVM: fix ABI size of optional and error union types Previously, the Zig ABI size and LLVM ABI size of these types disagreed sometimes. This code also corrects the logging messages to not trigger LLVM assertions. --- src/type.zig | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/type.zig') diff --git a/src/type.zig b/src/type.zig index 0744a50579..59f0668770 100644 --- a/src/type.zig +++ b/src/type.zig @@ -2305,6 +2305,9 @@ pub const Type = extern union { /// true if and only if the type takes up space in memory at runtime. /// There are two reasons a type will return false: /// * the type is a comptime-only type. For example, the type `type` itself. + /// - note, however, that a struct can have mixed fields and only the non-comptime-only + /// fields will count towards the ABI size. For example, `struct {T: type, x: i32}` + /// hasRuntimeBits()=true and abiSize()=4 /// * the type has only one possible value, making its ABI size 0. /// When `ignore_comptime_only` is true, then types that are comptime only /// may return false positives. -- cgit v1.2.3