@@ -353,8 +353,7 @@ impl CodeGenerator for Module {
353
353
if saw_union && !ctx. options ( ) . unstable_rust {
354
354
utils:: prepend_union_types ( ctx, & mut * result) ;
355
355
}
356
- let saw_incomplete_array = result. saw_incomplete_array ;
357
- if saw_incomplete_array && !ctx. options ( ) . unstable_rust {
356
+ if result. saw_incomplete_array {
358
357
utils:: prepend_incomplete_array_types ( ctx, & mut * result) ;
359
358
}
360
359
if ctx. need_bindegen_complex_type ( ) {
@@ -2360,8 +2359,6 @@ mod utils {
2360
2359
result : & mut Vec < P < ast:: Item > > ) {
2361
2360
let prefix = ctx. trait_prefix ( ) ;
2362
2361
2363
- // TODO(emilio): The fmt::Debug impl could be way nicer with
2364
- // std::intrinsics::type_name, but...
2365
2362
let incomplete_array_decl = quote_item ! ( ctx. ext_cx( ) ,
2366
2363
#[ repr( C ) ]
2367
2364
pub struct __IncompleteArrayField<T >(
@@ -2376,14 +2373,24 @@ mod utils {
2376
2373
__IncompleteArrayField( :: $prefix:: marker:: PhantomData )
2377
2374
}
2378
2375
2376
+ #[ inline]
2377
+ pub unsafe fn as_ptr( & self ) -> * const T {
2378
+ :: $prefix:: mem:: transmute( self )
2379
+ }
2380
+
2381
+ #[ inline]
2382
+ pub unsafe fn as_mut_ptr( & mut self ) -> * mut T {
2383
+ :: $prefix:: mem:: transmute( self )
2384
+ }
2385
+
2379
2386
#[ inline]
2380
2387
pub unsafe fn as_slice( & self , len: usize ) -> & [ T ] {
2381
- :: std:: slice:: from_raw_parts( :: std :: mem :: transmute ( self ) , len)
2388
+ :: std:: slice:: from_raw_parts( self . as_ptr ( ) , len)
2382
2389
}
2383
2390
2384
2391
#[ inline]
2385
2392
pub unsafe fn as_mut_slice( & mut self , len: usize ) -> & mut [ T ] {
2386
- :: std:: slice:: from_raw_parts_mut( :: std :: mem :: transmute ( self ) , len)
2393
+ :: std:: slice:: from_raw_parts_mut( self . as_mut_ptr ( ) , len)
2387
2394
}
2388
2395
}
2389
2396
)
0 commit comments