rustc_middle::ty::layout

Trait FnAbiOfHelpers

Source
pub trait FnAbiOfHelpers<'tcx>: LayoutOfHelpers<'tcx> {
    type FnAbiOfResult: MaybeResult<&'tcx FnAbi<'tcx, Ty<'tcx>>> = &'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 FnAbis. This automatically gives access to FnAbiOf, through a blanket impl.

Provided Associated Types§

Source

type FnAbiOfResult: MaybeResult<&'tcx FnAbi<'tcx, Ty<'tcx>>> = &'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§

Source

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 impls, which propagate FnAbiErrors, 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 FnAbiErrors are turned into fatal errors or ICEs).

Implementors§