Trait rustc_middle::ty::layout::FnAbiOfHelpers
source · pub trait FnAbiOfHelpers<'tcx>: LayoutOfHelpers<'tcx> {
type FnAbiOfResult: MaybeResult<&'tcx FnAbi<'tcx, Ty<'tcx>>>;
// Required method
fn handle_fn_abi_err(
&self,
err: FnAbiError<'tcx>,
span: Span,
fn_abi_request: FnAbiRequest<'tcx>
) -> <Self::FnAbiOfResult as MaybeResult<&'tcx FnAbi<'tcx, Ty<'tcx>>>>::Error;
}
Expand description
Trait for contexts that want to be able to compute FnAbi
s.
This automatically gives access to FnAbiOf
, through a blanket impl
.
Required Associated Types§
sourcetype FnAbiOfResult: MaybeResult<&'tcx FnAbi<'tcx, Ty<'tcx>>>
type FnAbiOfResult: MaybeResult<&'tcx FnAbi<'tcx, Ty<'tcx>>>
The &FnAbi
-wrapping type (or &FnAbi
itself), which will be
returned from fn_abi_of_*
(see also handle_fn_abi_err
).
Required Methods§
sourcefn handle_fn_abi_err(
&self,
err: FnAbiError<'tcx>,
span: Span,
fn_abi_request: FnAbiRequest<'tcx>
) -> <Self::FnAbiOfResult as MaybeResult<&'tcx FnAbi<'tcx, Ty<'tcx>>>>::Error
fn handle_fn_abi_err( &self, err: FnAbiError<'tcx>, span: Span, fn_abi_request: FnAbiRequest<'tcx> ) -> <Self::FnAbiOfResult as MaybeResult<&'tcx FnAbi<'tcx, Ty<'tcx>>>>::Error
Helper used for fn_abi_of_*
, to adapt tcx.fn_abi_of_*(...)
into a
Self::FnAbiOfResult
(which does not need to be a Result<...>
).
Most impl
s, which propagate FnAbiError
s, should simply return err
,
but this hook allows e.g. codegen to return only &FnAbi
from its
cx.fn_abi_of_*(...)
, without any Result<...>
around it to deal with
(and any FnAbiError
s are turned into fatal errors or ICEs).