diff options
| author | bors <bors@rust-lang.org> | 2020-05-09 17:31:08 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-05-09 17:31:08 +0000 |
| commit | bad3bf622bded50a97c0a54e29350eada2a3a169 (patch) | |
| tree | 0cfa645b6a4e35b9c1bd6d435f44ecc1f4e2ed19 /src/test/ui/array-slice-vec | |
| parent | 7c59a81a5fcbaaca311f744cd7c68d99bfbb05d3 (diff) | |
| parent | 366c1786e61d14a89cebd354b78ce6a68202b699 (diff) | |
| download | rust-bad3bf622bded50a97c0a54e29350eada2a3a169.tar.gz rust-bad3bf622bded50a97c0a54e29350eada2a3a169.zip | |
Auto merge of #72041 - RalfJung:rollup-xivrvy2, r=RalfJung
Rollup of 5 pull requests
Successful merges:
- #69406 (upgrade chalk and use chalk-solve/chalk-ir/chalk-rust-ir)
- #71185 (Move tests from `test/run-fail` to UI)
- #71234 (rustllvm: Use .init_array rather than .ctors)
- #71508 (Simplify the `tcx.alloc_map` API)
- #71555 (Remove ast::{Ident, Name} reexports.)
Failed merges:
r? @ghost
Diffstat (limited to 'src/test/ui/array-slice-vec')
| -rw-r--r-- | src/test/ui/array-slice-vec/bounds-check-no-overflow.rs | 11 | ||||
| -rw-r--r-- | src/test/ui/array-slice-vec/dst-raw-slice.rs | 13 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/array-slice-vec/bounds-check-no-overflow.rs b/src/test/ui/array-slice-vec/bounds-check-no-overflow.rs new file mode 100644 index 00000000000..3caf5f44995 --- /dev/null +++ b/src/test/ui/array-slice-vec/bounds-check-no-overflow.rs @@ -0,0 +1,11 @@ +// run-fail +// error-pattern:index out of bounds +// ignore-emscripten no processes + +use std::usize; +use std::mem::size_of; + +fn main() { + let xs = [1, 2, 3]; + xs[usize::MAX / size_of::<isize>() + 1]; +} diff --git a/src/test/ui/array-slice-vec/dst-raw-slice.rs b/src/test/ui/array-slice-vec/dst-raw-slice.rs new file mode 100644 index 00000000000..371d16f093a --- /dev/null +++ b/src/test/ui/array-slice-vec/dst-raw-slice.rs @@ -0,0 +1,13 @@ +// Test bounds checking for DST raw slices + +// run-fail +// error-pattern:index out of bounds +// ignore-emscripten no processes + +#[allow(unconditional_panic)] +fn main() { + let a: *const [_] = &[1, 2, 3]; + unsafe { + let _b = (*a)[3]; + } +} |
