@@ -353,8 +353,7 @@ impl CodeGenerator for Module {
353353 if saw_union && !ctx. options ( ) . unstable_rust {
354354 utils:: prepend_union_types ( ctx, & mut * result) ;
355355 }
356- let saw_incomplete_array = result. saw_incomplete_array ;
357- if saw_incomplete_array && !ctx. options ( ) . unstable_rust {
356+ if result. saw_incomplete_array {
358357 utils:: prepend_incomplete_array_types ( ctx, & mut * result) ;
359358 }
360359 if ctx. need_bindegen_complex_type ( ) {
@@ -2360,8 +2359,6 @@ mod utils {
23602359 result : & mut Vec < P < ast:: Item > > ) {
23612360 let prefix = ctx. trait_prefix ( ) ;
23622361
2363- // TODO(emilio): The fmt::Debug impl could be way nicer with
2364- // std::intrinsics::type_name, but...
23652362 let incomplete_array_decl = quote_item ! ( ctx. ext_cx( ) ,
23662363 #[ repr( C ) ]
23672364 pub struct __IncompleteArrayField<T >(
@@ -2376,14 +2373,24 @@ mod utils {
23762373 __IncompleteArrayField( :: $prefix:: marker:: PhantomData )
23772374 }
23782375
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+
23792386 #[ inline]
23802387 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)
23822389 }
23832390
23842391 #[ inline]
23852392 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)
23872394 }
23882395 }
23892396 )
0 commit comments