Commit graph

18360 commits

Author SHA1 Message Date
Fabian Boehm
40feed56cf fmt
I wish this was shorter, but oh well
2024-01-10 20:59:50 +01:00
Fabian Boehm
2e14c32c5e fish_indent: Another crash
NUL at the end, which is now ignored.

Not *great*, but better than crashing.
2024-01-10 20:56:13 +01:00
Fabian Boehm
50acc4f4de fish_indent: Fix crash with NUL in the source
Really we should *reject* this
2024-01-10 20:47:39 +01:00
Fabian Boehm
52a3e1393f Add tests 2024-01-10 19:36:06 +01:00
Fabian Boehm
445406d251 fish_indent: Don't panic for gap text
It should be fine to just write the space out here.

This one triggered by `echo b\|\{ | ./fish_indent`
2024-01-10 19:33:47 +01:00
Fabian Boehm
ed251578d1 fish_indent: Fix crash if errors aren't sorted
I've found this for `echo \x1e\<\) | ./fish_indent`

Which is *extremely* broken script, to be fair
2024-01-10 19:33:00 +01:00
Fabian Boehm
76ddfca420 ast: Actually format debug messages
Also fixes two format strings
2024-01-10 19:20:07 +01:00
Fabian Boehm
b5ccacf5b5 fish_indent: Fix crash with redirection at the end of the source 2024-01-10 18:54:25 +01:00
Fabian Boehm
cb51b236f3 cmake: Include GNUInstallDirs earlier for BINDIR etc to take effect
GNUInstallDirs is what defines CMAKE_INSTALL_FULL_BINDIR and such, so
the setting in Rust.cmake didn't work.

This also makes build.rs error out if any of these aren't defined
2024-01-10 17:51:23 +01:00
Fabian Boehm
2aee930659 Revert "Remove redundantly set corrosion env vars."
This reverts commit 114ebe3b8f.
2024-01-10 17:21:05 +01:00
Fabian Boehm
fbfc6f8d8c Fix highlighting for slices with quotes
This would highlight `$var["foo"]` as an error because
parse_util_slice_length didn't advance the iterator.

There's got to be a nicer way to write this.
2024-01-10 17:04:54 +01:00
Johannes Altmanninger
e84d110995 Fix arithmetic overflow in up-line
The C++ code implicitly relied on wrapping behavior.

There are probably more cases like this.  Maybe we should disable
"overflow-checks" in release mode.
2024-01-10 09:38:45 +01:00
Johannes Altmanninger
114ebe3b8f Remove redundantly set corrosion env vars.
They should already be set in Rust.cmake.
See https://github.com/fish-shell/fish-shell/pull/10198#discussion_r1446402611
2024-01-10 09:38:45 +01:00
Johannes Altmanninger
113f76eecb Address minor clippy lint 2024-01-10 09:38:45 +01:00
Fabian Boehm
b82dad0160 Fix tokenizer crash
This would crash from the highlighter for something like

`PATH={$PATH[echo " "`

The underlying cause is that we use "char_at" which panics on
overread.

So instead this implements try_char_at and then just returns None.
2024-01-09 19:12:16 +01:00
Fabian Boehm
f7c9538fb0 wildcard: Check trailing components against
Forward-port of c31e194120,
Revert of 6823f5e337,
Fixes #10205
2024-01-09 19:08:52 +01:00
Fabian Boehm
96caee837c docs: Add else and end to keywords list 2024-01-09 16:27:33 +01:00
Fabian Boehm
a3c4d74ecd Don't always regenerate the exported array
This made launching external commands about 30% slower.
2024-01-08 17:50:02 +01:00
ridiculousfish
40fad20d7f Remove additional unnecessary uses of unsafe 2024-01-07 17:39:23 -08:00
ridiculousfish
92f49ca071 Remove unsafe from handling of DISOWNED_PIDS
This can be trivially safe.
2024-01-07 17:34:27 -08:00
ridiculousfish
5bff483fe1 Clean up io_chain in IoStreams
Previously this was a pointer; now it can just be a reference.
2024-01-07 17:28:36 -08:00
ridiculousfish
7d7c59611f Implement AtomicRef and use that instead of Lazy strings
This improves thread safety since we're now using actual atomics.
2024-01-07 17:04:41 -08:00
ridiculousfish
1914c3a513 Clean up wgettext
Because wgettext stores strings forever, we can simply leak them onto the heap;
this cleans up some call sites and type signatures.
2024-01-07 15:51:02 -08:00
ridiculousfish
9aa5a97530 Migrate truncate_at_nul to common and write some tests
This encapsulates a common pattern of truncating a wstr at its first NUL
character.
2024-01-07 15:41:36 -08:00
Johannes Altmanninger
29bd6eebd0 Remove cxx and autocxx
Notably this gets rid of the Cargo target directory inside build directories,
in favor of "target/" at workspace root.
2024-01-07 22:19:56 +01:00
Johannes Altmanninger
8a67abfeaa CMake: remove stale lint targets 2024-01-07 22:19:56 +01:00
Johannes Altmanninger
bb2a012c7b Use _PATH_BSHELL again in posix_spawn ENOEXEC fallback 2024-01-07 22:19:56 +01:00
Johannes Altmanninger
f7c9753c4b Rename compat.rs to libc.rs
Matches Rust convention better.
2024-01-07 22:19:56 +01:00
ridiculousfish
e110d4c672 Remove some unnecessary L! 2024-01-07 12:36:50 -08:00
Fabian Boehm
0d6c6b2c8a Check MB_CUR_MAX() outside of loop
This is more correct - we don't want to change how we encode this
string in the middle of encoding it, and also happens to be a bit
faster in my benchmarks because this is actually a function call
according to valgrind.
2024-01-07 20:48:47 +01:00
Fabian Boehm
ae24d98356 benchmarks: Run glob only once
We assume that you use something like hyperfine to run warmups, like
our driver script does.

This allows the script to be run e.g. in valgrind without being too
much of a pain in the gluteus.
2024-01-07 19:33:15 +01:00
Johannes Altmanninger
8d2fa4ae95 fish_indent: fix accidentally quadratic perf regression due to chars().last()
Iterator::last() consumes the entire iterator, even for DoubleEndedIterator,
see https://github.com/rust-lang/rust/pull/28125#issuecomment-145070161

Because of this, "at_line_start()" took 90% of

    fish_indent share/completions/git.fish

making it take 1000ms instead of 30 ms. Fix that.
2024-01-07 19:04:54 +01:00
Johannes Altmanninger
57d7c46d22 completions: fix some completions to not look at other commands on the command line 2024-01-07 19:04:54 +01:00
Johannes Altmanninger
d71aae7d3b completions/ip: remove obsolete workaround
This workaround already exists in core completion machinery.
2024-01-07 19:04:54 +01:00
Johannes Altmanninger
17bdf28b7a Remove unused moveit dependancy 2024-01-07 16:09:51 +01:00
Johannes Altmanninger
47c503bbf3 Make rand_pcg a test-only dependency 2024-01-07 16:09:51 +01:00
Fabian Boehm
244d882984 Fix ASAN workflow 2024-01-07 15:39:48 +01:00
Fabian Boehm
16c2c14fb4 Restyle 2024-01-07 15:13:34 +01:00
Fabian Boehm
0f5b2d4837 Remove C++ style/lint cruft 2024-01-07 15:12:21 +01:00
Fabian Boehm
53f7d1aa11 Remove ffi_init 2024-01-07 14:37:35 +01:00
Fabian Boehm
1e7e6e6379 Remove unixstring dependency
I don't believe this was ever used
2024-01-07 13:21:33 +01:00
Johannes Altmanninger
102ab2c90d Remove FFI code and C++ files
There's a lot more to remove, like
- cxx/autocxx
- now-unused CMake code
- C++ pcre
- C++ entry points
- remaining mentions of "ffi"
2024-01-07 12:12:09 +01:00
Johannes Altmanninger
ab98566c67 Remove fish_tests
The remaining tests are all obsolete or already ported.
2024-01-07 12:12:09 +01:00
Johannes Altmanninger
77550a2f0d Turn FFI tests into native Rust tests
Keep running tests serially to avoid breaking assumptions.

I think many of these tests can run in parallel and/or don't need test_init().
Use the safe variant everywhere, to get it done faster.
2024-01-07 12:12:09 +01:00
Johannes Altmanninger
ae9e7a25f8 Port unit test initialization routine
Here are the differences to the C++ version in fish_tests:
1. we don't need to chdir to repo root, cargo test already does.
2. we don't need srandom because we already use deterministic RNGs for tests.
3. we don't yet call asan_before_exit(). Not yet sure how to hook into
  "cargo test" before exit.
2024-01-07 12:12:09 +01:00
Johannes Altmanninger
b2d4619125 Link against curses in build.rs too
This will allow to use "cargo test" for unit tests that depend on our
curses.rs.

This means that Rust.cmake depends on ConfigureChecks, so move that one to
the front.
2024-01-07 12:12:09 +01:00
Johannes Altmanninger
cc93a6b073 Pull rsconf fix for rsconf::enable_feature and rsconf::link_libraries 2024-01-07 12:12:09 +01:00
Johannes Altmanninger
2f13279423 Remove obsolete tests 2024-01-07 12:12:09 +01:00
Johannes Altmanninger
1b7d4f3b90 Fix latent crash in test_wwrite_to_fd
For whatever reason this did not crash until we made it a proper Rust
unit test.
2024-01-07 12:12:09 +01:00
Johannes Altmanninger
3e3441429a Port wgettext wrapper from wutil.cpp
This introduces a string allocations on lookups of strings that are not
known at compile time; we should get rid of these allocations in future.
2024-01-07 12:12:09 +01:00