Commit Graph

14 Commits

Author SHA1 Message Date
ridiculousfish
b8189da011 Use the rust-pcre2 crate for regex
This adds support for our (forked) rust-pcre2 crate.
2023-03-25 17:01:50 -07:00
Mahmoud Al-Qudsi
34a4c7de7f Add BSD feature
This should be used in lieu of manually targeting individual operating systems
when using features shared by all BSD families.

e.g. instead of

   #[cfg(any(target_os = "freebsd", target_os = "dragonflybsd", ...))]
   fn foo() { }

you would use

    #[cfg(feature = "bsd")]
    fn foo() { }

This feature is automatically detected at build-time (see build.rs changes) and
should *not* be enabled manually. Additionally, this feature may not be used to
conditionally require any other dependency, as that isn't supported for
auto-enabled features.
2023-03-19 17:55:22 -05:00
ridiculousfish
57f4571a01 Rewrite wait handles and wait handle store in Rust 2023-03-18 18:53:04 -07:00
Victor Song
77fe9933e2 builtins: Rewrite pwd in Rust
Closes #9625.
2023-03-12 15:18:15 -05:00
ridiculousfish
5197bf75cd Point fish autocxx and similar dependencies at new fish-shell location
These crates have been moved into fish-shell org; update Cargo.toml to
reflect that.
2023-03-09 21:01:49 -08:00
Xiretza
dff7db2f16
Run rustfmt and clippy in CI (#9616)
* Add machine-readable MSRV to Cargo.toml
* Fix clippy warnings
* CI: add rustfmt and clippy checks
2023-02-26 13:20:20 -06:00
Mahmoud Al-Qudsi
e616de544e Enable rust overflow checks in release mode, at least for now
We want to try and catch as much unexpected/non-deterministic behavior as we
can. We could run the CI explicitly in debug mode, but I think it makes sense to
always have overflow checks on in both debug/release modes everywhere, at least
for the duration of the codebase transition.
2023-02-20 13:11:29 -06:00
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