nushell
nushell copied to clipboard
reedline / repl panic when typing a specific `alias`
Describe the bug
~/.s/sessions/03B..PLM/xs $ view source and-then
if ($in | is-not-empty)
~/.s/sessions/03B..PLM/xs $ and-theError: × Main thread panicked.
├─▶ at crates/nu-protocol/src/engine/state_working_set.rs:774:13
╰─▶ Attempt to mutate a block that is in the permanent (immutable) state
help: set the `RUST_BACKTRACE=1` environment variable to display a backtrace.
Doing a git bisect, it looks like this issue was introduced with PR: https://github.com/nushell/nushell/pull/13357
How to reproduce
At the repl:
- alias and-then = if ($in | is-not-empty)
- and-then
Expected behavior
not panic
Screenshots
https://github.com/user-attachments/assets/e096925b-a3dc-4275-9cd5-d6a1f5e07388
Configuration
| key | value |
|---|---|
| version | 0.97.1 |
| major | 0 |
| minor | 97 |
| patch | 1 |
| branch | |
| commit_hash | 60769ac1ba3ea036d889f140095d855e5597840c |
| build_os | macos-aarch64 |
| build_target | aarch64-apple-darwin |
| rust_version | rustc 1.78.0 (9b00956e5 2024-04-29) |
| rust_channel | 1.78.0-aarch64-apple-darwin |
| cargo_version | cargo 1.78.0 (54d8815d0 2024-03-26) |
| build_time | 2024-08-21 14:04:19 -04:00 |
| build_rust_channel | debug |
| allocator | mimalloc |
| features | default, sqlite, system-clipboard, trash |
| installed_plugins | example, from_sse, http 0.1.0, query 0.95.1, stateful_filter 0.1.0 |
Additional context
The alias still works when used in scripts, so it appears to only be an issue with an interaction with reedline / the repl.
Can we remove the cfg(tokio_unstable) at the top of the file containing tests?
I believe there are a few more methods that we can stabilize: JoinHandle::id and AbortHandle::id. There is also JoinSet::join_next_with_id, which I am less certain about.