diff options
| author | bors <bors@rust-lang.org> | 2024-10-23 05:57:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-10-23 05:57:00 +0000 |
| commit | 9abfcb49002b82f46ad66ceb0b26cee8be2dc658 (patch) | |
| tree | aa8bccbfa0dd67611f41cb19546f84c19e0d2cec /tests/codegen | |
| parent | e1f306899514ea80abc1d1c9f6a57762afb304a3 (diff) | |
| parent | b44a0fa61cafb6e9d61e4100c27e042cfe5c171a (diff) | |
| download | rust-9abfcb49002b82f46ad66ceb0b26cee8be2dc658.tar.gz rust-9abfcb49002b82f46ad66ceb0b26cee8be2dc658.zip | |
Auto merge of #132053 - matthiaskrgr:rollup-u5ds6i3, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #131707 (Run most `core::num` tests in const context too) - #132002 (abi/compatibility: also test Option-like types) - #132026 (analyse: remove unused uncanonicalized field) - #132031 (Optimize `Rc<T>::default`) - #132040 (relnotes: fix stabilizations of `assume_init`) r? `@ghost` `@rustbot` modify labels: rollup
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)> { |
