Skip to content

Commit decf37b

Browse files
committed
liveness checking, yeet TypingEnv::from_param_env
1 parent 1ec9648 commit decf37b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

compiler/rustc_passes/src/liveness.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ const ACC_USE: u32 = 4;
468468
struct Liveness<'a, 'tcx> {
469469
ir: &'a mut IrMaps<'tcx>,
470470
typeck_results: &'a ty::TypeckResults<'tcx>,
471-
param_env: ty::ParamEnv<'tcx>,
471+
typing_env: ty::TypingEnv<'tcx>,
472472
closure_min_captures: Option<&'tcx RootVariableMinCaptureList<'tcx>>,
473473
successors: IndexVec<LiveNode, Option<LiveNode>>,
474474
rwu_table: rwu_table::RWUTable,
@@ -491,7 +491,8 @@ struct Liveness<'a, 'tcx> {
491491
impl<'a, 'tcx> Liveness<'a, 'tcx> {
492492
fn new(ir: &'a mut IrMaps<'tcx>, body_owner: LocalDefId) -> Liveness<'a, 'tcx> {
493493
let typeck_results = ir.tcx.typeck(body_owner);
494-
let param_env = ir.tcx.param_env(body_owner);
494+
// FIXME(#132279): we're in a body here.
495+
let typing_env = ty::TypingEnv::non_body_analysis(ir.tcx, body_owner);
495496
let closure_min_captures = typeck_results.closure_min_captures.get(&body_owner);
496497
let closure_ln = ir.add_live_node(ClosureNode);
497498
let exit_ln = ir.add_live_node(ExitNode);
@@ -502,7 +503,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
502503
Liveness {
503504
ir,
504505
typeck_results,
505-
param_env,
506+
typing_env,
506507
closure_min_captures,
507508
successors: IndexVec::from_elem_n(None, num_live_nodes),
508509
rwu_table: rwu_table::RWUTable::new(num_live_nodes, num_vars),
@@ -1297,7 +1298,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
12971298
fn check_is_ty_uninhabited(&mut self, expr: &Expr<'_>, succ: LiveNode) -> LiveNode {
12981299
let ty = self.typeck_results.expr_ty(expr);
12991300
let m = self.ir.tcx.parent_module(expr.hir_id).to_def_id();
1300-
if ty.is_inhabited_from(self.ir.tcx, m, ty::TypingEnv::from_param_env(self.param_env)) {
1301+
if ty.is_inhabited_from(self.ir.tcx, m, self.typing_env) {
13011302
return succ;
13021303
}
13031304
match self.ir.lnks[succ] {

0 commit comments

Comments
 (0)