[−][src]Struct rustc_passes::liveness::Liveness

pub(in liveness) struct Liveness<'a, 'tcx> {
    ir: &'a mut IrMaps<'tcx>,
    body_owner: LocalDefId,
    typeck_results: &'a TypeckResults<'tcx>,
    param_env: ParamEnv<'tcx>,
    upvars: Option<&'tcx FxIndexMap<HirId, Upvar>>,
    closure_captures: Option<&'tcx FxIndexMap<HirId, UpvarId>>,
    successors: IndexVec<LiveNode, Option<LiveNode>>,
    rwu_table: RWUTable,
    closure_ln: LiveNode,
    exit_ln: LiveNode,
    break_ln: HirIdMap<LiveNode>,
    cont_ln: HirIdMap<LiveNode>,
}

Fields

ir: &'a mut IrMaps<'tcx>body_owner: LocalDefIdtypeck_results: &'a TypeckResults<'tcx>param_env: ParamEnv<'tcx>upvars: Option<&'tcx FxIndexMap<HirId, Upvar>>closure_captures: Option<&'tcx FxIndexMap<HirId, UpvarId>>successors: IndexVec<LiveNode, Option<LiveNode>>rwu_table: RWUTableclosure_ln: LiveNode

A live node representing a point of execution before closure entry & after closure exit. Used to calculate liveness of captured variables through calls to the same closure. Used for Fn & FnMut closures only.

exit_ln: LiveNode

A live node representing every 'exit' from the function, whether it be by explicit return, panic, or other means.

break_ln: HirIdMap<LiveNode>cont_ln: HirIdMap<LiveNode>

Implementations

impl<'a, 'tcx> Liveness<'a, 'tcx>[src]

pub(in liveness) fn new(
    ir: &'a mut IrMaps<'tcx>,
    body_owner: LocalDefId
) -> Liveness<'a, 'tcx>
[src]

pub(in liveness) fn live_node(
    &self,
    hir_id: HirId,
    span: Span
) -> LiveNode
[src]

pub(in liveness) fn variable(
    &self,
    hir_id: HirId,
    span: Span
) -> Variable
[src]

pub(in liveness) fn define_bindings_in_pat(
    &mut self,
    pat: &Pat<'_>,
    succ: LiveNode
) -> LiveNode
[src]

pub(in liveness) fn idx(
    &self,
    ln: LiveNode,
    var: Variable
) -> usize
[src]

pub(in liveness) fn live_on_entry(
    &self,
    ln: LiveNode,
    var: Variable
) -> Option<LiveNodeKind>
[src]

pub(in liveness) fn live_on_exit(
    &self,
    ln: LiveNode,
    var: Variable
) -> Option<LiveNodeKind>
[src]

pub(in liveness) fn used_on_entry(
    &self,
    ln: LiveNode,
    var: Variable
) -> bool
[src]

pub(in liveness) fn assigned_on_entry(
    &self,
    ln: LiveNode,
    var: Variable
) -> Option<LiveNodeKind>
[src]

pub(in liveness) fn assigned_on_exit(
    &self,
    ln: LiveNode,
    var: Variable
) -> Option<LiveNodeKind>
[src]

pub(in liveness) fn indices2<F>(
    &mut self,
    ln: LiveNode,
    succ_ln: LiveNode,
    op: F
) where
    F: FnMut(&mut Liveness<'a, 'tcx>, usize, usize), 
[src]

pub(in liveness) fn write_vars<F>(
    &self,
    wr: &mut dyn Write,
    ln: LiveNode,
    test: F
) -> Result<()> where
    F: FnMut(usize) -> bool, 
[src]

pub(in liveness) fn ln_str(
    &self,
    ln: LiveNode
) -> String
[src]

pub(in liveness) fn log_liveness(
    &self,
    entry_ln: LiveNode,
    hir_id: HirId
)
[src]

pub(in liveness) fn init_empty(
    &mut self,
    ln: LiveNode,
    succ_ln: LiveNode
)
[src]

pub(in liveness) fn init_from_succ(
    &mut self,
    ln: LiveNode,
    succ_ln: LiveNode
)
[src]

pub(in liveness) fn merge_from_succ(
    &mut self,
    ln: LiveNode,
    succ_ln: LiveNode,
    first_merge: bool
) -> bool
[src]

