Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 867d001

Browse files
rustc_target: document public AbiMap-related fn and variants
1 parent 3bc767e commit 867d001

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎compiler/rustc_target/src/spec/abi_map.rs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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)]
1617
pub 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

2426
impl 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

4246
impl 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

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /