@@ -10,7 +10,7 @@ use rustc_middle::traits::DefiningAnchor;
1010use rustc_middle:: ty:: TyCtxt ;
1111use std:: rc:: Rc ;
1212
13- use crate :: borrow_set:: BorrowSet ;
13+ use crate :: { borrow_set:: BorrowSet , BorrowCheckResult } ;
1414
1515pub use super :: {
1616 constraints:: OutlivesConstraint ,
@@ -107,9 +107,18 @@ pub fn get_body_with_borrowck_facts(
107107 def : LocalDefId ,
108108 options : ConsumerOptions ,
109109) -> BodyWithBorrowckFacts < ' _ > {
110+ * do_mir_borrowck ( tcx, def, options) . 1 . unwrap ( )
111+ }
112+
113+ /// Like [`get_body_with_borrowck_facts`], but also return the borrow check results.
114+ pub fn do_mir_borrowck < ' tcx > (
115+ tcx : TyCtxt < ' tcx > ,
116+ def : LocalDefId ,
117+ options : ConsumerOptions ,
118+ ) -> ( BorrowCheckResult < ' tcx > , Option < Box < BodyWithBorrowckFacts < ' tcx > > > ) {
110119 let ( input_body, promoted) = tcx. mir_promoted ( def) ;
111120 let infcx = tcx. infer_ctxt ( ) . with_opaque_type_inference ( DefiningAnchor :: Bind ( def) ) . build ( ) ;
112121 let input_body: & Body < ' _ > = & input_body. borrow ( ) ;
113122 let promoted: & IndexSlice < _ , _ > = & promoted. borrow ( ) ;
114- * super :: do_mir_borrowck ( & infcx, input_body, promoted, Some ( options) ) . 1 . unwrap ( )
123+ super :: do_mir_borrowck ( & infcx, input_body, promoted, Some ( options) )
115124}
0 commit comments