Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
359bfa901b9d8eddbed7b88b6716dbb77b7bfb95
rust/tests/ui/consts/const-slice-oob.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

8 lines
164 B
Rust
Raw Normal View History

Use the informative error as the main const eval error message
2025-05-28 10:29:08 +00:00
const FOO: &'static [u32] = &[1, 2, 3];
rustc_const_eval: track the length and index in IndexOutOfBounds.
2016-05-26 22:09:48 +03:00
const BAR: u32 = FOO[5];
Use the informative error as the main const eval error message
2025-05-28 10:29:08 +00:00
//~^ ERROR index out of bounds: the length is 3 but the index is 5
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`.
2015-10-04 13:32:49 -07:00
fn main() {
let _ = BAR;
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 3704ms Template: 4ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API