Skip to content

Commit ea8a7bb

Browse files
fix(test): Conditionalize a zip64 doctest (#308)
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. Co-authored-by: Chris Hennick <[email protected]>
1 parent 365c81a commit ea8a7bb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/spec.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ impl ExtraFieldMagic {
9999
///
100100
///```
101101
/// # fn main() -> Result<(), zip::result::ZipError> {
102+
/// # #[cfg(target_pointer_width = "64")]
103+
/// # {
102104
/// use std::io::{self, Cursor, prelude::*};
103105
/// use std::error::Error;
104106
/// use zip::{ZipWriter, write::SimpleFileOptions};
@@ -129,6 +131,7 @@ impl ExtraFieldMagic {
129131
/// zip.start_file("zero.dat", options)?;
130132
/// // This succeeds because we specified that it could be a large file.
131133
/// assert!(zip.write_all(&big_buf[..]).is_ok());
134+
/// # }
132135
/// # Ok(())
133136
/// # }
134137
///```

0 commit comments

Comments
 (0)