Skip to content

Commit e6793ac

Browse files
committed
have borrowck fetch MIR, which will perform some errors
1 parent 15bc2f4 commit e6793ac

File tree

1 file changed

+10
-0
lines changed
  • src/librustc_borrowck/borrowck

1 file changed

+10
-0
lines changed

src/librustc_borrowck/borrowck/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId) {
109109

110110
if bccx.tcx.has_attr(owner_def_id, "rustc_mir_borrowck") {
111111
mir::borrowck_mir(bccx, owner_id, &attributes);
112+
} else {
113+
// Eventually, borrowck will always read the MIR, but at the
114+
// moment we do not. So, for now, we always force MIR to be
115+
// constructed for a given fn, since this may result in errors
116+
// being reported and we want that to happen.
117+
//
118+
// Note that `mir_validated` is a "stealable" result; the
119+
// thief, `optimized_mir()`, forces borrowck, so we know that
120+
// is not yet stolen.
121+
tcx.mir_validated(owner_def_id).borrow();
112122
}
113123

114124
let cfg = cfg::CFG::new(bccx.tcx, &body);

0 commit comments

Comments
 (0)