summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/lower_array_len_e2e.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:43 +0000
commit3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 (patch)
treedaf049b282ab10e8c3d03e409b3cd84ff3f7690c /tests/mir-opt/lower_array_len_e2e.rs
parentAdding debian version 1.68.2+dfsg1-1. (diff)
downloadrustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.tar.xz
rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.zip
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/mir-opt/lower_array_len_e2e.rs')
-rw-r--r--tests/mir-opt/lower_array_len_e2e.rs39
1 files changed, 0 insertions, 39 deletions
diff --git a/tests/mir-opt/lower_array_len_e2e.rs b/tests/mir-opt/lower_array_len_e2e.rs
deleted file mode 100644
index d8e4e521e..000000000
--- a/tests/mir-opt/lower_array_len_e2e.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-// compile-flags: -Z mir-opt-level=4 -Zunsound-mir-opts
-
-// EMIT_MIR lower_array_len_e2e.array_bound.PreCodegen.after.mir
-pub fn array_bound<const N: usize>(index: usize, slice: &[u8; N]) -> u8 {
- if index < slice.len() {
- slice[index]
- } else {
- 42
- }
-}
-
-// EMIT_MIR lower_array_len_e2e.array_bound_mut.PreCodegen.after.mir
-pub fn array_bound_mut<const N: usize>(index: usize, slice: &mut [u8; N]) -> u8 {
- if index < slice.len() {
- slice[index]
- } else {
- slice[0] = 42;
-
- 42
- }
-}
-
-// EMIT_MIR lower_array_len_e2e.array_len.PreCodegen.after.mir
-pub fn array_len<const N: usize>(arr: &[u8; N]) -> usize {
- arr.len()
-}
-
-// EMIT_MIR lower_array_len_e2e.array_len_by_value.PreCodegen.after.mir
-pub fn array_len_by_value<const N: usize>(arr: [u8; N]) -> usize {
- arr.len()
-}
-
-fn main() {
- let _ = array_bound(3, &[0, 1, 2, 3]);
- let mut tmp = [0, 1, 2, 3, 4];
- let _ = array_bound_mut(3, &mut [0, 1, 2, 3]);
- let _ = array_len(&[0]);
- let _ = array_len_by_value([0, 2]);
-}