Add test for #6155
rustc::typeck: fix array out of bounds

Fixes #6155
auto merge of #7000 : Blei/rust/fix-6155, r=catamorphism