X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_passes%2Fsrc%2Fliveness.rs;h=6afdcc37fe86ea9d15652bcd848aec739c6ad4b8;hb=145241402d8d64173ebdab1615c369a834d179f4;hp=b49432b79962bd3c288ec770a85fe2d1d1e5483c;hpb=3d18c4d62d50df273efa8c4b66a12aa010827640;p=rust.git diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs index b49432b7996..6afdcc37fe8 100644 --- a/compiler/rustc_passes/src/liveness.rs +++ b/compiler/rustc_passes/src/liveness.rs @@ -191,9 +191,9 @@ pub fn provide(providers: &mut Providers) { // Creating ir_maps // // This is the first pass and the one that drives the main -// computation. It walks up and down the IR once. On the way down, +// computation. It walks up and down the IR once. On the way down, // we count for each function the number of variables as well as -// liveness nodes. A liveness node is basically an expression or +// liveness nodes. A liveness node is basically an expression or // capture clause that does something of interest: either it has // interesting control flow or it uses/defines a local variable. // @@ -203,11 +203,11 @@ pub fn provide(providers: &mut Providers) { // of live variables at each program point. // // Finally, we run back over the IR one last time and, using the -// computed liveness, check various safety conditions. For example, +// computed liveness, check various safety conditions. For example, // there must be no live nodes at the definition site for a variable -// unless it has an initializer. Similarly, each non-mutable local +// unless it has an initializer. Similarly, each non-mutable local // variable must not be assigned if there is some successor -// assignment. And so forth. +// assignment. And so forth. struct CaptureInfo { ln: LiveNode, @@ -417,7 +417,7 @@ fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) { self.add_live_node_for_node(expr.hir_id, ExprNode(expr.span, expr.hir_id)); // Make a live_node for each mentioned variable, with the span - // being the location that the variable is used. This results + // being the location that the variable is used. This results // in better error messages than just pointing at the closure // construction site. let mut call_caps = Vec::new(); @@ -792,7 +792,7 @@ fn propagate_through_stmt(&mut self, stmt: &hir::Stmt<'_>, succ: LiveNode) -> Li match stmt.kind { hir::StmtKind::Local(ref local) => { // Note: we mark the variable as defined regardless of whether - // there is an initializer. Initially I had thought to only mark + // there is an initializer. Initially I had thought to only mark // the live variable as defined if it was initialized, and then we // could check for uninit variables just by scanning what is live // at the start of the function. But that doesn't work so well for @@ -1169,24 +1169,24 @@ fn propagate_through_place_components(&mut self, expr: &Expr<'_>, succ: LiveNode // // # Tracked places // - // A tracked place is a local variable/argument `x`. In + // A tracked place is a local variable/argument `x`. In // these cases, the link_node where the write occurs is linked - // to node id of `x`. The `write_place()` routine generates - // the contents of this node. There are no subcomponents to + // to node id of `x`. The `write_place()` routine generates + // the contents of this node. There are no subcomponents to // consider. // // # Non-tracked places // - // These are places like `x[5]` or `x.f`. In that case, we + // These are places like `x[5]` or `x.f`. In that case, we // basically ignore the value which is written to but generate - // reads for the components---`x` in these two examples. The + // reads for the components---`x` in these two examples. The // components reads are generated by // `propagate_through_place_components()` (this fn). // // # Illegal places // // It is still possible to observe assignments to non-places; - // these errors are detected in the later pass borrowck. We + // these errors are detected in the later pass borrowck. We // just ignore such cases and treat them as reads. match expr.kind { @@ -1204,7 +1204,7 @@ fn write_place(&mut self, expr: &Expr<'_>, succ: LiveNode, acc: u32) -> LiveNode } // We do not track other places, so just propagate through - // to their subcomponents. Also, it may happen that + // to their subcomponents. Also, it may happen that // non-places occur here, because those are detected in the // later pass borrowck. _ => succ,