Skip to content

Commit 601e5d1

Browse files
authored
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.
2 parents 0915629 + 257d222 commit 601e5d1

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

  • compiler/rustc_target/src/abi/call

‎compiler/rustc_target/src/abi/call/mod.rs‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -779,26 +779,31 @@ impl RiscvInterruptKind {
779779
/// Metadata describing how the arguments to a native function
780780
/// should be passed in order to respect the native ABI.
781781
///
782+
/// The signature represented by this type may not match the MIR function signature.
783+
/// Certain attributes, like `#[track_caller]` can introduce additional arguments, which are present in [`FnAbi`], but not in `FnSig`.
784+
/// While this difference is rarely relevant, it should still be kept in mind.
785+
///
782786
/// I will do my best to describe this structure, but these
783787
/// comments are reverse-engineered and may be inaccurate. -NDM
784788
#[derive(Clone,PartialEq,Eq,Hash,HashStable_Generic)]
785789
pubstructFnAbi<'a,Ty>{
786-
/// The LLVM types of each argument.
790+
/// The type, layout, and information about how each argument is passed.
787791
pubargs:Box<[ArgAbi<'a,Ty>]>,
788792

789-
/// LLVM return type.
793+
/// The layout, type, and the way a value is returned from this function.
790794
pubret:ArgAbi<'a,Ty>,
791795

796+
/// Marks this function as variadic (accepting a variable number of arguments).
792797
pubc_variadic:bool,
793798

794799
/// The count of non-variadic arguments.
795800
///
796801
/// Should only be different from args.len() when c_variadic is true.
797802
/// This can be used to know whether an argument is variadic or not.
798803
pubfixed_count:u32,
799-
804+
/// The calling convention of this function.
800805
pubconv:Conv,
801-
806+
/// Indicates if an unwind may happen across a call to this function.
802807
pubcan_unwind:bool,
803808
}
804809

0 commit comments

Comments
 (0)