|
14 | 14 | #![feature(allocator)]
|
15 | 15 |
|
16 | 16 | pub struct S {
|
17 |
| - _field: [i64; 4], |
| 17 | + _field: [i64; 4], |
18 | 18 | }
|
19 | 19 |
|
20 | 20 | pub struct UnsafeInner {
|
21 |
| - _field: std::cell::UnsafeCell<i16>, |
| 21 | + _field: std::cell::UnsafeCell<i16>, |
22 | 22 | }
|
23 | 23 |
|
24 | 24 | // CHECK: zeroext i1 @boolean(i1 zeroext)
|
25 | 25 | #[no_mangle]
|
26 | 26 | pub fn boolean(x: bool) -> bool {
|
27 |
| - x |
| 27 | + x |
28 | 28 | }
|
29 | 29 |
|
30 | 30 | // CHECK: @readonly_borrow(i32* noalias readonly dereferenceable(4))
|
31 | 31 | // FIXME #25759 This should also have `nocapture`
|
32 | 32 | #[no_mangle]
|
33 |
| -pub fn readonly_borrow(_: &i32) { |
34 |
| -} |
| 33 | +pub fn readonly_borrow(_: &i32) {} |
35 | 34 |
|
36 | 35 | // CHECK: @static_borrow(i32* noalias readonly dereferenceable(4))
|
37 | 36 | // static borrow may be captured
|
38 | 37 | #[no_mangle]
|
39 |
| -pub fn static_borrow(_: &'static i32) { |
40 |
| -} |
| 38 | +pub fn static_borrow(_: &'static i32) {} |
41 | 39 |
|
42 | 40 | // CHECK: @named_borrow(i32* noalias readonly dereferenceable(4))
|
43 | 41 | // borrow with named lifetime may be captured
|
44 | 42 | #[no_mangle]
|
45 |
| -pub fn named_borrow<'r>(_: &'r i32) { |
46 |
| -} |
| 43 | +pub fn named_borrow<'r>(_: &'r i32) {} |
47 | 44 |
|
48 | 45 | // CHECK: @unsafe_borrow(%UnsafeInner* dereferenceable(2))
|
49 | 46 | // unsafe interior means this isn't actually readonly and there may be aliases ...
|
50 | 47 | #[no_mangle]
|
51 |
| -pub fn unsafe_borrow(_: &UnsafeInner) { |
52 |
| -} |
| 48 | +pub fn unsafe_borrow(_: &UnsafeInner) {} |
53 | 49 |
|
54 | 50 | // CHECK: @mutable_unsafe_borrow(%UnsafeInner* dereferenceable(2))
|
55 | 51 | // ... unless this is a mutable borrow, those never alias
|
56 | 52 | // ... except that there's this LLVM bug that forces us to not use noalias, see #29485
|
57 | 53 | #[no_mangle]
|
58 |
| -pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) { |
59 |
| -} |
| 54 | +pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) {} |
60 | 55 |
|
61 | 56 | // CHECK: @mutable_borrow(i32* dereferenceable(4))
|
62 | 57 | // FIXME #25759 This should also have `nocapture`
|
63 | 58 | // ... there's this LLVM bug that forces us to not use noalias, see #29485
|
64 | 59 | #[no_mangle]
|
65 |
| -pub fn mutable_borrow(_: &mut i32) { |
66 |
| -} |
| 60 | +pub fn mutable_borrow(_: &mut i32) {} |
67 | 61 |
|
68 | 62 | // CHECK: @indirect_struct(%S* noalias nocapture dereferenceable(32))
|
69 | 63 | #[no_mangle]
|
70 |
| -pub fn indirect_struct(_: S) { |
71 |
| -} |
| 64 | +pub fn indirect_struct(_: S) {} |
72 | 65 |
|
73 | 66 | // CHECK: @borrowed_struct(%S* noalias readonly dereferenceable(32))
|
74 | 67 | // FIXME #25759 This should also have `nocapture`
|
75 | 68 | #[no_mangle]
|
76 |
| -pub fn borrowed_struct(_: &S) { |
77 |
| -} |
| 69 | +pub fn borrowed_struct(_: &S) {} |
78 | 70 |
|
79 | 71 | // CHECK: noalias dereferenceable(4) i32* @_box(i32* noalias dereferenceable(4))
|
80 | 72 | #[no_mangle]
|
81 | 73 | pub fn _box(x: Box<i32>) -> Box<i32> {
|
82 |
| - x |
| 74 | + x |
83 | 75 | }
|
84 | 76 |
|
85 | 77 | // CHECK: @struct_return(%S* noalias nocapture sret dereferenceable(32))
|
86 | 78 | #[no_mangle]
|
87 | 79 | pub fn struct_return() -> S {
|
88 |
| - S { |
89 |
| - _field: [0, 0, 0, 0] |
90 |
| - } |
| 80 | + S { _field: [0, 0, 0, 0] } |
91 | 81 | }
|
92 | 82 |
|
93 | 83 | // Hack to get the correct size for the length part in slices
|
94 | 84 | // CHECK: @helper([[USIZE:i[0-9]+]])
|
95 | 85 | #[no_mangle]
|
96 |
| -fn helper(_: usize) { |
97 |
| -} |
| 86 | +fn helper(_: usize) {} |
98 | 87 |
|
99 | 88 | // CHECK: @slice(i8* noalias nonnull readonly, [[USIZE]])
|
100 | 89 | // FIXME #25759 This should also have `nocapture`
|
101 | 90 | #[no_mangle]
|
102 |
| -fn slice(_: &[u8]) { |
103 |
| -} |
| 91 | +fn slice(_: &[u8]) {} |
104 | 92 |
|
105 | 93 | // CHECK: @mutable_slice(i8* nonnull, [[USIZE]])
|
106 | 94 | // FIXME #25759 This should also have `nocapture`
|
107 | 95 | // ... there's this LLVM bug that forces us to not use noalias, see #29485
|
108 | 96 | #[no_mangle]
|
109 |
| -fn mutable_slice(_: &mut [u8]) { |
110 |
| -} |
| 97 | +fn mutable_slice(_: &mut [u8]) {} |
111 | 98 |
|
112 | 99 | // CHECK: @unsafe_slice(%UnsafeInner* nonnull, [[USIZE]])
|
113 | 100 | // unsafe interior means this isn't actually readonly and there may be aliases ...
|
114 | 101 | #[no_mangle]
|
115 |
| -pub fn unsafe_slice(_: &[UnsafeInner]) { |
116 |
| -} |
| 102 | +pub fn unsafe_slice(_: &[UnsafeInner]) {} |
117 | 103 |
|
118 | 104 | // CHECK: @str(i8* noalias nonnull readonly, [[USIZE]])
|
119 | 105 | // FIXME #25759 This should also have `nocapture`
|
120 | 106 | #[no_mangle]
|
121 |
| -fn str(_: &[u8]) { |
122 |
| -} |
| 107 | +fn str(_: &[u8]) {} |
123 | 108 |
|
124 | 109 | // CHECK: @trait_borrow(i8* nonnull, void (i8*)** nonnull)
|
125 | 110 | // FIXME #25759 This should also have `nocapture`
|
126 | 111 | #[no_mangle]
|
127 |
| -fn trait_borrow(_: &Drop) { |
128 |
| -} |
| 112 | +fn trait_borrow(_: &Drop) {} |
129 | 113 |
|
130 | 114 | // CHECK: @trait_box(i8* noalias nonnull, void (i8*)** nonnull)
|
131 | 115 | #[no_mangle]
|
132 |
| -fn trait_box(_: Box<Drop>) { |
133 |
| -} |
| 116 | +fn trait_box(_: Box<Drop>) {} |
134 | 117 |
|
135 | 118 | // CHECK: { i16*, [[USIZE]] } @return_slice(i16* noalias nonnull readonly, [[USIZE]])
|
136 | 119 | #[no_mangle]
|
137 | 120 | fn return_slice(x: &[u16]) -> &[u16] {
|
138 |
| - x |
| 121 | + x |
139 | 122 | }
|
140 | 123 |
|
141 | 124 | // CHECK: noalias i8* @allocator()
|
142 | 125 | #[no_mangle]
|
143 | 126 | #[allocator]
|
144 | 127 | pub fn allocator() -> *const i8 {
|
145 |
| - std::ptr::null() |
| 128 | + std::ptr::null() |
146 | 129 | }
|
0 commit comments