pub(in liveness) fn define(
    &mut self,
    writer: LiveNode,
    var: Variable
)
[src]

pub(in liveness) fn acc(
    &mut self,
    ln: LiveNode,
    var: Variable,
    acc: u32
)
[src]

pub(in liveness) fn compute(
    &mut self,
    body: &Body<'_>,
    hir_id: HirId
) -> LiveNode
[src]

pub(in liveness) fn propagate_through_block(
    &mut self,
    blk: &Block<'_>,
    succ: LiveNode
) -> LiveNode
[src]

pub(in liveness) fn propagate_through_stmt(
    &mut self,
    stmt: &Stmt<'_>,
    succ: LiveNode
) -> LiveNode
[src]

pub(in liveness) fn propagate_through_exprs(
    &mut self,
    exprs: &[Expr<'_>],
    succ: LiveNode
) -> LiveNode
[src]

pub(in liveness) fn propagate_through_opt_expr(
    &mut self,
    opt_expr: Option<&Expr<'_>>,
    succ: LiveNode
) -> LiveNode
[src]

pub(in liveness) fn propagate_through_expr(
    &mut self,
    expr: &Expr<'_>,
    succ: LiveNode
) -> LiveNode
[src]

pub(in liveness) fn propagate_through_place_components(
    &mut self,
    expr: &Expr<'_>,
    succ: LiveNode
) -> LiveNode
[src]

pub(in liveness) fn write_place(
    &mut self,
    expr: &Expr<'_>,
    succ: LiveNode,
    acc: u32
) -> LiveNode
[src]

pub(in liveness) fn access_var(
    &mut self,
    hir_id: HirId,
    var_hid: HirId,
    succ: LiveNode,
    acc: u32,
    span: Span
) -> LiveNode
[src]

pub(in liveness) fn access_path(
    &mut self,
    hir_id: HirId,
    path: &Path<'_>,
    succ: LiveNode,
    acc: u32
) -> LiveNode
[src]

pub(in liveness) fn propagate_through_loop(
    &mut self,
    expr: &Expr<'_>,
    body: &Block<'_>,
    succ: LiveNode
) -> LiveNode
[src]

impl<'tcx, '_> Liveness<'_, 'tcx>[src]

pub(in liveness) fn check_place(
    &mut self,
    expr: &'tcx Expr<'tcx>
)
[src]

pub(in liveness) fn should_warn(
    &self,
    var: Variable
) -> Option<String>
[src]

pub(in liveness) fn warn_about_unused_upvars(
    &self,
    entry_ln: LiveNode
)
[src]

pub(in liveness) fn warn_about_unused_args(
    &self,
    body: &Body<'_>,
    entry_ln: LiveNode
)
[src]

pub(in liveness) fn check_unused_vars_in_pat(
    &self,
    pat: &Pat<'_>,
    entry_ln: Option<LiveNode>,
    on_used_on_entry: impl Fn(Vec<Span>, HirId, LiveNode, Variable)
)
[src]

pub(in liveness) fn report_unused(
    &self,
    hir_ids_and_spans: Vec<(HirId, Span)>,
    ln: LiveNode,
    var: Variable
)
[src]

pub(in liveness) fn warn_about_dead_assign(
    &self,
    spans: Vec<Span>,
    hir_id: HirId,
    ln: LiveNode,
    var: Variable
)
[src]

pub(in liveness) fn report_unsed_assign(
    &self,
    hir_id: HirId,
    spans: Vec<Span>,
    var: Variable,
    message: impl Fn(&str) -> String
)
[src]

Trait Implementations

impl<'a, 'tcx> Visitor<'tcx> for Liveness<'a, 'tcx>[src]

type Map = ErasedMap<'tcx>

Auto Trait Implementations

impl<'a, 'tcx> !RefUnwindSafe for Liveness<'a, 'tcx>

impl<'a, 'tcx> !Send for Liveness<'a, 'tcx>

impl<'a, 'tcx> !Sync for Liveness<'a, 'tcx>

impl<'a, 'tcx> Unpin for Liveness<'a, 'tcx> where
    'tcx: 'a, 

impl<'a, 'tcx> !UnwindSafe for Liveness<'a, 'tcx>

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.