rust-zip/308.patch
2025-03-13 20:27:12 -04:00

33 lines
1.1 KiB
Diff

From ab5e5547302240ca3d5f9ef068ac003262e9ae67 Mon Sep 17 00:00:00 2001
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
Date: Thu, 13 Mar 2025 20:12:56 -0400
Subject: [PATCH] fix(test): Conditionalize a zip64 doctest
The doctest associated with `ZIP64_BYTES_THR` fails on 32-bit
architectures because `usize` is smaller than `u64`, so the expression
`(zip::ZIP64_BYTES_THR as usize) + 1` would overflow.
---
src/spec.rs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/spec.rs b/src/spec.rs
index 3d5318872..f3c3f73dc 100644
--- a/src/spec.rs
+++ b/src/spec.rs
@@ -99,6 +99,8 @@ impl ExtraFieldMagic {
///
///```
/// # fn main() -> Result<(), zip::result::ZipError> {
+/// # #[cfg(target_pointer_width = "64")]
+/// # {
/// use std::io::{self, Cursor, prelude::*};
/// use std::error::Error;
/// use zip::{ZipWriter, write::SimpleFileOptions};
@@ -129,6 +131,7 @@ impl ExtraFieldMagic {
/// zip.start_file("zero.dat", options)?;
/// // This succeeds because we specified that it could be a large file.
/// assert!(zip.write_all(&big_buf[..]).is_ok());
+/// # }
/// # Ok(())
/// # }
///```