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

struct Liveness<'a, 'tcx> {
    ir: &'a mut IrMaps<'tcx>,
    typeck_results: &'a TypeckResults<'tcx>,
    param_env: ParamEnv<'tcx>,
    upvars: Option<&'tcx FxIndexMap<HirId, Upvar>>,
    closure_min_captures: Option<&'tcx RootVariableMinCaptureList<'tcx>>,
    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>typeck_results: &'a TypeckResults<'tcx>param_env: ParamEnv<'tcx>upvars: Option<&'tcx FxIndexMap<HirId, Upvar>>closure_min_captures: Option<&'tcx RootVariableMinCaptureList<'tcx>>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]

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

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

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

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

fn live_on_entry(&self, ln: LiveNode, var: Variable) -> bool[src]

fn live_on_exit(&self, ln: LiveNode, var: Variable) -> bool[src]

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

fn assigned_on_entry(&self, ln: LiveNode, var: Variable) -> bool[src]

fn assigned_on_exit(&self, ln: LiveNode, var: Variable) -> bool[src]

fn write_vars<F>(&self, wr: &mut dyn Write, test: F) -> Result<()> where
    F: FnMut(Variable) -> bool, 
[src]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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]

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

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

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.