Results 32 comments of Js2xxx

Well, actually it doen't work either if marking the crate with `#![no_std]` and setting `default-features = false` of those dependent crates, which disables the `std` dependency.

Alright, I'll search for more info about build-std. Maybe there's something.

Oh, I should have checked those issues. I wonder what the purpose of the sorting behavior is in the first place. It seems unable to make the following process more...

有一些平台无关的模块需要编写单元测试,但是RISC-V还不支持标准库,所以在编译平台上运行是一个比较好的选择。 如果所有测试都直接写在实际运行代码里,就需要额外的编译选项。

只是从易用性上考虑。如果不加编译支持的话,所有添加了这个项目的crate就都运行不了单元测试了;或者说要把测试代码单独分到其他地方。这样增加复杂性从该项目的使用者的角度来说感觉不太方便。

也不是说所有crate都能跨平台编译吧,至少我在`crates.io`上嵌入式板块里看到的主流crate都支持在编译平台上编译,可能为的也是通用性吧。比如: - [`critical_section`](https://docs.rs/critical-section/1.1.1/critical_section/#usage-in-std-tests-for-no-std-libraries) - [`riscv`](https://docs.rs/riscv/0.10.1/src/riscv/register/macros.rs.html#6-15) > ```toml > [target.'cfg(any(target_arch = "riscv32", target_arch = "riscv64"))'.dependencies] > ``` 我也在考虑如此操作,不过最终还是避免不了在代码里设置大量的`cfg`。

好的,我暂时先采用第三种方案了,之后如果有新的想法会继续在这里发布。感谢review。