File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -46,3 +46,41 @@ pub fn _bool_false(b: bool) -> i32 {
46
46
// CHECK: ret i32 2
47
47
_bool ( b)
48
48
}
49
+
50
+ #[ inline]
51
+ pub fn _iref ( a : & u8 ) -> i32 {
52
+ if unsafe { is_val_statically_known ( a) } { 5 } else { 4 }
53
+ }
54
+
55
+ // CHECK-LABEL: @_iref_borrow(
56
+ #[ no_mangle]
57
+ pub fn _iref_borrow ( ) -> i32 {
58
+ // CHECK: ret i32 4
59
+ _iref ( & 0 )
60
+ }
61
+
62
+ // CHECK-LABEL: @_iref_arg(
63
+ #[ no_mangle]
64
+ pub fn _iref_arg ( a : & u8 ) -> i32 {
65
+ // CHECK: ret i32 4
66
+ _iref ( a)
67
+ }
68
+
69
+ #[ inline]
70
+ pub fn _slice_ref ( a : & [ u8 ] ) -> i32 {
71
+ if unsafe { is_val_statically_known ( a) } { 7 } else { 6 }
72
+ }
73
+
74
+ // CHECK-LABEL: @_slice_ref_borrow(
75
+ #[ no_mangle]
76
+ pub fn _slice_ref_borrow ( ) -> i32 {
77
+ // CHECK: ret i32 6
78
+ _slice_ref ( & [ 0 ; 3 ] )
79
+ }
80
+
81
+ // CHECK-LABEL: @_slice_ref_arg(
82
+ #[ no_mangle]
83
+ pub fn _slice_ref_arg ( a : & [ u8 ] ) -> i32 {
84
+ // CHECK: ret i32 6
85
+ _slice_ref ( a)
86
+ }
You can’t perform that action at this time.
0 commit comments