@@ -88,12 +88,23 @@ impl From<alloc::ffi::NulError> for Error {
8888// doesn't accidentally get printed. 
8989#[ cfg_attr( test,  derive( Debug ) ) ]  
9090enum  ErrorData < C >  { 
91-     Os ( i32 ) , 
91+     Os ( RawOsError ) , 
9292    Simple ( ErrorKind ) , 
9393    SimpleMessage ( & ' static  SimpleMessage ) , 
9494    Custom ( C ) , 
9595} 
9696
97+ /// The type of raw OS error codes returned by [`Error::raw_os_error`]. 
98+ /// 
99+ /// This is an [`i32`] on all currently supported platforms, but platforms 
100+ /// added in the future (such as UEFI) may use a different primitive type like 
101+ /// [`usize`]. Use `as`or [`into`] conversions where applicable to ensure maximum 
102+ /// portability. 
103+ /// 
104+ /// [`into`]: Into::into 
105+ #[ unstable( feature = "raw_os_error_ty" ,  issue = "none" ) ]  
106+ pub  type  RawOsError  = i32 ; 
107+ 
97108// `#[repr(align(4))]` is probably redundant, it should have that value or 
98109// higher already. We include it just because repr_bitpacked.rs's encoding 
99110// requires an alignment >= 4 (note that `#[repr(align)]` will not reduce the 
@@ -579,7 +590,7 @@ impl Error {
579590    #[ must_use]  
580591    #[ inline]  
581592    pub  fn  last_os_error ( )  -> Error  { 
582-         Error :: from_raw_os_error ( sys:: os:: errno ( )   as   i32 ) 
593+         Error :: from_raw_os_error ( sys:: os:: errno ( ) ) 
583594    } 
584595
585596    /// Creates a new instance of an [`Error`] from a particular OS error code. 
@@ -610,7 +621,7 @@ impl Error {
610621#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
611622    #[ must_use]  
612623    #[ inline]  
613-     pub  fn  from_raw_os_error ( code :  i32 )  -> Error  { 
624+     pub  fn  from_raw_os_error ( code :  RawOsError )  -> Error  { 
614625        Error  {  repr :  Repr :: new_os ( code)  } 
615626    } 
616627
@@ -646,7 +657,7 @@ impl Error {
646657#[ stable( feature = "rust1" ,  since = "1.0.0" ) ]  
647658    #[ must_use]  
648659    #[ inline]  
649-     pub  fn  raw_os_error ( & self )  -> Option < i32 >  { 
660+     pub  fn  raw_os_error ( & self )  -> Option < RawOsError >  { 
650661        match  self . repr . data ( )  { 
651662            ErrorData :: Os ( i)  => Some ( i) , 
652663            ErrorData :: Custom ( ..)  => None , 
0 commit comments