@@ -103,11 +103,8 @@ pub fn provide(providers: &mut Providers) {
103
103
}
104
104
105
105
fn 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) ;
109
107
let input_body: & Body < ' _ > = & input_body. borrow ( ) ;
110
-
111
108
if input_body. should_skip ( ) || input_body. tainted_by_errors . is_some ( ) {
112
109
debug ! ( "Skipping borrowck because of injected body or tainted body" ) ;
113
110
// Let's make up a borrowck result! Fun times!
@@ -120,7 +117,7 @@ fn mir_borrowck(tcx: TyCtxt<'_>, def: LocalDefId) -> &BorrowCheckResult<'_> {
120
117
return tcx. arena . alloc ( result) ;
121
118
}
122
119
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 ;
124
121
debug ! ( "mir_borrowck done" ) ;
125
122
126
123
tcx. arena . alloc ( borrowck_result)
@@ -131,15 +128,16 @@ fn mir_borrowck(tcx: TyCtxt<'_>, def: LocalDefId) -> &BorrowCheckResult<'_> {
131
128
/// Use `consumer_options: None` for the default behavior of returning
132
129
/// [`BorrowCheckResult`] only. Otherwise, return [`BodyWithBorrowckFacts`] according
133
130
/// 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" ) ]
135
132
fn do_mir_borrowck < ' tcx > (
136
133
tcx : TyCtxt < ' tcx > ,
137
- input_body : & Body < ' tcx > ,
138
- input_promoted : & IndexSlice < Promoted , Body < ' tcx > > ,
134
+ def : LocalDefId ,
139
135
consumer_options : Option < ConsumerOptions > ,
140
136
) -> ( BorrowCheckResult < ' tcx > , Option < Box < BodyWithBorrowckFacts < ' tcx > > > ) {
141
- let def = input_body. source . def_id ( ) . expect_local ( ) ;
142
137
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 ( ) ;
143
141
if let Some ( e) = input_body. tainted_by_errors {
144
142
infcx. set_tainted_by_errors ( e) ;
145
143
}
@@ -499,7 +497,8 @@ impl<'tcx> BorrowckInferCtxt<'tcx> {
499
497
)
500
498
} ) ;
501
499
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 ) ;
503
502
}
504
503
}
505
504
}
0 commit comments