Skip to content

Commit 8949b44

Browse files
committed
Make check_live_drops into a MirLint.
It's a thin wrapper around `check_live_drops`, but it's enough to fix the FIXME comment.
1 parent 7023402 commit 8949b44

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

compiler/rustc_mir_transform/src/lib.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ mod match_branches;
8787
mod mentioned_items;
8888
mod multiple_return_terminators;
8989
mod nrvo;
90+
mod post_drop_elaboration;
9091
mod prettify;
9192
mod promote_consts;
9293
mod ref_prop;
@@ -480,11 +481,13 @@ pub fn run_analysis_to_runtime_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'
480481
pm::run_passes(
481482
tcx,
482483
body,
483-
&[&remove_uninit_drops::RemoveUninitDrops, &simplify::SimplifyCfg::RemoveFalseEdges],
484+
&[
485+
&remove_uninit_drops::RemoveUninitDrops,
486+
&simplify::SimplifyCfg::RemoveFalseEdges,
487+
&Lint(post_drop_elaboration::CheckLiveDrops),
488+
],
484489
None,
485490
);
486-
// FIXME: make this a MIR lint
487-
check_consts::post_drop_elaboration::check_live_drops(tcx, body);
488491
}
489492

490493
debug!("runtime_mir_lowering({:?})", did);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use rustc_const_eval::check_consts;
2+
use rustc_middle::mir::*;
3+
use rustc_middle::ty::TyCtxt;
4+
5+
use crate::MirLint;
6+
7+
pub(super) struct CheckLiveDrops;
8+
9+
impl<'tcx> MirLint<'tcx> for CheckLiveDrops {
10+
fn run_lint(&self, tcx: TyCtxt<'tcx>, body: &Body<'tcx>) {
11+
check_consts::post_drop_elaboration::check_live_drops(tcx, body);
12+
}
13+
}

0 commit comments

Comments
 (0)