From 4efe2681f75bc8fb3910f1bf183f4bfc70d7aca8 Mon Sep 17 00:00:00 2001 From: Ayush Singh Date: Tue, 16 Dec 2025 22:27:42 +0530 Subject: [PATCH] std: io: error: Add comment for UEFI unpacked repr use The following commit adds the comment explaining the rational why UEFI uses unpacked representation on 64-bit platforms as opposed to bit-packed representation used in all other 64-bit platforms. Signed-off-by: Ayush Singh --- library/std/src/io/error.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/std/src/io/error.rs b/library/std/src/io/error.rs index 98b266663ad2f..528eb185df088 100644 --- a/library/std/src/io/error.rs +++ b/library/std/src/io/error.rs @@ -1,6 +1,13 @@ #[cfg(test)] mod tests; +// On 64-bit platforms, `io::Error` may use a bit-packed representation to +// reduce size. However, this representation assumes that error codes are +// always 32-bit wide. +// +// This assumption is invalid on 64-bit UEFI, where error codes are 64-bit. +// Therefore, the packed representation is explicitly disabled for UEFI +// targets, and the unpacked representation must be used instead. #[cfg(all(target_pointer_width = "64", not(target_os = "uefi")))] mod repr_bitpacked; #[cfg(all(target_pointer_width = "64", not(target_os = "uefi")))]