File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
tests/codegen-llvm/lib-optimizations Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ //@ compile-flags: -O -Z merge-functions=disabled
2+
3+ #![ crate_type = "lib" ]
4+
5+ use std:: rc:: { self , Rc } ;
6+
7+ // Ensures that we can create array of `Weak`s using `memset`.
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+ }
17+
18+ // Ensures that we convert `&Option<Rc<T>>` to `Option<&T>` without checking for `None`.
19+
20+ #[ no_mangle]
21+ pub fn option_rc_as_deref_no_cmp ( rc : & Option < Rc < u32 > > ) -> Option < & u32 > {
22+ // CHECK-LABEL: @option_rc_as_deref_no_cmp(ptr
23+ // CHECK-NEXT: start:
24+ // CHECK-NEXT: %[[RC:.+]] = load ptr, ptr %rc
25+ // CHECK-NEXT: ret ptr %[[RC]]
26+ rc. as_deref ( )
27+ }
You can’t perform that action at this time.
0 commit comments