NodeBinding(&'hir Pat),
NodePat(&'hir Pat),
NodeBlock(&'hir Block),
+ NodeLocal(&'hir Local),
/// NodeStructCtor represents a tuple struct.
NodeStructCtor(&'hir VariantData),
EntryLifetime(NodeId, &'hir Lifetime),
EntryTyParam(NodeId, &'hir TyParam),
EntryVisibility(NodeId, &'hir Visibility),
+ EntryLocal(NodeId, &'hir Local),
/// Roots for node trees.
RootCrate,
NodeLifetime(n) => EntryLifetime(p, n),
NodeTyParam(n) => EntryTyParam(p, n),
NodeVisibility(n) => EntryVisibility(p, n),
+ NodeLocal(n) => EntryLocal(p, n),
}
}
EntryLifetime(id, _) => id,
EntryTyParam(id, _) => id,
EntryVisibility(id, _) => id,
+ EntryLocal(id, _) => id,
NotPresent |
RootCrate => return None,
EntryLifetime(_, n) => NodeLifetime(n),
EntryTyParam(_, n) => NodeTyParam(n),
EntryVisibility(_, n) => NodeVisibility(n),
+ EntryLocal(_, n) => NodeLocal(n),
_ => return None
})
}
EntryStructCtor(p, _) |
EntryLifetime(p, _) |
EntryTyParam(p, _) |
- EntryVisibility(p, _) =>
+ EntryVisibility(p, _) |
+ EntryLocal(p, _) =>
id = p,
EntryExpr(p, _) => {
Some(EntryTyParam(_, ty_param)) => ty_param.span,
Some(EntryVisibility(_, &Visibility::Restricted { ref path, .. })) => path.span,
Some(EntryVisibility(_, v)) => bug!("unexpected Visibility {:?}", v),
+ Some(EntryLocal(_, local)) => local.span,
Some(RootCrate) => self.forest.krate.span,
Some(NotPresent) | None => {
// hir_map to reconstruct their full structure for pretty
// printing.
NodeStructCtor(_) => bug!("cannot print isolated StructCtor"),
+ NodeLocal(a) => self.print_local_decl(&a),
}
}
}
Some(NodeBlock(_)) => {
format!("block {}{}", map.node_to_pretty_string(id), id_str)
}
+ Some(NodeLocal(_)) => {
+ format!("local {}{}", map.node_to_pretty_string(id), id_str)
+ }
Some(NodeStructCtor(_)) => {
format!("struct_ctor {}{}", path_str(), id_str)
}
--- /dev/null
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![deny(unused_variables)]
+
+fn main() {
+ #[allow(unused_variables)]
+ let x = 12;
+}