tkaitchuck/constrandom

once_cell requires default-features = false for no-std

Closed this issue · 3 comments

The dependency on once_cell is pulling in std... which makes build fail on no-std.

Probably needs default-features = false.

Since this is a macro dependency, wouldn't it not actually need once_cell in the final binary? Or is this just a rustc/cargo bug?

@schungx I have removed the unneeded features. But I believe @notgull is correct, const_random_macro is a macro and hence should not impact runtime. I believe cargo should handle this correctly.

I confirm that version 0.1.15 works fine for no-std.

Version 0.1.13 also worked fine, and once_cell was introduced in 0.1.14 so it looks particularly suspicious.

I originally thought that macros was separate from the main compile, but it looks like cargo will still merge features from macros into the final features set for the build. The code might not get compiled into the main binary, but the features used in the macro crate will get added to the dependencies of main. IMHO it is probably not a bug but is at least not ideal...