@@ -12,23 +12,27 @@ pub struct AbiMap {
1212 os : OsKind ,
1313}
1414
15+ /// result from trying to map an ABI
1516#[ derive( Copy , Clone , Debug ) ]
1617pub enum AbiMapping {
1718 /// this ABI is exactly mapped for this platform
1819 Direct ( CanonAbi ) ,
1920 /// we don't yet warn on this, but we will
2021 Deprecated ( CanonAbi ) ,
22+ /// ABI we do not map for this platform: it must not reach codegen
2123 Invalid ,
2224}
2325
2426impl AbiMapping {
27+ /// optionally get a [CanonAbi], even if Deprecated
2528 pub fn into_option ( self ) -> Option < CanonAbi > {
2629 match self {
2730 Self :: Direct ( abi) | Self :: Deprecated ( abi) => Some ( abi) ,
2831 Self :: Invalid => None ,
2932 }
3033 }
3134
35+ /// get a [CanonAbi] even if Deprecated, panicking if Invalid
3236 #[ track_caller]
3337 pub fn unwrap ( self ) -> CanonAbi {
3438 self . into_option ( ) . unwrap ( )
@@ -40,6 +44,7 @@ impl AbiMapping {
4044}
4145
4246impl AbiMap {
47+ /// create an AbiMap according to arbitrary fields on the [Target]
4348 pub fn from_target ( target : & Target ) -> Self {
4449 // the purpose of this little exercise is to force listing what affects these mappings
4550 let arch = match & * target. arch {
@@ -59,6 +64,7 @@ impl AbiMap {
5964 AbiMap { arch, os }
6065 }
6166
67+ /// lower an [ExternAbi] to a [CanonAbi] if this AbiMap allows
6268 pub fn canonize_abi ( & self , extern_abi : ExternAbi , has_c_varargs : bool ) -> AbiMapping {
6369 let AbiMap { os, arch } = * self ;
6470
0 commit comments