SoftbearStudios / bitcode

A binary encoder/decoder for Rust
https://crates.io/crates/bitcode/
MIT License
369 stars 19 forks source link

running 'cargo doc' on rust stable produces error #18

Closed stepkun closed 8 months ago

stepkun commented 8 months ago

error[E0554]: #![feature] may not be used on the stable release channel --> /home/stephan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitcode-0.5.1/src/lib.rs:2:18 | 2 | #![cfg_attr(doc, feature(doc_cfg))] | ^^^^^^^^^^^^^^^^

caibear commented 8 months ago

This is expected since we used #![feature(dog_cfg)] to show that functions like bitcode::serialize require serde.

If you want to run the docs or tests yourself you'll have to use nightly. To do so, you can run this inside the bitcode project:

rustup override set nightly
aecsocket commented 8 months ago

This breaks cargo doc for all users of this dependency who use stable Rust, which is counterproductive. Users shouldn't be punished for using stable, and running cargo doc locally is a perfectly valid use case. Consider changing this to something like

#![cfg_attr(any(nightly, docsrs), feature(doc_cfg, doc_auto_cfg))]

I use this in my own stable crate, and it lets me run cargo doc just fine while still enabling doc_cfg on docs.rs.

caibear commented 8 months ago

This has been fixed on the latest alpha version bitcode = "=0.6.0-alpha.2".