Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
match cx.map.find(id) {
Some(ast_map::NodeImplItem(ref impl_item)) => {
Expand Down Expand Up @@ -1341,7 +1342,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
}
_ => {
cx.sess.span_bug(item.span,
"ParameterEnvironment::from_item():
"ParameterEnvironment::for_item():
can't create a parameter \
environment for this kind of item")
}
Expand All @@ -1352,7 +1353,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
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",
cx.map.node_to_string(id)))
}
Expand Down