alloy-rs / core

High-performance, well-tested & documented core libraries for Ethereum, in Rust
https://alloy.rs
Apache License 2.0
763 stars 137 forks source link

[Bug] Documentation for `Address::random()` doesn't indicate `getrandom` feature is required #714

Closed jmininger closed 1 week ago

jmininger commented 3 weeks ago

Component

primitives

What version of Alloy are you on?

0.2.1

Operating System

Linux

Describe the bug

I had alloy-0.2.1 with features=["full"] in my Cargo.toml but was unable to use Address::random(). Upon closer inspection it looks like this method is generated via macro, and that it requires the getrandom feature. This is not documented in the docs.rs, and this lack of documentation unfortunately resulted in it taking slightly longer than I would have liked to get my code running

DaniPopes commented 3 weeks ago

We could add #[cfg_attr(docsrs, doc(cfg(feature = ""))] for docs, but because it's defined using a macro we should not cfg the functions directly because it might be called from another crate with possibly different features