}
}
- /// Returns the name associated with the given `NodeId`'s AST.
- pub fn name(&self, id: NodeId) -> Name {
- let hir_id = self.node_to_hir_id(id);
- self.name_by_hir_id(hir_id)
- }
-
- // FIXME(@ljedrz): replace the `NodeId` variant.
pub fn name_by_hir_id(&self, id: HirId) -> Name {
match self.get_by_hir_id(id) {
Node::Item(i) => i.ident.name,
.flat_map(|v| v.values())
.map(|upvar_id| {
let var_hir_id = upvar_id.var_path.hir_id;
- let var_node_id = tcx.hir().hir_to_node_id(var_hir_id);
let capture = tables.upvar_capture(*upvar_id);
let by_ref = match capture {
ty::UpvarCapture::ByValue => false,
ty::UpvarCapture::ByRef(..) => true,
};
let mut upvar = Upvar {
- name: tcx.hir().name(var_node_id),
+ name: tcx.hir().name_by_hir_id(var_hir_id),
var_hir_id,
by_ref,
mutability: Mutability::Not,