@@ -15,7 +15,6 @@ fn main() {
15
15
test_init_array ( ) ;
16
16
test_init_static_inner ( ) ;
17
17
test_exposed ( ) ;
18
- test_expose_int ( ) ;
19
18
test_swap_ptr ( ) ;
20
19
test_swap_ptr_tuple ( ) ;
21
20
test_overwrite_dangling ( ) ;
@@ -107,26 +106,13 @@ fn test_exposed() {
107
106
assert_eq ! ( unsafe { * ( p as * const i32 ) } , x) ;
108
107
}
109
108
110
- /// Test function that writes a pointer and exposes the alloc of its int argument.
111
- fn test_expose_int ( ) {
112
- extern "C" {
113
- fn expose_int ( int_ptr : * const i32 , pptr : * mut * const i32 ) ;
114
- }
115
-
116
- let x = 61 ;
117
- let mut ptr = std:: ptr:: null ( ) ;
118
-
119
- unsafe { expose_int ( & x, & mut ptr) } ;
120
- assert_eq ! ( unsafe { * ptr } , x) ;
121
- }
122
-
123
109
/// Test function that swaps two pointers and exposes the alloc of an int.
124
110
fn test_swap_ptr ( ) {
125
111
extern "C" {
126
112
fn swap_ptr ( pptr0 : * mut * const i32 , pptr1 : * mut * const i32 ) ;
127
113
}
128
114
129
- let x = 71 ;
115
+ let x = 61 ;
130
116
let ( mut ptr0, mut ptr1) = ( & raw const x, null ( ) ) ;
131
117
132
118
unsafe { swap_ptr ( & mut ptr0, & mut ptr1) } ;
@@ -145,7 +131,7 @@ fn test_swap_ptr_tuple() {
145
131
fn swap_ptr_tuple ( t_ptr : * mut Tuple ) ;
146
132
}
147
133
148
- let x = 81 ;
134
+ let x = 71 ;
149
135
let mut tuple = Tuple { ptr0 : & raw const x, ptr1 : null ( ) } ;
150
136
151
137
unsafe { swap_ptr_tuple ( & mut tuple) }
@@ -158,7 +144,7 @@ fn test_overwrite_dangling() {
158
144
fn overwrite_ptr ( pptr : * mut * const i32 ) ;
159
145
}
160
146
161
- let b = Box :: new ( 91 ) ;
147
+ let b = Box :: new ( 81 ) ;
162
148
let mut ptr = Box :: as_ptr ( & b) ;
163
149
drop ( b) ;
164
150
@@ -172,7 +158,7 @@ fn test_pass_dangling() {
172
158
fn ignore_ptr ( ptr : * const i32 ) ;
173
159
}
174
160
175
- let b = Box :: new ( 101 ) ;
161
+ let b = Box :: new ( 91 ) ;
176
162
let ptr = Box :: as_ptr ( & b) ;
177
163
drop ( b) ;
178
164
@@ -192,11 +178,11 @@ fn test_swap_ptr_triple_dangling() {
192
178
fn swap_ptr_triple_dangling ( t_ptr : * const Triple ) ;
193
179
}
194
180
195
- let x = 111 ;
196
- let b = Box :: new ( 121 ) ;
181
+ let x = 101 ;
182
+ let b = Box :: new ( 111 ) ;
197
183
let ptr = Box :: as_ptr ( & b) ;
198
184
drop ( b) ;
199
- let z = 131 ;
185
+ let z = 121 ;
200
186
let triple = Triple {
201
187
ptr0 : & raw const x,
202
188
ptr1 : ptr,
@@ -214,7 +200,7 @@ fn test_return_ptr() {
214
200
fn return_ptr ( ptr : * const i32 ) -> * const i32 ;
215
201
}
216
202
217
- let x = 141 ;
203
+ let x = 131 ;
218
204
let ptr = & raw const x;
219
205
220
206
let ptr = unsafe { return_ptr ( ptr) } ;
0 commit comments