Skip to content

Commit 32b2dac

Browse files
committed
Handle lifetimes in NodeGenericParam also
1 parent 80dbe58 commit 32b2dac

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/librustc/hir/map/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,10 @@ impl<'hir> Map<'hir> {
495495
MacroKind::Bang))
496496
}
497497
NodeGenericParam(param) => {
498-
Some(Def::TyParam(self.local_def_id(param.id)))
498+
Some(match param.kind {
499+
GenericParamKind::Lifetime { .. } => Def::Local(param.id),
500+
GenericParamKind::Type { .. } => Def::TyParam(self.local_def_id(param.id))
501+
})
499502
}
500503
}
501504
}
@@ -975,8 +978,8 @@ impl<'hir> Map<'hir> {
975978
Some(NodeExpr(ref e)) => Some(&*e.attrs),
976979
Some(NodeStmt(ref s)) => Some(s.node.attrs()),
977980
Some(NodeGenericParam(param)) => match param.kind {
981+
GenericParamKind::Lifetime { .. } => None,
978982
GenericParamKind::Type { ref attrs, .. } => Some(&attrs[..]),
979-
_ => bug!("unexpected non-type NodeGenericParam")
980983
}
981984
// unit/tuple structs take the attributes straight from
982985
// the struct definition.
@@ -1375,7 +1378,7 @@ fn node_id_to_string(map: &Map, id: NodeId, include_id: bool) -> String {
13751378
format!("lifetime {}{}", map.node_to_pretty_string(id), id_str)
13761379
}
13771380
Some(NodeGenericParam(ref param)) => {
1378-
format!("genericparam {:?}{}", param, id_str)
1381+
format!("generic_param {:?}{}", param, id_str)
13791382
}
13801383
Some(NodeVisibility(ref vis)) => {
13811384
format!("visibility {:?}{}", vis, id_str)

0 commit comments

Comments
 (0)