diff options
| author | bors <bors@rust-lang.org> | 2020-05-29 07:52:06 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-05-29 07:52:06 +0000 |
| commit | 77f95a89a108d4cd6ad1230fb210b3640952b146 (patch) | |
| tree | 52be6fd4f91f284178f2d81208b27cd6780602d7 /src/test/codegen | |
| parent | 9cd3f1c54956e5b306567161d1965277c9ef8455 (diff) | |
| parent | fb506af138c40ebc3a62ada931259d60a74a6266 (diff) | |
| download | rust-77f95a89a108d4cd6ad1230fb210b3640952b146.tar.gz rust-77f95a89a108d4cd6ad1230fb210b3640952b146.zip | |
Auto merge of #72727 - JohnTitor:rollup-nni16m2, r=JohnTitor
Rollup of 11 pull requests Successful merges: - #71633 (Impl Error for Infallible) - #71843 (Tweak and stabilize AtomicN::fetch_update) - #72288 (Stabilization of weak-into-raw) - #72324 (Stabilize AtomicN::fetch_min and AtomicN::fetch_max) - #72452 (Clarified the documentation for Formatter::precision) - #72495 (Improve E0601 explanation) - #72534 (Improve missing `@` in slice binding pattern diagnostics) - #72547 (Added a codegen test for a recent optimization for overflow-checks=on) - #72711 (remove redundant `mk_const`) - #72713 (Whitelist #[allow_internal_unstable]) - #72720 (Clarify the documentation of `take`) Failed merges: r? @ghost
Diffstat (limited to 'src/test/codegen')
| -rw-r--r-- | src/test/codegen/integer-overflow.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/codegen/integer-overflow.rs b/src/test/codegen/integer-overflow.rs new file mode 100644 index 00000000000..183de56db96 --- /dev/null +++ b/src/test/codegen/integer-overflow.rs @@ -0,0 +1,26 @@ +// no-system-llvm +// compile-flags: -O -C overflow-checks=on + +#![crate_type = "lib"] + + +pub struct S1<'a> { + data: &'a [u8], + position: usize, +} + +// CHECK-LABEL: @slice_no_index_order +#[no_mangle] +pub fn slice_no_index_order<'a>(s: &'a mut S1, n: usize) -> &'a [u8] { + // CHECK-NOT: slice_index_order_fail + let d = &s.data[s.position..s.position+n]; + s.position += n; + return d; +} + +// CHECK-LABEL: @test_check +#[no_mangle] +pub fn test_check<'a>(s: &'a mut S1, x: usize, y: usize) -> &'a [u8] { + // CHECK: slice_index_order_fail + &s.data[x..y] +} |
