-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Parser crashes when variable name in let expression is missing #10380
Copy link
Copy link
Closed
Labels
status:needs-triageAn issue that hasn't had any proper lookAn issue that hasn't had any proper look
Description
Describe the bug
I get index out of bounds crash when typing a program like this:
let = a | b
I ran into this when trying to rename a variable
How to reproduce
- Launch nu
- Write
let = a | bin the terminal - nu immediately crashes
Expected behavior
I expect the parser to not be partial or at least that any panic from the parser would be caught instead of crashing the full shell.
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.83.1 |
| branch | |
| commit_hash | |
| build_os | macos-x86_64 |
| build_target | x86_64-apple-darwin |
| rust_version | rustc 1.71.1 (eb26296b5 2023-08-03) (built from a source tarball) |
| cargo_version | cargo 1.71.1 |
| build_time | 1980-01-01 00:00:00 +00:00 |
| build_rust_channel | release |
| allocator | standard |
| features | default, sqlite, trash, which, zip |
| installed_plugins |
Additional context
Stack trace:
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', crates/nu-parser/src/parser.rs:3068:47 09/15/2023 10:50:32 AM
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic_bounds_check
3: nu_parser::parser::parse_var_with_opt_type
4: nu_parser::parse_keywords::parse_let
5: nu_parser::parser::parse_builtin_commands
6: nu_parser::parser::parse_block
7: nu_parser::parser::parse
8: <nu_cli::syntax_highlight::NuHighlighter as reedline::highlighter::Highlighter>::highlight
9: reedline::engine::Reedline::repaint
10: reedline::engine::Reedline::read_line
11: nu_cli::repl::evaluate_repl
12: nu::run::run_repl
13: nu::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status:needs-triageAn issue that hasn't had any proper lookAn issue that hasn't had any proper look