Skip to content

Crash in parser when backspacing over variable name #9826

Closed

Description

@sophiajt

Describe the bug

We currently crash when backspacing over the variable name in the following example:

let x = "foo" | $in; $x | describe

You get:

let xthread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', crates/nu-parser/src/parser.rs:3068:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

How to reproduce

  1. Paste let x = "foo" | $in; $x | describe
  2. Move the cursor to the right of the x in let x
  3. Backspace and remove the x

Expected behavior

This should not crash

Screenshots

No response

Configuration

key value
version 0.83.1
branch main
commit_hash f8d325d
build_os macos-aarch64
build_target aarch64-apple-darwin
rust_version rustc 1.69.0 (84c898d65 2023-04-16)
rust_channel 1.69.0-aarch64-apple-darwin
cargo_version cargo 1.69.0 (6e9a83356 2023-04-12)
build_time 2023-07-28 05:55:14 +12:00
build_rust_channel debug
allocator standard
features default, sqlite, trash, which, zip
installed_plugins

Additional context

No response

Activity

  1. added
    status:needs-triage
    on Jul 27, 2023
  2. added
    category:bug
    A:parser
    and removed
    status:needs-triage
    on Jul 27, 2023
  3. WindSoilder commented on Jul 28, 2023

    @WindSoilder
    Contributor

    it's duplicated: #9596

  4. added
    deprecated:duplicate
    on Jul 28, 2023
  5. amtoine commented on Jul 28, 2023

    @amtoine
    Member

    also works (or rather does not lol) with

    let x = "foo" | $in
  6. added a commit that references this issue on Aug 1, 2023
    fea8227
  7. added this to the v0.84.0 milestone on Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:parsercategory:bugdeprecated:duplicatepanic

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions