[][src]Struct c2rust_refactor::analysis::labeled_ty::LabeledTyCtxt

pub struct LabeledTyCtxt<'lty, L: 'lty> { /* fields omitted */ }

Context for constructing LabeledTys.

Methods

impl<'lty, 'tcx: 'lty, L: Clone> LabeledTyCtxt<'lty, L>[src]

pub fn new(arena: &'lty SyncDroplessArena) -> LabeledTyCtxt<'lty, L>[src]

Build a new LabeledTyCtxt. The arena must be the same one used by the TyCtxt that built the underlying Tys to be labeled.

pub fn mk_slice(
    &self,
    ltys: &[LabeledTy<'lty, 'tcx, L>]
) -> &'lty [LabeledTy<'lty, 'tcx, L>]
[src]

Manually construct a slice in the context's arena.

pub fn mk(
    &self,
    ty: Ty<'tcx>,
    args: &'lty [LabeledTy<'lty, 'tcx, L>],
    label: L
) -> LabeledTy<'lty, 'tcx, L>
[src]

Manually construct a labeled type. Note that this does not do any checks on args! The caller is responsible for making sure the number of arguments matches ty.sty.

pub fn label<F: FnMut(Ty<'tcx>) -> L>(
    &self,
    ty: Ty<'tcx>,
    f: &mut F
) -> LabeledTy<'lty, 'tcx, L>
[src]

Label a Ty using a callback. The callback runs at every type constructor to produce a label for that node in the tree.

pub fn label_slice<F>(
    &self,
    tys: &[Ty<'tcx>],
    f: &mut F
) -> &'lty [LabeledTy<'lty, 'tcx, L>] where
    F: FnMut(Ty<'tcx>) -> L, 
[src]

Label multiple Tys using a callback.

pub fn subst(
    &self,
    lty: LabeledTy<'lty, 'tcx, L>,
    substs: &[LabeledTy<'lty, 'tcx, L>]
) -> LabeledTy<'lty, 'tcx, L>
[src]

Substitute in arguments for any type parameter references (Param) in a labeled type. Panics if lty contains a reference to a type parameter that is past the end of substs (usually this means the caller is providing the wrong list of type arguments as substs).

TODO: This produces a LabeledTy with the right structure, but doesn't actually do substitution on the underlying Tys! This means if you substitute u32 for T, you can end up with a LabeledTy whose ty is S<T>, but whose args are [u32]. By some miracle, this hasn't broken anything yet, but we may need to fix it eventually.

pub fn subst_slice(
    &self,
    ltys: &[LabeledTy<'lty, 'tcx, L>],
    substs: &[LabeledTy<'lty, 'tcx, L>]
) -> &'lty [LabeledTy<'lty, 'tcx, L>]
[src]

Substitute arguments in multiple labeled types.

pub fn relabel<L2, F>(
    &self,
    lty: LabeledTy<'lty, 'tcx, L2>,
    func: &mut F
) -> LabeledTy<'lty, 'tcx, L> where
    F: FnMut(&L2) -> L, 
[src]

Run a callback to replace the labels on a type.

pub fn relabel_slice<L2, F>(
    &self,
    ltys: &'lty [LabeledTy<'lty, 'tcx, L2>],
    func: &mut F
) -> &'lty [LabeledTy<'lty, 'tcx, L>] where
    F: FnMut(&L2) -> L, 
[src]

Replace the labels on several labeled types.

Auto Trait Implementations

impl<'lty, L> !Send for LabeledTyCtxt<'lty, L>

impl<'lty, L> !Sync for LabeledTyCtxt<'lty, L>

Blanket Implementations

impl<T> Lone for T[src]

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<E> SpecializationError for E[src]

impl<T> Erased for T[src]

impl<T> Send for T where
    T: ?Sized
[src]

impl<T> Sync for T where
    T: ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self

impl<T> MaybeResult for T[src]

impl<'a, T> Captures for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> Make for T[src]

impl<T> Slottable for T[src]