]> git.lizzy.rs Git - rust.git/commit
Fix LLVM assertion on out-of-bounds const slice index.
authorJed Davis <jld@panix.com>
Sun, 4 Oct 2015 20:32:49 +0000 (13:32 -0700)
committerJed Davis <jld@panix.com>
Mon, 5 Oct 2015 00:22:28 +0000 (17:22 -0700)
commitfd077800eafcf9fe0c79f439aeaa121df266a79f
treee79db68a08d2c2cfcc0b64cc8fdb07faca14ffb6
parent380d76724425f6889279a7c9ea84148465366e62
Fix LLVM assertion on out-of-bounds const slice index.

This turned up as part of #3170.  When constructing an `undef` value to
return in the error case, we were trying to get the element type of the
Rust-level value being indexed instead of the underlying array; when
indexing a slice, that's not an array and the LLVM assertion failure
reflects this.

The regression test is a lightly altered copy of `const-array-oob.rs`.
src/librustc_trans/trans/consts.rs
src/test/compile-fail/const-slice-oob.rs [new file with mode: 0644]