Trait rustc_middle::ty::layout::LayoutOfHelpers[][src]

pub trait LayoutOfHelpers<'tcx>: HasDataLayout + HasTyCtxt<'tcx> + HasParamEnv<'tcx> {
    type LayoutOfResult: MaybeResult<TyAndLayout<'tcx>>;
    fn handle_layout_err(
        &self,
        err: LayoutError<'tcx>,
        span: Span,
        ty: Ty<'tcx>
    ) -> <Self::LayoutOfResult as MaybeResult<TyAndLayout<&TyS>>>::Error; fn layout_tcx_at_span(&self) -> Span { ... } }
Expand description

Trait for contexts that want to be able to compute layouts of types. This automatically gives access to LayoutOf, through a blanket impl.

Associated Types

The TyAndLayout-wrapping type (or TyAndLayout itself), which will be returned from layout_of (see also handle_layout_err).

Required methods

Helper used for layout_of, to adapt tcx.layout_of(...) into a Self::LayoutOfResult (which does not need to be a Result<...>).

Most impls, which propagate LayoutErrors, should simply return err, but this hook allows e.g. codegen to return only TyAndLayout from its cx.layout_of(...), without any Result<...> around it to deal with (and any LayoutErrors are turned into fatal errors or ICEs).

Provided methods

Span to use for tcx.at(span), from layout_of.

Implementors