about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorclubby789 <jamie@hill-daniel.co.uk>2023-01-17 15:42:53 +0000
committerclubby789 <jamie@hill-daniel.co.uk>2023-01-18 15:15:15 +0000
commitb94a29a25ff9ca4a8edfc0b6c7d1d309dc03d5cd (patch)
tree6a52e6646a627f215034989abf845ea35157a12c /tests/codegen
parentf34cc658eb477958e2b73e05586e7af66faefad9 (diff)
downloadrust-b94a29a25ff9ca4a8edfc0b6c7d1d309dc03d5cd.tar.gz
rust-b94a29a25ff9ca4a8edfc0b6c7d1d309dc03d5cd.zip
Implement `alloc::vec::IsZero` for `Option<$NUM>` types
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/vec-calloc.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/codegen/vec-calloc.rs b/tests/codegen/vec-calloc.rs
index ae6e448f172..9cc5bd4fd1a 100644
--- a/tests/codegen/vec-calloc.rs
+++ b/tests/codegen/vec-calloc.rs
@@ -161,6 +161,23 @@ pub fn vec_option_bool(n: usize) -> Vec<Option<bool>> {
     vec![Some(false); n]
 }
 
+// CHECK-LABEL: @vec_option_i32
+#[no_mangle]
+pub fn vec_option_i32(n: usize) -> Vec<Option<i32>> {
+    // CHECK-NOT: call {{.*}}alloc::vec::from_elem
+    // CHECK-NOT: call {{.*}}reserve
+    // CHECK-NOT: call {{.*}}__rust_alloc(
+
+    // CHECK: call {{.*}}__rust_alloc_zeroed(
+
+    // CHECK-NOT: call {{.*}}alloc::vec::from_elem
+    // CHECK-NOT: call {{.*}}reserve
+    // CHECK-NOT: call {{.*}}__rust_alloc(
+
+    // CHECK: ret void
+    vec![None; n]
+}
+
 // Ensure that __rust_alloc_zeroed gets the right attributes for LLVM to optimize it away.
 // CHECK: declare noalias ptr @__rust_alloc_zeroed(i64, i64 allocalign) unnamed_addr [[RUST_ALLOC_ZEROED_ATTRS:#[0-9]+]]