Conversation
a95bc0a to
f3e8bca
Compare
- Move io stdlib module behind the `std` feature - Move math.random behind a `rng` feature - Move floating point subset of math module behind the `std` feature
|
Fantastic! I did pretty much the same work before I found this PR. The main difference is that I want to bring it incrementally, with #136 being the first PR. I'm stuck at upgrading gc-arena, see kyren/gc-arena#133. If I see that @kyren is not currently accepting PRs, I plan to fork both projects and rollback the breaking changes from gc-arena. And hopefully then it all will be working. |
|
@orsinium I recommend checking other PRs in the repository too - there are many good improvements but hang here forever without even being reviewed. P.S. If you plan a maintained fork, please let us know, it sounds interesting. |
|
I'm not sure about actively maintaining, since I'm not a Lua developer. But I want to have something working for no_std to run Lua apps in Firefly Zero, the wasm-powered game console that we're making. I'm not aware of any other Lua implementations that would work for wasm-unknown target: the mainstream Lua interpreter can only work with emscripten polyfill. And having Lua support is essential for porting PICO-8 games. |
This PR adds partial support for using piccolo from
#![no_std]platforms.This relies on a tiny patch to
gc-arenato make theallocator-api2feature work under#![no_std]; my patch for this is here: kyren/gc-arena@4d52634However,
piccolocurrently uses an old version ofgc-arena, so I'm not sure whether it would be better to update to the latest version before fixing that and merging this.I'd recommend reading through the diffs for each commit rather than the whole PR, because the import changes touch basically every file and make the diffs unreadable.
The major changes in this PR:
impl io::Readsrc/io.rs,src/stdlib/io.rs) under a newstdfeature, enabled by defaultmath.random, insrc/stdlib/math.rs) under a newrngfeature, enabled by defaultmathbehind thestdfeature, as Rust'scorelibrary doesn't provide them. We could work around this by adding an explicit dependency on alibmequivalent.std::process::abort()with a double panic inutil/src/freeze.rs-- please check to make sure I did that right! A double panic should always abort, but I don't know if it has the same guarantees asstd::process::abort().Here are the current limitations:
rngfeature, HashMap randomization will be mostly disabled, which can allow for denial of service attacksrngfeature should work on#![no_std], but will require the user to set upgetrandom's randomness source: https://docs.rs/getrandom/latest/getrandom/#custom-backendmathare missing inno_stdno_std