Auto merge of #32521 - Manishearth:paramitem, r=eddyb

Doc fixes for ParameterEnvironment

r? @eddyb
This commit is contained in:
bors 2016-03-27 02:36:26 -07:00
commit abb3a107e4

View File

@ -1202,6 +1202,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
} }
} }
/// Construct a parameter environment given an item, impl item, or trait item
pub fn for_item(cx: &'a TyCtxt<'tcx>, id: NodeId) -> ParameterEnvironment<'a, 'tcx> { pub fn for_item(cx: &'a TyCtxt<'tcx>, id: NodeId) -> ParameterEnvironment<'a, 'tcx> {
match cx.map.find(id) { match cx.map.find(id) {
Some(ast_map::NodeImplItem(ref impl_item)) => { Some(ast_map::NodeImplItem(ref impl_item)) => {
@ -1341,7 +1342,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
} }
_ => { _ => {
cx.sess.span_bug(item.span, cx.sess.span_bug(item.span,
"ParameterEnvironment::from_item(): "ParameterEnvironment::for_item():
can't create a parameter \ can't create a parameter \
environment for this kind of item") environment for this kind of item")
} }
@ -1352,7 +1353,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
ParameterEnvironment::for_item(cx, cx.map.get_parent(id)) ParameterEnvironment::for_item(cx, cx.map.get_parent(id))
} }
_ => { _ => {
cx.sess.bug(&format!("ParameterEnvironment::from_item(): \ cx.sess.bug(&format!("ParameterEnvironment::for_item(): \
`{}` is not an item", `{}` is not an item",
cx.map.node_to_string(id))) cx.map.node_to_string(id)))
} }