@@ -10,7 +10,7 @@ use rustc_middle::traits::DefiningAnchor;
10
10
use rustc_middle:: ty:: TyCtxt ;
11
11
use std:: rc:: Rc ;
12
12
13
- use crate :: borrow_set:: BorrowSet ;
13
+ use crate :: { borrow_set:: BorrowSet , BorrowCheckResult } ;
14
14
15
15
pub use super :: {
16
16
constraints:: OutlivesConstraint ,
@@ -107,9 +107,18 @@ pub fn get_body_with_borrowck_facts(
107
107
def : LocalDefId ,
108
108
options : ConsumerOptions ,
109
109
) -> 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 > > > ) {
110
119
let ( input_body, promoted) = tcx. mir_promoted ( def) ;
111
120
let infcx = tcx. infer_ctxt ( ) . with_opaque_type_inference ( DefiningAnchor :: Bind ( def) ) . build ( ) ;
112
121
let input_body: & Body < ' _ > = & input_body. borrow ( ) ;
113
122
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) )
115
124
}
0 commit comments