diff options
| author | Cameron Steffen <cam.steffen94@gmail.com> | 2022-10-23 17:32:17 -0500 |
|---|---|---|
| committer | Cameron Steffen <cam.steffen94@gmail.com> | 2022-11-20 19:04:11 -0600 |
| commit | 34cbe727806429a8a034f492cff1b588e70c33dc (patch) | |
| tree | 0d5c6dd103d328d15e85bf204afbc6b9a5f53211 /compiler/rustc_passes/src | |
| parent | a6d96f9fd7ca154fe2840a4d0dc6d6ce315b000e (diff) | |
| download | rust-34cbe727806429a8a034f492cff1b588e70c33dc.tar.gz rust-34cbe727806429a8a034f492cff1b588e70c33dc.zip | |
Change to Ty::is_inhabited_from
Diffstat (limited to 'compiler/rustc_passes/src')
| -rw-r--r-- | compiler/rustc_passes/src/liveness.rs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/compiler/rustc_passes/src/liveness.rs b/compiler/rustc_passes/src/liveness.rs index 0100860afb9..58e1fe937a6 100644 --- a/compiler/rustc_passes/src/liveness.rs +++ b/compiler/rustc_passes/src/liveness.rs @@ -1284,20 +1284,19 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { fn check_is_ty_uninhabited(&mut self, expr: &Expr<'_>, succ: LiveNode) -> LiveNode { let ty = self.typeck_results.expr_ty(expr); let m = self.ir.tcx.parent_module(expr.hir_id).to_def_id(); - if self.ir.tcx.is_ty_uninhabited_from(m, ty, self.param_env) { - match self.ir.lnks[succ] { - LiveNodeKind::ExprNode(succ_span, succ_id) => { - self.warn_about_unreachable(expr.span, ty, succ_span, succ_id, "expression"); - } - LiveNodeKind::VarDefNode(succ_span, succ_id) => { - self.warn_about_unreachable(expr.span, ty, succ_span, succ_id, "definition"); - } - _ => {} - }; - self.exit_ln - } else { - succ + if ty.is_inhabited_from(self.ir.tcx, m, self.param_env) { + return succ; } + match self.ir.lnks[succ] { + LiveNodeKind::ExprNode(succ_span, succ_id) => { + self.warn_about_unreachable(expr.span, ty, succ_span, succ_id, "expression"); + } + LiveNodeKind::VarDefNode(succ_span, succ_id) => { + self.warn_about_unreachable(expr.span, ty, succ_span, succ_id, "definition"); + } + _ => {} + }; + self.exit_ln } fn warn_about_unreachable( |
