Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

parity-scale-codec/derive enables serder/std even when std is not enabled #204

Closed
recmo opened this issue Apr 7, 2020 · 6 comments
Closed

Comments

@recmo
Copy link

recmo commented Apr 7, 2020

Simplified example:

serde = { version = "1.0", default_features = false }
parity-scale-codec = { version = '1.3.0', default-features = false, features = ['derive'] }

[features]
default = ["std"]
std = [
    "serde/std",
    "parity-scale-codec/std",
]

Fails to build correctly without the std feature.

This is because parity-scale-codec will force the serde/std feature to be set, even when parity-scale-codec/std is unset.

@recmo
Copy link
Author

recmo commented Apr 7, 2020

The dependency path is:

  • parity-scale-codec features = ['derive'] (no default features)
  • parity-scale-codec-derive (with default features)
  • proc-macro-crate (with default features)
  • toml (with default features)
  • serde (with default features, including std)

This is ultimately caused by rust-lang/cargo#7915

@recmo
Copy link
Author

recmo commented Apr 8, 2020

This nightly-only cargo feature solves it for me:

https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#features

Building using it works:

cargo check -Zfeatures=all --lib --bins --no-default-features --target=thumbv7m-none-eabi

@gui1117
Copy link
Contributor

gui1117 commented Jan 7, 2021

I'm not sure if there is a good way to solve this ? but as we will release 2.0 in some time do you see any fix ?

@bkchr
Copy link
Member

bkchr commented Jan 7, 2021

This will be solved by: rust-lang/cargo#8997

So with the stable compiler in some weeks.

@Xanewok
Copy link
Contributor

Xanewok commented Jun 24, 2021

Can this be closed now?

@bkchr
Copy link
Member

bkchr commented Jun 24, 2021

Probably

@bkchr bkchr closed this as completed Jun 24, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants