Open sorairolake opened 2 weeks ago
The error looks correct to me. Your crate contains this cfg(doc)
:
#[cfg(all(not(doc), feature = "std"))]
use std::io::{Error, Write};
#[cfg(any(doc, not(feature = "std")))]
pub use io::{Error, ErrorKind, Write};
So when you run cargo doc
, DeflateEncoder
actually implements your own copy of the Write
trait, rather than the one from the standard library, but std::io::BufWriter
requires the one from the standard library.
Prior to 1.75.0, this code was incorrectly accepted by rustdoc due to a bug, which got fixed in https://github.com/rust-lang/rust/pull/117450.
@rustbot label T-rustdoc
When I tried to build the documentation for
zip
crate v1.3.0 (cargo doc
), it failed with unexpected errors (see zopfli-rs/zopfli#42). There seems to be no problem up to Rust 1.74.0, but the error occurs with Rust 1.75.0 or later.Code
I tried this code:
https://github.com/zopfli-rs/zopfli/blob/5cea5a62d791e16440e8556feb663cffd3e888cf/src/deflate.rs#L23-L156 https://github.com/zopfli-rs/zopfli/blob/5cea5a62d791e16440e8556feb663cffd3e888cf/src/gzip.rs#L3-L97 https://github.com/zopfli-rs/zopfli/blob/5cea5a62d791e16440e8556feb663cffd3e888cf/src/zlib.rs#L3-L90
I expected to see this happen: Successfully build the documentation.
Instead, this happened:
The trait
std::io::Write
seems to be implemented fordeflate::DeflateEncoder<W>
, so I think it satisfies the trait bound.Version it worked on
It most recently worked on: Rust 1.74.0
Version with regression
rustc --version --verbose
: