fish-shell/src
Mahmoud Al-Qudsi 455b744bca Port fd_monitor tests to rust
This shows some of the ugliness of the rust borrow checker when it comes to
safely implementing any sort of recursive access and the need to be overly
explicit about which types are actually used across threads and which aren't.

We're forced to use an `Arc` for `ItemMaker` (née `item_maker_t`) because
there's no other way to make it clear that its lifetime will last longer than
the FdMonitor's. But once we've created an `Arc<T>` we can't call
`Arc::get_mut()` to get an `&mut T` once we've created even a single weak
reference to the Arc (because that weak ref could be upgraded to a strong ref at
any time). This means we need to finish configuring any non-atomic properties
(such as `ItemMaker::always_exit`) before we initialize the callback (which
needs an `Arc<ItemMaker>` to do its thing).

Because rust doesn't like self-referential types and because of the fact that we
now need to create both the `ItemMaker` and the `FdMonitorItem` separately
before we set the callback (at which point it becomes impossible to get a
mutable reference to the `ItemMaker`), `ItemMaker::item` is dropped from the
struct and we instead have the "constructor" for `ItemMaker` take a reference to
an `FdMonitor` instance and directly add itself to the monitor's set, meaning we
don't need to move the item out of the `ItemMaker` in order to add it to the
`FdMonitor` set later.
2023-03-05 00:33:53 -06:00
..
builtins Port bg builtin to Rust (#9621) 2023-02-28 16:42:12 -06:00
widecharwidth Upgrade widechar_width to Unicode 15 2022-09-26 17:17:17 +02:00
abbrs.h abbr: port abbreviation and abbr builtin to rust 2023-02-25 12:24:58 +01:00
ast.cpp Port tokenizer.cpp to Rust 2023-02-09 00:37:22 +01:00
ast.h Rename ast::job_t to ast::job_pipeline_t 2023-02-02 19:34:48 -07:00
ast_node_types.inc Rename ast::job_t to ast::job_pipeline_t 2023-02-02 19:34:48 -07:00
autoload.cpp Spelling fixes 2022-10-28 20:10:09 -07:00
autoload.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
builtin.cpp Port bg builtin to Rust (#9621) 2023-02-28 16:42:12 -06:00
builtin.h Port bg builtin to Rust (#9621) 2023-02-28 16:42:12 -06:00
color.cpp color: Use convert_digit 2022-08-27 11:41:29 +02:00
color.h clang-format all C++ files 2022-08-21 15:02:19 -07:00
common.cpp Follow Rust naming convention for some types 2023-02-08 21:49:54 +01:00
common.h Rewrite wrealpath from wutil in Rust (#9613) 2023-02-26 20:13:40 -07:00
complete.cpp abbr: port abbreviation and abbr builtin to rust 2023-02-25 12:24:58 +01:00
complete.h clang-format C++ files 2023-02-25 12:24:25 +01:00
enum_map.h enum_map stuff to enum_map.h 2021-10-01 03:39:43 -07:00
enum_set.h Remove enum_iter_t 2023-01-14 12:58:20 -08:00
env.cpp abbr: port abbreviation and abbr builtin to rust 2023-02-25 12:24:58 +01:00
env.h Shrink size of env_mode_flags_t 2022-10-15 15:15:04 -05:00
env_dispatch.cpp Add workaround for Midnight Commander's issue with prompt extraction 2023-02-11 14:18:10 +01:00
env_dispatch.h Revert "I need to take a break. Fixup." 2022-08-22 14:11:52 -07:00
env_universal_common.cpp Initial Rust commit 2023-02-02 19:34:47 -07:00
env_universal_common.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
event.cpp block: Use an integer to count blocks 2023-02-26 14:12:57 -06:00
event.h Port emit builtin to rust 2023-02-11 15:04:57 +01:00
exec.cpp Port job_group to rust (#9608) 2023-02-25 16:42:45 -06:00
exec.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
expand.cpp clang-format C++ files 2023-02-25 12:24:25 +01:00
expand.h Allow custom completions to have leading dots 2023-02-11 11:27:14 -08:00
fallback.cpp clang-format C++ files 2023-02-25 12:24:25 +01:00
fallback.h IWYU 2022-09-12 18:34:19 -07:00
fds.cpp Port fd_monitor (and its needed components) 2023-02-19 15:42:03 -06:00
fds.h Port fd_monitor (and its needed components) 2023-02-19 15:42:03 -06:00
ffi.h Port job_group to rust (#9608) 2023-02-25 16:42:45 -06:00
fish.cpp Port parse_constants.h to Rust 2023-02-09 00:37:22 +01:00
fish_indent.cpp Port tokenizer.cpp to Rust 2023-02-09 00:37:22 +01:00
fish_key_reader.cpp clang-format C++ files 2023-02-25 12:24:25 +01:00
fish_test_helper.cpp Initial Rust commit 2023-02-02 19:34:47 -07:00
fish_tests.cpp Port fd_monitor tests to rust 2023-03-05 00:33:53 -06:00
fish_version.cpp Fix build 2021-09-21 18:33:14 -07:00
fish_version.h Revert "Generate FISH_BUILD_VERSION info for cmake builds" 2018-01-08 22:28:10 -08:00
flog.cpp Initial Rust commit 2023-02-02 19:34:47 -07:00
flog.h Initial Rust commit 2023-02-02 19:34:47 -07:00
function.cpp Merge branch 'riir' 2023-02-19 08:57:47 -08:00
function.h functions --copy: store file and lineno (#9542) 2023-02-13 09:59:28 -06:00
future_feature_flags.h Follow Rust naming convention for some types 2023-02-08 21:49:54 +01:00
global_safety.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
highlight.cpp abbr: port abbreviation and abbr builtin to rust 2023-02-25 12:24:58 +01:00
highlight.h IWYU fixup 2022-10-26 20:04:04 -07:00
history.cpp Port parse_constants.h to Rust 2023-02-09 00:37:22 +01:00
history.h Include subsequence matches in history-pager 2023-01-22 16:11:46 +01:00
history_file.cpp history_file.cpp: remove an unused variable 2022-10-26 16:09:02 +02:00
history_file.h clang-format all C++ files 2022-08-21 15:02:19 -07:00
input.cpp Initial Rust commit 2023-02-02 19:34:47 -07:00
input.h Spelling fixes 2022-10-28 20:10:09 -07:00
input_common.cpp Initial Rust commit 2023-02-02 19:34:47 -07:00
input_common.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
io.cpp clang-format C++ files 2023-02-25 12:24:25 +01:00
io.h Port job_group to rust (#9608) 2023-02-25 16:42:45 -06:00
iothread.cpp Initial Rust commit 2023-02-02 19:34:47 -07:00
iothread.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
kill.cpp IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
kill.h Implementation of variable with killring entries 2021-04-21 16:39:29 -07:00
lru.h Reimplement autosuggestion-triggered completion loading 2022-06-19 15:15:17 -07:00
maybe.h Add a maybe_t constructor taking std::unique_ptr 2023-03-04 22:24:22 +01:00
null_terminated_array.cpp Rework null terminated arrays 2021-03-28 15:31:25 -07:00
null_terminated_array.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
operation_context.cpp clang-format all C++ files 2022-08-21 15:02:19 -07:00
operation_context.h Port job_group to rust (#9608) 2023-02-25 16:42:45 -06:00
output.cpp Spelling fixes 2022-10-28 20:10:09 -07:00
output.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
pager.cpp Revert "Re-implement macro to constexpr transition" 2022-09-20 11:58:37 -07:00
pager.h Revert "Re-implement macro to constexpr transition" 2022-09-20 11:58:37 -07:00
parse_constants.h Use the correct type names for forward-declared parser types 2023-03-04 22:24:22 +01:00
parse_execution.cpp Port job_group to rust (#9608) 2023-02-25 16:42:45 -06:00
parse_execution.h clang-format C++ files 2023-02-25 12:24:25 +01:00
parse_tree.cpp Port parse_constants.h to Rust 2023-02-09 00:37:22 +01:00
parse_tree.h Port parse_constants.h to Rust 2023-02-09 00:37:22 +01:00
parse_util.cpp Port tokenizer.cpp to Rust 2023-02-09 00:37:22 +01:00
parse_util.h Port tokenizer.cpp to Rust 2023-02-09 00:37:22 +01:00
parser.cpp clang-format C++ files 2023-03-04 22:24:22 +01:00
parser.h clang-format C++ files 2023-03-04 22:24:22 +01:00
parser_keywords.cpp IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
parser_keywords.h Remove unused functions, members (and a variable) 2022-04-09 10:10:44 -07:00
path.cpp Make sure that cd to a relative CDPATH results in absolute $PWD 2022-12-10 11:06:54 +01:00
path.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
postfork.cpp Port job_group to rust (#9608) 2023-02-25 16:42:45 -06:00
postfork.h Mark Dup2List as a struct, not a class 2023-02-11 12:13:51 -08:00
print_help.cpp Revert "Re-implement macro to constexpr transition" 2022-09-20 11:58:37 -07:00
print_help.h restyle proc module to match project style 2016-05-02 22:07:58 -07:00
proc.cpp clang-format C++ files 2023-03-04 22:24:22 +01:00
proc.h Port bg builtin to Rust (#9621) 2023-02-28 16:42:12 -06:00
re.cpp re: port regex make anchored to rust and helper ffi funtions for regex 2023-02-25 12:24:57 +01:00
re.h re: port regex make anchored to rust and helper ffi funtions for regex 2023-02-25 12:24:57 +01:00
reader.cpp reader: Remove assert in history search 2023-03-02 16:29:49 +01:00
reader.h Remove abbreviation triggers 2022-12-10 16:15:00 -08:00
redirection.h Port redirection.cpp to Rust 2023-02-09 00:37:22 +01:00
rustffi.cpp Initial Rust commit 2023-02-02 19:34:47 -07:00
screen.cpp clang-format C++ files 2023-02-25 12:24:25 +01:00
screen.h Add workaround for Midnight Commander's issue with prompt extraction 2023-02-11 14:18:10 +01:00
signals.cpp Initial Rust commit 2023-02-02 19:34:47 -07:00
signals.h Initial Rust commit 2023-02-02 19:34:47 -07:00
termsize.cpp clang-format all C++ files 2022-08-21 15:02:19 -07:00
termsize.h clang-format all C++ files 2022-08-21 15:02:19 -07:00
tinyexpr.cpp Run include-what-you-use 2022-10-26 19:58:40 -07:00
tinyexpr.h tinyexpr.h: rename __TINYEXPR_H__ include guard 2023-01-01 03:20:01 -08:00
tokenizer.h Port tokenizer.cpp to Rust 2023-02-09 00:37:22 +01:00
topic_monitor.h Initial Rust commit 2023-02-02 19:34:47 -07:00
trace.cpp clang-format all C++ files 2022-08-21 15:02:19 -07:00
trace.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
utf8.cpp Revert "Re-implement macro to constexpr transition" 2022-09-20 11:58:37 -07:00
utf8.h Revert "Re-implement macro to constexpr transition" 2022-09-20 11:58:37 -07:00
util.h Port util.cpp to Rust 2023-02-03 18:55:06 +01:00
wait_handle.cpp Implement builtin_wait in Rust 2023-02-02 19:34:48 -07:00
wait_handle.h Implement builtin_wait in Rust 2023-02-02 19:34:48 -07:00
wcstringutil.cpp Include subsequence matches in history-pager 2023-01-22 16:11:46 +01:00
wcstringutil.h Include subsequence matches in history-pager 2023-01-22 16:11:46 +01:00
wgetopt.cpp Use actual enum names in wgetopt 2022-12-11 10:26:39 -08:00
wgetopt.h Untangle some pointers in wgetopt 2022-12-04 14:48:20 -08:00
wildcard.cpp clang-format C++ files 2023-02-25 12:24:25 +01:00
wildcard.h IWYU-guided #include rejiggering. 2022-08-20 23:55:18 -07:00
wutil.cpp Merge branch 'riir' 2023-02-19 08:57:47 -08:00
wutil.h Add an assert in wcharz_t's constructor that it is not null 2023-03-04 13:13:24 -08:00