diff options
| author | Slanterns <slanterns.w@gmail.com> | 2024-10-22 01:33:22 -0700 |
|---|---|---|
| committer | Slanterns <slanterns.w@gmail.com> | 2024-10-22 02:25:38 -0700 |
| commit | 7782401c520ab1e744dbcf58d0f0254672da9026 (patch) | |
| tree | b2379fb4a152367346ec5b2bfc761290ea5d4c8e /tests/codegen | |
| parent | 5b12d906bb66d308fb3e94d6d79e076fa87c7f7c (diff) | |
| download | rust-7782401c520ab1e744dbcf58d0f0254672da9026.tar.gz rust-7782401c520ab1e744dbcf58d0f0254672da9026.zip | |
add codegen test
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/placement-new.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/codegen/placement-new.rs b/tests/codegen/placement-new.rs index edb25df5eb4..0ec2b6a6f20 100644 --- a/tests/codegen/placement-new.rs +++ b/tests/codegen/placement-new.rs @@ -1,9 +1,11 @@ //@ compile-flags: -O +//@ compile-flags: -Zmerge-functions=disabled #![crate_type = "lib"] // Test to check that types with "complex" destructors, but trivial `Default` impls // are constructed directly into the allocation in `Box::default` and `Arc::default`. +use std::rc::Rc; use std::sync::Arc; // CHECK-LABEL: @box_default_inplace @@ -16,6 +18,16 @@ pub fn box_default_inplace() -> Box<(String, String)> { Box::default() } +// CHECK-LABEL: @rc_default_inplace +#[no_mangle] +pub fn rc_default_inplace() -> Rc<(String, String)> { + // CHECK-NOT: alloca + // CHECK: [[RC:%.*]] = {{.*}}call {{.*}}__rust_alloc( + // CHECK-NOT: call void @llvm.memcpy + // CHECK: ret ptr [[RC]] + Rc::default() +} + // CHECK-LABEL: @arc_default_inplace #[no_mangle] pub fn arc_default_inplace() -> Arc<(String, String)> { |
