A command with a heredoc after a herestring will panic with an array out of bounds variable.
Created by: chrisvittal
Reproduction: cat <<< hello <<EOF
Expected behavior: the ability to enter a heredoc followed by printing something, either "hello" or the heredoc or both.
Actual behavior: ion panics and crashes
Build information:
$ ion --version
ion 1.0.5 (x86_64-unknown-linux-gnu)
rev e4952a2151d51a273faca8febf63395e32e30874
$ rustc -V
rustc 1.22.0-nightly (a47c9f870 2017-10-11)
Misc: Backtrace
cdv:~/src/ion# cat <<< hello <<EOF
thread 'main' panicked at 'slice index starts at 1 but ends at 0', /checkout/src/libcore/slice/mod.rs:752:4
stack backtrace:
0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::_print
at /checkout/src/libstd/sys_common/backtrace.rs:69
2: std::panicking::default_hook::{{closure}}
at /checkout/src/libstd/sys_common/backtrace.rs:58
at /checkout/src/libstd/panicking.rs:381
3: std::panicking::default_hook
at /checkout/src/libstd/panicking.rs:397
4: std::panicking::rust_panic_with_hook
at /checkout/src/libstd/panicking.rs:577
5: std::panicking::begin_panic
at /checkout/src/libstd/panicking.rs:538
6: std::panicking::begin_panic_fmt
at /checkout/src/libstd/panicking.rs:522
7: rust_begin_unwind
at /checkout/src/libstd/panicking.rs:498
8: core::panicking::panic_fmt
at /checkout/src/libcore/panicking.rs:71
9: core::slice::slice_index_order_fail
at /checkout/src/libcore/slice/mod.rs:752
10: <core::ops::range::Range<usize> as core::slice::SliceIndex<[T]>>::index
at /checkout/src/libcore/slice/mod.rs:875
11: core::slice::<impl core::ops::index::Index<I> for [T]>::index
at /checkout/src/libcore/slice/mod.rs:728
12: <alloc::vec::Vec<T> as core::ops::index::Index<core::ops::range::Range<usize>>>::index
at /checkout/src/liballoc/vec.rs:1572
13: ion::parser::pipelines::collector::Collector::parse
at src/parser/pipelines/collector.rs:336
14: ion::parser::pipelines::collector::Collector::run
at src/parser/pipelines/collector.rs:23
15: ion::parser::statement::parse::collect
at src/parser/statement/parse.rs:11
16: ion::parser::statement::parse::parse
at src/parser/statement/parse.rs:167
17: ion::parser::statement::parse_and_validate
at src/parser/statement/mod.rs:13
18: core::ops::function::FnMut::call_mut
at /checkout/src/libcore/ops/function.rs:146
19: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &'a mut F>::call_once
at /checkout/src/libcore/ops/function.rs:271
20: <core::option::Option<T>>::map
at /checkout/src/libcore/option.rs:398
21: <core::iter::Map<I, F> as core::iter::iterator::Iterator>::next
at /checkout/src/libcore/iter/mod.rs:1123
22: <ion::shell::Shell<'a> as ion::shell::flow::FlowLogic>::on_command
at src/shell/flow.rs:73
23: <ion::shell::Shell<'a> as ion::shell::binary::Binary>::execute_interactive
at src/shell/binary.rs:328
24: <ion::shell::Shell<'a> as ion::shell::binary::Binary>::main
at src/shell/binary.rs:391
25: ion::main
at src/main.rs:76
26: __rust_maybe_catch_panic
at /checkout/src/libpanic_unwind/lib.rs:99
27: std::rt::lang_start
at /checkout/src/libstd/panicking.rs:459
at /checkout/src/libstd/panic.rs:361
at /checkout/src/libstd/rt.rs:59
28: main
29: __libc_start_main
30: _start