sgodwincs / dlv-list-rs

Apache License 2.0
12 stars 7 forks source link

`const-random` should be listed as optional. #22

Open xieyubo opened 8 months ago

xieyubo commented 8 months ago

Bug description

const-random is not required for default/std feature but it is listed as required dependency always.

sgodwincs commented 8 months ago

Hm I don't think there's a way in Cargo to require the dependency if the std feature is turned off. If it was optional, how do you propose it'll be enabled for no std users? Only option I see is to have another no_std flag that is meant to be mutually exclusive with std.

xieyubo commented 8 months ago

I think so, or add no_std feature and remove std feature?

Some company (e.g. Microsoft...), will scan all packages in the dependency list, const-random has some dependency which contains crypto algorithm. All such packages are not allowed to use except special approval.

zmrow commented 1 day ago

I can open a PR for this.

Having a std feature seems to be in line with what the Cargo docs recommend. In that vein, I think the best we can do to avoid breaking existing users of default feature std is to:

It's not perfect, but I think it achieves the goal of eliminating the const-random dependency while not breaking existing users of default features; though no_std users will need to add the new const-random feature.

@sgodwincs thoughts on that?