Commit Graph

7 Commits

Author SHA1 Message Date
Fabian Boehm
4fd1458d85 Port random to rust 2023-02-19 21:01:46 +01:00
Mahmoud Al-Qudsi
0b160ebe71 Drop lazy_static from Cargo.toml
This should have been included as part of the previous commit, mea culpa.
2023-02-05 18:20:26 -06:00
Mahmoud Al-Qudsi
d7febd4f3e Use once_cell instead of lazy_static
lazy_static has better ergonomics at the call/access sites (it returns a
reference to the type directly, whereas with once_cell we get a static Lazy<T>
that we must dereference instead) but the once_cell api is slated for
integration into the standard library [0] and has been the "preferred" way to
declare static global variables w/ deferred initialization. It's also less
opaque and easier to comprehend how it works, I guess?

(Both `once_cell` and `lazy_static` are already in our dependency tree, so this
should have no detrimental effect on build times. It actually negligibly
*improves* build times by not using macros, reducing the amount of expansion the
compiler has to do by a miniscule amount.)

[0]: https://github.com/rust-lang/rust/issues/74465
2023-02-05 17:58:33 -06:00
Mahmoud Al-Qudsi
60bd186e21 Fix linking errors under FreeBSD
The nix crate had all its default features enabled, which included features that
are not present under BSD. We should only enable the select subset of crate
features that we know are available cross-platform (or else use conditional
targeting in Cargo.toml to only enable Linux-only features when compiling for
Linux targets).

For now, it seems we can just use the nix crate with all features disabled as it
still builds under Linux and FreeBSD in this state.
2023-02-03 11:36:21 -06:00
Mahmoud Al-Qudsi
c18fb74fa8 Fix rust-invoked build of c/cpp sources under FreeBSD
Due to an upstream issue with cc-rs [0], the rust-generated C++ interface would
fail to compile. A PR has been opened to patch the issue upstream [1], but in
the meantime `Cargo.toml` has been patched to use a fork of cc-rs with the
relevant fixes.

[0]: https://github.com/rust-lang/cc-rs/issues/463
[1]: https://github.com/rust-lang/cc-rs/pull/785
2023-02-03 11:36:21 -06:00
ridiculousfish
681a165721 Add an FFI test facility
This allow testing Rust functions (from fish_tests.cpp) which need to
cross the FFI. See the example in smoke.rs.
2023-02-02 19:34:48 -07:00
ridiculousfish
d843b67d2d Initial Rust commit 2023-02-02 19:34:47 -07:00