autocompleting tilde + forward slash (~/) causes a crash
Reproduction
press tab to initiate the autocomplete and the crash on the last step:
user:~# export RUST_BACKTRACE=1
user:~# ion ^> /path/to/log
user:~# ~/
Expected behaviour
ion lists the files/directories in $HOME/
Actual behaviour
ion crashes, STDERR is printed into /path/to/log:
thread 'main' panicked at 'byte index 47 is out of bounds of `~/`', libcore/str/mod.rs:2094:9
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::panicking::default_hook::{{closure}}
at libstd/sys_common/backtrace.rs:71
2: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:227
at libstd/panicking.rs:476
3: std::panicking::continue_panic_fmt
at libstd/panicking.rs:390
4: rust_begin_unwind
at libstd/panicking.rs:325
5: core::panicking::panic_fmt
at libcore/panicking.rs:77
6: core::str::slice_error_fail
at libcore/str/mod.rs:0
7: <ion_shell::shell::completer::IonFileCompleter as liner::complete::Completer>::completions
8: <ion_shell::shell::completer::MultiCompleter<A, B> as liner::complete::Completer>::completions
9: <liner::editor::Editor<'a, W>>::complete
10: liner::context::Context::read_line
11: ion_shell::shell::binary::readln::readln
12: <&mut I as core::iter::iterator::Iterator>::next
13: <ion_shell::parser::quotes::Terminator<I> as core::iter::iterator::Iterator>::next
14: <ion_shell::shell::Shell as ion_shell::shell::binary::Binary>::execute_interactive
15: ion::main
16: std::rt::lang_start::{{closure}}
17: main
18: __libc_start_main
at ../csu/libc-start.c:308
19: _start
at ../sysdeps/x86_64/start.S:120
Build information
user:~# uname -a
Linux a 4.19.30_1 #1 SMP PREEMPT Wed Mar 20 09:17:21 UTC 2019 x86_64 GNU/Linux
user:~# ion --version
ion 1.0.0-alpha (x86_64-unknown-linux-gnu)
rev fde4aff113a0c7690a158d55ff1798b6d1e91369
ion was built with rustc 1.31.0