args: I) -> CFGIndex {
let func_or_rcvr_exit = self.expr(func_or_rcvr, pred);
let ret = self.straightline(call_expr, func_or_rcvr_exit, args);
- if self.tables.expr_ty(call_expr).conservative_is_uninhabited(self.tcx) {
+ let m = self.tcx.hir.get_module_parent(call_expr.id);
+ if self.tcx.is_ty_uninhabited_from(m, self.tables.expr_ty(call_expr)) {
self.add_unreachable_node()
} else {
ret
let layout = cx.layout_raw_uncached(ty);
// Type-level uninhabitedness should always imply ABI uninhabitedness.
if let Ok(layout) = layout {
- if ty.conservative_is_uninhabited(tcx) {
+ if ty.conservative_is_privately_uninhabited(tcx) {
assert!(layout.abi.is_uninhabited());
}
}
let size = element.size.checked_mul(count, dl)
.ok_or(LayoutError::SizeOverflow(ty))?;
- let abi = if count != 0 && ty.conservative_is_uninhabited(tcx) {
+ let abi = if count != 0 && ty.conservative_is_privately_uninhabited(tcx) {
Abi::Uninhabited
} else {
Abi::Aggregate { sized: true }
/// Checks whether a type is definitely uninhabited. This is
/// conservative: for some types that are uninhabited we return `false`,
/// but we only return `true` for types that are definitely uninhabited.
- /// `ty.conservative_is_uninhabited` implies that any value of type `ty`
+ /// `ty.conservative_is_privately_uninhabited` implies that any value of type `ty`
/// will be `Abi::Uninhabited`. (Note that uninhabited types may have nonzero
/// size, to account for partial initialisation. See #49298 for details.)
- pub fn conservative_is_uninhabited(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> bool {
+ pub fn conservative_is_privately_uninhabited(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> bool {
// FIXME(varkor): we can make this less conversative by substituting concrete
// type arguments.
match self.sty {
// one uninhabited field.
def.variants.iter().all(|var| {
var.fields.iter().any(|field| {
- tcx.type_of(field.did).conservative_is_uninhabited(tcx)
+ tcx.type_of(field.did).conservative_is_privately_uninhabited(tcx)
})
})
}
- ty::Tuple(tys) => tys.iter().any(|ty| ty.conservative_is_uninhabited(tcx)),
+ ty::Tuple(tys) => tys.iter().any(|ty| ty.conservative_is_privately_uninhabited(tcx)),
ty::Array(ty, len) => {
match len.assert_usize(tcx) {
// If the array is definitely non-empty, it's uninhabited if
// the type of its elements is uninhabited.
- Some(n) if n != 0 => ty.conservative_is_uninhabited(tcx),
+ Some(n) if n != 0 => ty.conservative_is_privately_uninhabited(tcx),
_ => false
}
}
}
}
None => {
- if !sig.output().conservative_is_uninhabited(self.tcx()) {
+ if !sig.output().conservative_is_privately_uninhabited(self.tcx()) {
span_mirbug!(self, term, "call to converging function {:?} w/o dest", sig);
}
}
func: fun,
args,
cleanup: Some(cleanup),
- destination: if expr.ty.conservative_is_uninhabited(this.hir.tcx()) {
- None
- } else {
- Some((destination.clone(), success))
- },
+ destination:
+ if expr.ty.conservative_is_privately_uninhabited(this.hir.tcx()) {
+ None
+ } else {
+ Some((destination.clone(), success))
+ },
from_hir_call,
},
);
});
let rvalue = unpack!(block = this.as_local_rvalue(block, expr));
- this.cfg
- .push_assign(block, source_info, destination, rvalue);
+ this.cfg.push_assign(block, source_info, destination, rvalue);
block.unit()
}
};
let scrutinee_is_uninhabited = if self.tcx.features().exhaustive_patterns {
self.tcx.is_ty_uninhabited_from(module, pat_ty)
} else {
- pat_ty.conservative_is_uninhabited(self.tcx)
+ pat_ty.is_never()
};
if !scrutinee_is_uninhabited {
// We know the type is inhabited, so this must be wrong