summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_passes/src/liveness.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_passes/src/liveness.rs')
-rw-r--r--compiler/rustc_passes/src/liveness.rs38
1 files changed, 18 insertions, 20 deletions
diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs
index 1f65cc8b6..6afdcc37f 100644
--- a/compiler/rustc_passes/src/liveness.rs
+++ b/compiler/rustc_passes/src/liveness.rs
@@ -108,15 +108,13 @@ use std::rc::Rc;
mod rwu_table;
rustc_index::newtype_index! {
- pub struct Variable {
- DEBUG_FORMAT = "v({})",
- }
+ #[debug_format = "v({})"]
+ pub struct Variable {}
}
rustc_index::newtype_index! {
- pub struct LiveNode {
- DEBUG_FORMAT = "ln({})",
- }
+ #[debug_format = "ln({})"]
+ pub struct LiveNode {}
}
#[derive(Copy, Clone, PartialEq, Debug)]
@@ -193,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.
//
@@ -205,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,
@@ -419,7 +417,7 @@ impl<'tcx> Visitor<'tcx> for IrMaps<'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();
@@ -794,7 +792,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
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
@@ -1171,24 +1169,24 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
//
// # 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 {
@@ -1206,7 +1204,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
}
// 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,