about summary refs log tree commit diff
path: root/tests/codegen/const-array.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-03-28 10:18:32 +0000
committerbors <bors@rust-lang.org>2025-03-28 10:18:32 +0000
commit2a06022951893fe5b5384f8dbd75b4e6e3b5cee0 (patch)
treec03e2eb1cf5ee8a760a01e53b150b74c033bc4b6 /tests/codegen/const-array.rs
parente77a8f439cc87c5d67b007e9811578533de1de91 (diff)
parent5c82a59bd30815a942b64fa09e22dbe442edf56d (diff)
downloadrust-2a06022951893fe5b5384f8dbd75b4e6e3b5cee0.tar.gz
rust-2a06022951893fe5b5384f8dbd75b4e6e3b5cee0.zip
Auto merge of #138503 - bjorn3:string_merging, r=tmiasko
Avoid wrapping constant allocations in packed structs when not necessary

This way LLVM will set the string merging flag if the alloc is a nul terminated string, reducing binary sizes.

try-job: armhf-gnu
Diffstat (limited to 'tests/codegen/const-array.rs')
-rw-r--r--tests/codegen/const-array.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/codegen/const-array.rs b/tests/codegen/const-array.rs
index e257d8acc08..b3df76c3d8e 100644
--- a/tests/codegen/const-array.rs
+++ b/tests/codegen/const-array.rs
@@ -2,7 +2,7 @@
 
 #![crate_type = "lib"]
 
-const LUT: [u8; 2] = [1, 1];
+const LUT: [u8; 4] = [1, 1, 1, 1];
 
 // CHECK-LABEL: @decode
 #[no_mangle]
@@ -11,5 +11,5 @@ pub fn decode(i: u8) -> u8 {
     // CHECK-NEXT: icmp
     // CHECK-NEXT: select
     // CHECK-NEXT: ret
-    if i < 2 { LUT[i as usize] } else { 2 }
+    if i < 4 { LUT[i as usize] } else { 2 }
 }