File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
tests/codegen-llvm/lib-optimizations Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ // Ensures that we can create an array of `Weak`s using `memset`.
2+
3+ //@ compile-flags: -Z merge-functions=disabled
4+
5+ #![ crate_type = "lib" ]
6+
7+ use std:: rc;
8+
9+ #[ no_mangle]
10+ pub fn array_of_rc_weak ( ) -> [ rc:: Weak < u32 > ; 100 ] {
11+ // CHECK-LABEL: @array_of_rc_weak(
12+ // CHECK-NEXT: start:
13+ // CHECK-NEXT: call void @llvm.memset.
14+ // CHECK-NEXT: ret void
15+ [ ( ) ; 100 ] . map ( |( ) | rc:: Weak :: new ( ) )
16+ }
Original file line number Diff line number Diff line change 1+ // Ensures that we can acquire `Option<&T>` from `&Option<Rc<T>>` without checking for `None`.
2+
3+ //@ compile-flags: -Z merge-functions=disabled
4+
5+ #![ crate_type = "lib" ]
6+
7+ use std:: rc:: Rc ;
8+
9+ #[ no_mangle]
10+ pub fn option_rc_as_deref_no_cmp ( rc : & Option < Rc < u32 > > ) -> Option < & u32 > {
11+ // CHECK-LABEL: @option_rc_as_deref_no_cmp(ptr
12+ // CHECK-NEXT: start:
13+ // CHECK-NEXT: %[[RC:.+]] = load ptr, ptr %rc
14+ // CHECK-NEXT: ret ptr %[[RC]]
15+ rc. as_deref ( )
16+ }
You can’t perform that action at this time.
0 commit comments