match tcx.named_region_map.find(¶m_id) {
Some(&rl::DefEarlyBoundRegion(_, _, lifetime_decl_id))
=> lifetime_decl_id,
- Some(_) => fail!("should not encounter non early-bound cases"),
+ Some(_) => panic!("should not encounter non early-bound cases"),
// The lookup should only fail when `param_id` is
// itself a lifetime binding: use it as the decl_id.
assert!(is_lifetime(&tcx.map, param_id));
let parent_id = tcx.map.get_parent(decl_id);
let parent = tcx.map.find(parent_id).unwrap_or_else(
- || fail!("tcx.map missing entry for id: {}", parent_id));
+ || panic!("tcx.map missing entry for id: {}", parent_id));
let is_inferred;
macro_rules! cannot_happen { () => { {
- fail!("invalid parent: {:s} for {:s}",
+ panic!("invalid parent: {:s} for {:s}",
tcx.map.node_to_string(parent_id),
tcx.map.node_to_string(param_id));
} } }
debug!("add_constraints_from_ty(ty={})", ty.repr(self.tcx()));
match ty::get(ty).sty {
- ty::ty_nil | ty::ty_bot | ty::ty_bool |
+ ty::ty_nil | ty::ty_bool |
ty::ty_char | ty::ty_int(_) | ty::ty_uint(_) |
ty::ty_float(_) | ty::ty_str => {
/* leaf type -- noop */
}
- ty::ty_unboxed_closure(_, region) => {
- let contra = self.contravariant(variance);
- self.add_constraints_from_region(region, contra);
+ ty::ty_unboxed_closure(..) => {
+ self.tcx().sess.bug("Unexpected unboxed closure type in variance computation");
}
ty::ty_rptr(region, ref mt) => {
for &input in sig.inputs.iter() {
self.add_constraints_from_ty(input, contra);
}
- self.add_constraints_from_ty(sig.output, variance);
+ if let ty::FnConverging(result_type) = sig.output {
+ self.add_constraints_from_ty(result_type, variance);
+ }
}
/// Adds constraints appropriate for a region appearing in a