skraus-dev / cherryrgb-rs

Cherry RGB Keyboard - Multi platform tool to set RGB LEDs for Cherry keyboards
MIT License
40 stars 3 forks source link

Build on docs.rs fails #46

Closed felfert closed 1 year ago

felfert commented 1 year ago

This was created to track efforts to get the build at docs.rs fixed.

What I have done so far:

Got the error reproduced locally by doing the following:

E.g. cargo "+nightly" "rustdoc" "--lib" "-Zrustdoc-map" "--all-features" "-Z" "unstable-options" "--config" "build.rustdocflags=[\"-Z\", \"unstable-options\", \"--emit=invocation-specific\", \"--resource-suffix\", \"-20230517-1.71.0-nightly-e9e1bbc7a\", \"--static-root-path\", \"/-/rustdoc.static/\", \"--cap-lints\", \"warn\", \"--disable-per-crate-search\", \"--extern-html-root-takes-precedence\"]" "-Zunstable-options" "--config=doc.extern-map.registries.crates-io=\"https://docs.rs/cherryrgb/0.2.6/x86_64-unknown-linux-gnu\"" "-Zrustdoc-scrape-examples" "-j3" "--target" "x86_64-unknown-linux-gnu"

Building in-place with the above comannd using the original Cargo.toml. Did NOT reproduce the error.

felfert commented 1 year ago

As the first error is about the #[binrw] macro, I think it might have to do with that crate. We are using 0.8[.4]. It is currently at 0.11.2 but there are several breaking changes documented and I'm not shure if those apply to us.

felfert commented 1 year ago

Narrowed it down further. I reduced the commant to the following now:

This reproduces the error, but only if the modified Cargo.toml from docs.rs is used. cargo +nightly rustdoc --lib --all-features --target x86_64-unknown-linux-gnu

Without the +nightly, it works even with the modified Cargo.toml

So this is clearly a combination of 2 things:

For now, I'm out of ideas. I suggest you file an issue here

felfert commented 1 year ago

More findings:

The modified Cargo.toml does not have anything to to with the error: I changed the references to the workspace (version and edition) back to self-contained values. Then a build with nightly still works when performed inplace However:

=> It is the existence of the parent toml that magically "fixes" the build.

felfert commented 1 year ago

Did some more tests yesterday:

Comparing the Cargo.lock that gets created when building with nightly in a separate cherryrgb subdir to the Cargo.lock in our topdir reveals the following:

Conclusion: The bug is tied to using binrw > v0.8.0

@skraus-dev I have seen your branch binrw_update which appears to be WIP. Are you actively working on that?

felfert commented 1 year ago

@skraus-dev Please make a new release, so that docs.rs is updated properly.