1
1
//! This file provides API for compiler consumers.
2
2
3
3
use rustc_hir:: def_id:: LocalDefId ;
4
- use rustc_index:: { IndexSlice , IndexVec } ;
4
+ use rustc_index:: IndexVec ;
5
5
use rustc_middle:: mir:: { Body , Promoted } ;
6
6
use rustc_middle:: ty:: TyCtxt ;
7
7
@@ -15,6 +15,7 @@ pub use super::polonius::legacy::{
15
15
RichLocation , RustcFacts ,
16
16
} ;
17
17
pub use super :: region_infer:: RegionInferenceContext ;
18
+ use crate :: BorrowCheckRootCtxt ;
18
19
19
20
/// Options determining the output behavior of [`get_body_with_borrowck_facts`].
20
21
///
@@ -97,11 +98,9 @@ pub struct BodyWithBorrowckFacts<'tcx> {
97
98
/// * Polonius is highly unstable, so expect regular changes in its signature or other details.
98
99
pub fn get_body_with_borrowck_facts (
99
100
tcx : TyCtxt < ' _ > ,
100
- def : LocalDefId ,
101
+ def_id : LocalDefId ,
101
102
options : ConsumerOptions ,
102
103
) -> 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 ( )
107
106
}
0 commit comments