uiua-lang / uiua

A stack-based array programming language
https://www.uiua.org
MIT License
1.63k stars 116 forks source link

When using variables in REPL: "index out of bounds: the len is 0 but the index is 0" #334

Closed ahrzb closed 11 months ago

ahrzb commented 11 months ago

Steps to reproduce:

$ cargo install uiua@0.7.1
$ RUST_BACKTRACE=1 RUST_BACKTRACE=full uiua repl
Uiua 0.7.1 (end with ctrl+C)

» x = 1
↪ x ← 1
» x
↪ x
The application panicked (crashed).
Message:  index out of bounds: the len is 0 but the index is 0
Location: /home/ahrzb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uiua-0.7.1/src/compile.rs:1007

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                              ⋮ 7 frames hidden ⋮                               
 8: core::panicking::panic_bounds_check::hc7e9fc97a18536b3
    at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:180
 9: uiua::compile::Compiler::global_index::h97fc9297143ce4bb
    at <unknown source file>
10: uiua::compile::Compiler::ident::h0a574a53735c0cc7
    at <unknown source file>
11: uiua::compile::Compiler::word::h8e2bff481c3d4af5
    at <unknown source file>
12: uiua::compile::Compiler::compile_words::hdeb74fbf04a5b51b
    at <unknown source file>
13: uiua::compile::Compiler::items::hcfc168f79b785776
    at <unknown source file>
14: uiua::compile::Compiler::load_impl::h4418fde765ab4918
    at <unknown source file>
15: uiua::compile::Compiler::load_str::he24ef32e7dd91eed
    at <unknown source file>
16: uiua::repl::hb32209135fcf9f9d
    at <unknown source file>
17: uiua::main::h434e8cbe86a6df78
    at <unknown source file>
18: std::sys_common::backtrace::__rust_begin_short_backtrace::ha3dee67caf42f45b
    at <unknown source file>
19: main
    at <unknown source file>
20: __libc_start_call_main
    at <unknown source file>
21: __libc_start_main_impl
    at <unknown source file>
22: _start
    at <unknown source file>
Error: The compiler has crashed!
Hooray! You found a bug!
Please report this at http://github.com/uiua-lang/uiua/issues/new

code:
x
ahrzb commented 11 months ago

The 0.7.0 version also has the same issue, 0.6.1 seems to be fine.