@@ -103,11 +103,8 @@ pub fn provide(providers: &mut Providers) {
103103}
104104
105105fn mir_borrowck ( tcx : TyCtxt < ' _ > , def : LocalDefId ) -> & BorrowCheckResult < ' _ > {
106- let ( input_body, promoted) = tcx. mir_promoted ( def) ;
107- debug ! ( "run query mir_borrowck: {}" , tcx. def_path_str( def) ) ;
108-
106+ let ( input_body, _) = tcx. mir_promoted ( def) ;
109107 let input_body: & Body < ' _ > = & input_body. borrow ( ) ;
110-
111108 if input_body. should_skip ( ) || input_body. tainted_by_errors . is_some ( ) {
112109 debug ! ( "Skipping borrowck because of injected body or tainted body" ) ;
113110 // Let's make up a borrowck result! Fun times!
@@ -120,7 +117,7 @@ fn mir_borrowck(tcx: TyCtxt<'_>, def: LocalDefId) -> &BorrowCheckResult<'_> {
120117 return tcx. arena . alloc ( result) ;
121118 }
122119
123- let borrowck_result = do_mir_borrowck ( tcx, input_body , & * promoted . borrow ( ) , None ) . 0 ;
120+ let borrowck_result = do_mir_borrowck ( tcx, def , None ) . 0 ;
124121 debug ! ( "mir_borrowck done" ) ;
125122
126123 tcx. arena . alloc ( borrowck_result)
@@ -131,15 +128,16 @@ fn mir_borrowck(tcx: TyCtxt<'_>, def: LocalDefId) -> &BorrowCheckResult<'_> {
131128/// Use `consumer_options: None` for the default behavior of returning
132129/// [`BorrowCheckResult`] only. Otherwise, return [`BodyWithBorrowckFacts`] according
133130/// to the given [`ConsumerOptions`].
134- #[ instrument( skip( tcx, input_body , input_promoted ) , fields ( id=?input_body . source . def_id ( ) ) , level = "debug" ) ]
131+ #[ instrument( skip( tcx) , level = "debug" ) ]
135132fn do_mir_borrowck < ' tcx > (
136133 tcx : TyCtxt < ' tcx > ,
137- input_body : & Body < ' tcx > ,
138- input_promoted : & IndexSlice < Promoted , Body < ' tcx > > ,
134+ def : LocalDefId ,
139135 consumer_options : Option < ConsumerOptions > ,
140136) -> ( BorrowCheckResult < ' tcx > , Option < Box < BodyWithBorrowckFacts < ' tcx > > > ) {
141- let def = input_body. source . def_id ( ) . expect_local ( ) ;
142137 let infcx = BorrowckInferCtxt :: new ( tcx, def) ;
138+ let ( input_body, promoted) = tcx. mir_promoted ( def) ;
139+ let input_body: & Body < ' _ > = & input_body. borrow ( ) ;
140+ let input_promoted: & IndexSlice < _ , _ > = & promoted. borrow ( ) ;
143141 if let Some ( e) = input_body. tainted_by_errors {
144142 infcx. set_tainted_by_errors ( e) ;
145143 }
@@ -499,7 +497,8 @@ impl<'tcx> BorrowckInferCtxt<'tcx> {
499497 )
500498 } ) ;
501499
502- self . inject_new_hidden_type_unchecked ( key, hidden_ty) ;
500+ let prev = self . register_hidden_type_in_storage ( key, hidden_ty) ;
501+ assert_eq ! ( prev, None ) ;
503502 }
504503 }
505504}
0 commit comments