@@ -20,7 +20,8 @@ use self::gen::windows::foundation::collections::{
2020} ;
2121
2222/// Represents a single UTF-16 character. This is the standard character type in WinRT.
23- #[ derive( Clone , Copy ) ] #[ repr( C ) ]
23+ #[ derive( Clone , Copy ) ]
24+ #[ repr( transparent) ]
2425pub struct Char ( pub :: w:: ctypes:: wchar_t ) ; // TODO: deref to u16
2526
2627/// Marker trait for all Windows Runtime interfaces. They must inherit from `IInspectable`.
@@ -276,11 +277,11 @@ macro_rules! RT_INTERFACE {
276277 ( $( #[ $attr: meta] ) * basic $interface: ident ( $vtbl: ident) : $pinterface: ident ( $pvtbl: ty) [ $iid: ident]
277278 { }
278279 ) => {
279- #[ repr( C ) ] #[ allow( missing_copy_implementations) ] #[ doc( hidden) ]
280+ #[ repr( transparent ) ] #[ allow( missing_copy_implementations) ] #[ doc( hidden) ]
280281 pub struct $vtbl {
281282 pub parent: $pvtbl
282283 }
283- $( #[ $attr] ) * #[ repr( C ) ] #[ allow( missing_copy_implementations) ]
284+ $( #[ $attr] ) * #[ repr( transparent ) ] #[ allow( missing_copy_implementations) ]
284285 pub struct $interface {
285286 lpVtbl: * const $vtbl
286287 }
@@ -329,7 +330,7 @@ macro_rules! RT_INTERFACE {
329330 $( , $p: $t) *
330331 ) -> $rtr) +
331332 }
332- $( #[ $attr] ) * #[ repr( C ) ] #[ allow( missing_copy_implementations) ]
333+ $( #[ $attr] ) * #[ repr( transparent ) ] #[ allow( missing_copy_implementations) ]
333334 pub struct $interface {
334335 lpVtbl: * const $vtbl
335336 }
@@ -378,7 +379,7 @@ macro_rules! RT_INTERFACE {
378379 $( , $p: $t) *
379380 ) -> $rtr) +
380381 }
381- $( #[ $attr] ) * #[ repr( C ) ] #[ allow( missing_copy_implementations) ]
382+ $( #[ $attr] ) * #[ repr( transparent ) ] #[ allow( missing_copy_implementations) ]
382383 pub struct $interface<$t1> where $t1: RtType {
383384 lpVtbl: * const $vtbl<$t1>,
384385 }
@@ -423,7 +424,7 @@ macro_rules! RT_INTERFACE {
423424 $( , $p: $t) *
424425 ) -> $rtr) +
425426 }
426- $( #[ $attr] ) * #[ repr( C ) ] #[ allow( missing_copy_implementations) ]
427+ $( #[ $attr] ) * #[ repr( transparent ) ] #[ allow( missing_copy_implementations) ]
427428 pub struct $interface<$t1, $t2> where $t1: RtType , $t2: RtType {
428429 lpVtbl: * const $vtbl<$t1, $t2>,
429430 }
@@ -649,7 +650,8 @@ macro_rules! DEFINE_CLSID {
649650
650651macro_rules! RT_ENUM {
651652 { enum $name: ident : $t: ty { $( $variant: ident = $value: expr, ) + } } => {
652- #[ repr( C ) ] #[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq ) ]
653+ #[ repr( transparent) ]
654+ #[ derive( Clone , Copy , Debug , Eq , Hash , PartialEq ) ]
653655 #[ allow( non_upper_case_globals) ]
654656 pub struct $name( pub $t) ;
655657
0 commit comments