@@ -64,7 +64,7 @@ impl Qualifs<'a, 'mir, 'tcx> {
6464 /// Returns `true` if `local` is `NeedsDrop` at the given `Location`.
6565 ///
6666 /// Only updates the cursor if absolutely necessary
67- fn needs_drop_lazy_seek ( & mut self , local : Local , location : Location ) -> bool {
67+ fn needs_drop ( & mut self , local : Local , location : Location ) -> bool {
6868 if !self . needs_drop . in_any_value_of_ty . contains ( local) {
6969 return false ;
7070 }
@@ -76,7 +76,7 @@ impl Qualifs<'a, 'mir, 'tcx> {
7676 /// Returns `true` if `local` is `HasMutInterior` at the given `Location`.
7777 ///
7878 /// Only updates the cursor if absolutely necessary.
79- fn has_mut_interior_lazy_seek ( & mut self , local : Local , location : Location ) -> bool {
79+ fn has_mut_interior ( & mut self , local : Local , location : Location ) -> bool {
8080 if !self . has_mut_interior . in_any_value_of_ty . contains ( local) {
8181 return false ;
8282 }
@@ -86,17 +86,6 @@ impl Qualifs<'a, 'mir, 'tcx> {
8686 || self . indirectly_mutable ( local, location)
8787 }
8888
89- /// Returns `true` if `local` is `HasMutInterior`, but requires the `has_mut_interior` and
90- /// `indirectly_mutable` cursors to be updated beforehand.
91- fn has_mut_interior_eager_seek ( & self , local : Local ) -> bool {
92- if !self . has_mut_interior . in_any_value_of_ty . contains ( local) {
93- return false ;
94- }
95-
96- self . has_mut_interior . cursor . get ( ) . contains ( local)
97- || self . indirectly_mutable . get ( ) . contains ( local)
98- }
99-
10089 fn in_return_place ( & mut self , item : & Item < ' _ , ' tcx > ) -> ConstQualifs {
10190 // Find the `Return` terminator if one exists.
10291 //
@@ -120,8 +109,8 @@ impl Qualifs<'a, 'mir, 'tcx> {
120109 let return_loc = item. body . terminator_loc ( return_block) ;
121110
122111 ConstQualifs {
123- needs_drop : self . needs_drop_lazy_seek ( RETURN_PLACE , return_loc) ,
124- has_mut_interior : self . has_mut_interior_lazy_seek ( RETURN_PLACE , return_loc) ,
112+ needs_drop : self . needs_drop ( RETURN_PLACE , return_loc) ,
113+ has_mut_interior : self . has_mut_interior ( RETURN_PLACE , return_loc) ,
125114 }
126115 }
127116}
@@ -246,14 +235,9 @@ impl Validator<'a, 'mir, 'tcx> {
246235 }
247236
248237 fn check_immutable_borrow_like ( & mut self , location : Location , place : & Place < ' tcx > ) {
249- // FIXME: Change the `in_*` methods to take a `FnMut` so we don't have to manually
250- // seek the cursors beforehand.
251- self . qualifs . has_mut_interior . cursor . seek_before ( location) ;
252- self . qualifs . indirectly_mutable . seek ( location) ;
253-
254238 let borrowed_place_has_mut_interior = HasMutInterior :: in_place (
255239 & self . item ,
256- & mut |local| self . qualifs . has_mut_interior_eager_seek ( local) ,
240+ & mut |local| self . qualifs . has_mut_interior ( local, location ) ,
257241 place. as_ref ( ) ,
258242 ) ;
259243
@@ -571,7 +555,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
571555 let needs_drop = if let Some ( local) = dropped_place. as_local ( ) {
572556 // Use the span where the local was declared as the span of the drop error.
573557 err_span = self . body . local_decls [ local] . source_info . span ;
574- self . qualifs . needs_drop_lazy_seek ( local, location)
558+ self . qualifs . needs_drop ( local, location)
575559 } else {
576560 true
577561 } ;
0 commit comments