File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 1
1
//@ compile-flags: -O
2
+ //@ compile-flags: -Zmerge-functions=disabled
2
3
#![ crate_type = "lib" ]
3
4
4
5
// Test to check that types with "complex" destructors, but trivial `Default` impls
5
6
// are constructed directly into the allocation in `Box::default` and `Arc::default`.
6
7
8
+ use std:: rc:: Rc ;
7
9
use std:: sync:: Arc ;
8
10
9
11
// CHECK-LABEL: @box_default_inplace
@@ -16,6 +18,16 @@ pub fn box_default_inplace() -> Box<(String, String)> {
16
18
Box :: default ( )
17
19
}
18
20
21
+ // CHECK-LABEL: @rc_default_inplace
22
+ #[ no_mangle]
23
+ pub fn rc_default_inplace ( ) -> Rc < ( String , String ) > {
24
+ // CHECK-NOT: alloca
25
+ // CHECK: [[RC:%.*]] = {{.*}}call {{.*}}__rust_alloc(
26
+ // CHECK-NOT: call void @llvm.memcpy
27
+ // CHECK: ret ptr [[RC]]
28
+ Rc :: default ( )
29
+ }
30
+
19
31
// CHECK-LABEL: @arc_default_inplace
20
32
#[ no_mangle]
21
33
pub fn arc_default_inplace ( ) -> Arc < ( String , String ) > {
You can’t perform that action at this time.
0 commit comments