11//! This file provides API for compiler consumers.
22
33use rustc_hir:: def_id:: LocalDefId ;
4- use rustc_index:: { IndexSlice , IndexVec } ;
4+ use rustc_index:: IndexVec ;
55use rustc_middle:: mir:: { Body , Promoted } ;
66use rustc_middle:: ty:: TyCtxt ;
77
@@ -15,6 +15,7 @@ pub use super::polonius::legacy::{
1515 RichLocation , RustcFacts ,
1616} ;
1717pub use super :: region_infer:: RegionInferenceContext ;
18+ use crate :: BorrowCheckRootCtxt ;
1819
1920/// Options determining the output behavior of [`get_body_with_borrowck_facts`].
2021///
@@ -97,11 +98,9 @@ pub struct BodyWithBorrowckFacts<'tcx> {
9798/// * Polonius is highly unstable, so expect regular changes in its signature or other details.
9899pub fn get_body_with_borrowck_facts (
99100 tcx : TyCtxt < ' _ > ,
100- def : LocalDefId ,
101+ def_id : LocalDefId ,
101102 options : ConsumerOptions ,
102103) -> BodyWithBorrowckFacts < ' _ > {
103- let ( input_body, promoted) = tcx. mir_promoted ( def) ;
104- let input_body: & Body < ' _ > = & input_body. borrow ( ) ;
105- let promoted: & IndexSlice < _ , _ > = & promoted. borrow ( ) ;
106- * super :: do_mir_borrowck ( tcx, input_body, promoted, Some ( options) ) . 1 . unwrap ( )
104+ let mut root_cx = BorrowCheckRootCtxt :: new ( def_id) ;
105+ * root_cx. do_mir_borrowck ( tcx, def_id, Some ( options) ) . 1 . unwrap ( )
107106}
0 commit comments