Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

thread 'main' panicked at 'index out of bounds' #9

Closed
allanjamesvestal opened this issue May 8, 2019 · 3 comments
Closed

thread 'main' panicked at 'index out of bounds' #9

allanjamesvestal opened this issue May 8, 2019 · 3 comments

Comments

@allanjamesvestal
Copy link

allanjamesvestal commented May 8, 2019

Hello,

I'm trying to install and use this prompt on a Mac with ZSH, but am running into issues when I try and run eval $(silver init).

I've installed rustup and then run rustup-init -y and then cargo install silver without issue.

At that point I set SILVER=(status:black:white dir:blue:black git:green:black cmdtime:magenta:black) and export SILVER_SHELL=zsh (both in my ~/.zshrc file).

Then, when I open a new terminal window and run eval $(silver init) I get the following:

thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /rustc/cfdc84a009020c59e53e4039beae22eb59e41685/src/libcore/slice/mod.rs:2689:10
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

I set RUST_BACKTRACE=1 and tried again, with the following results:

thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /rustc/cfdc84a009020c59e53e4039beae22eb59e41685/src/libcore/slice/mod.rs:2689:10
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::_print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::continue_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::panicking::panic_bounds_check
   9: silver::modules::dir::segment
  10: silver::print::prompt
  11: silver::main
  12: std::rt::lang_start::{{closure}}
  13: std::panicking::try::do_call
  14: __rust_maybe_catch_panic
  15: std::rt::lang_start_internal
  16: main

Please let me know what you'd recommend. Thanks in advance for the help.

@reujab
Copy link
Owner

reujab commented May 9, 2019

I am unable to reproduce and the stack trace doesn't provide enough information to pinpoint the issue. Can you try again using cargo install --debug --force and paste that stack trace?

@reujab reujab closed this as completed in cd00c56 May 9, 2019
@reujab
Copy link
Owner

reujab commented May 9, 2019

Nevermind, I was able to reproduce, and this has been fixed in v1.0.7. Thanks for reporting this.

@allanjamesvestal
Copy link
Author

That's great. Thank you for looking into this, and for the project — I'm looking forward to using it for awhile to come now that I've switched from oh-my-zsh to Antibody.

I'd meant to add the detail that I could get around the panic by setting SILVER_DIR_ALIASES with any non-null value and it'd work, but it looks like that's exactly what you found and fixed.

Thanks again for the quick reply & resolution.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants