diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2024-05-15 22:01:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-15 22:01:20 +0200 |
| commit | 601e5d199fe400f01bcf93f87d10c10cf45015fa (patch) | |
| tree | 2dd74a56e66355811ead1c45b0b929a03fa8cc1c | |
| parent | 09156291e55504d38435bab9181776db78c5841a (diff) | |
| parent | 257d222e4b7243b7555e0033e75b308ea85af7e7 (diff) | |
| download | rust-601e5d199fe400f01bcf93f87d10c10cf45015fa.tar.gz rust-601e5d199fe400f01bcf93f87d10c10cf45015fa.zip | |
Rollup merge of #125154 - FractalFir:fnabi_doc, r=compiler-errors
Small improvements to the documentaion of FnAbi I have updated the documentation of `FnAbi`. The `arg` and `ret` fields are no longer LLVM types, but Rust types(`ArgAbi` contains a `TyAndLayout` and a `PassMode`), so I changed the documentation to reflect that. Besides that, I also added documentation to other fields, and added a clarification about the differences between `FnAbi` and `FnSig`, since this is not something that is immediately obvious.
| -rw-r--r-- | compiler/rustc_target/src/abi/call/mod.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs index 919fa2140d5..fc79c9232d1 100644 --- a/compiler/rustc_target/src/abi/call/mod.rs +++ b/compiler/rustc_target/src/abi/call/mod.rs @@ -779,16 +779,21 @@ impl RiscvInterruptKind { /// Metadata describing how the arguments to a native function /// should be passed in order to respect the native ABI. /// +/// The signature represented by this type may not match the MIR function signature. +/// Certain attributes, like `#[track_caller]` can introduce additional arguments, which are present in [`FnAbi`], but not in `FnSig`. +/// While this difference is rarely relevant, it should still be kept in mind. +/// /// I will do my best to describe this structure, but these /// comments are reverse-engineered and may be inaccurate. -NDM #[derive(Clone, PartialEq, Eq, Hash, HashStable_Generic)] pub struct FnAbi<'a, Ty> { - /// The LLVM types of each argument. + /// The type, layout, and information about how each argument is passed. pub args: Box<[ArgAbi<'a, Ty>]>, - /// LLVM return type. + /// The layout, type, and the way a value is returned from this function. pub ret: ArgAbi<'a, Ty>, + /// Marks this function as variadic (accepting a variable number of arguments). pub c_variadic: bool, /// The count of non-variadic arguments. @@ -796,9 +801,9 @@ pub struct FnAbi<'a, Ty> { /// Should only be different from args.len() when c_variadic is true. /// This can be used to know whether an argument is variadic or not. pub fixed_count: u32, - + /// The calling convention of this function. pub conv: Conv, - + /// Indicates if an unwind may happen across a call to this function. pub can_unwind: bool, } |
