@@ -632,12 +632,11 @@ impl Map {
632
632
pub fn from_filter < ' tcx > (
633
633
tcx : TyCtxt < ' tcx > ,
634
634
body : & Body < ' tcx > ,
635
- filter : impl Fn ( Ty < ' tcx > ) -> bool ,
635
+ filter : impl Fn ( Local ) -> bool ,
636
636
value_limit : Option < usize > ,
637
637
) -> Self {
638
638
let mut map = Self :: new ( ) ;
639
- let exclude = excluded_locals ( body) ;
640
- map. register_with_filter ( tcx, body, filter, exclude, value_limit) ;
639
+ map. register_with_filter ( tcx, body, filter, value_limit) ;
641
640
debug ! ( "registered {} places ({} nodes in total)" , map. value_count, map. places. len( ) ) ;
642
641
map
643
642
}
@@ -647,16 +646,15 @@ impl Map {
647
646
& mut self ,
648
647
tcx : TyCtxt < ' tcx > ,
649
648
body : & Body < ' tcx > ,
650
- filter : impl Fn ( Ty < ' tcx > ) -> bool ,
651
- exclude : BitSet < Local > ,
649
+ filter : impl Fn ( Local ) -> bool ,
652
650
value_limit : Option < usize > ,
653
651
) {
654
652
let mut worklist = VecDeque :: with_capacity ( value_limit. unwrap_or ( body. local_decls . len ( ) ) ) ;
655
653
656
654
// Start by constructing the places for each bare local.
657
655
self . locals = IndexVec :: from_elem ( None , & body. local_decls ) ;
658
656
for ( local, decl) in body. local_decls . iter_enumerated ( ) {
659
- if exclude . contains ( local) {
657
+ if ! filter ( local) {
660
658
continue ;
661
659
}
662
660
@@ -666,7 +664,7 @@ impl Map {
666
664
self . locals [ local] = Some ( place) ;
667
665
668
666
// And push the eventual children places to the worklist.
669
- self . register_children ( tcx, place, decl. ty , & filter , & mut worklist) ;
667
+ self . register_children ( tcx, place, decl. ty , & mut worklist) ;
670
668
}
671
669
672
670
// `place.elem1.elem2` with type `ty`.
@@ -689,7 +687,7 @@ impl Map {
689
687
}
690
688
691
689
// And push the eventual children places to the worklist.
692
- self . register_children ( tcx, place, ty, & filter , & mut worklist) ;
690
+ self . register_children ( tcx, place, ty, & mut worklist) ;
693
691
}
694
692
695
693
// Pre-compute the tree of ValueIndex nested in each PlaceIndex.
@@ -721,19 +719,18 @@ impl Map {
721
719
tcx : TyCtxt < ' tcx > ,
722
720
place : PlaceIndex ,
723
721
ty : Ty < ' tcx > ,
724
- filter : & impl Fn ( Ty < ' tcx > ) -> bool ,
725
722
worklist : & mut VecDeque < ( PlaceIndex , Option < TrackElem > , TrackElem , Ty < ' tcx > ) > ,
726
723
) {
727
724
// Allocate a value slot if it doesn't have one, and the user requested one.
728
- if self . places [ place] . value_index . is_none ( ) && filter ( ty ) {
725
+ if self . places [ place] . value_index . is_none ( ) && ty . is_scalar ( ) {
729
726
self . places [ place] . value_index = Some ( self . value_count . into ( ) ) ;
730
727
self . value_count += 1 ;
731
728
}
732
729
733
730
// For enums, directly create the `Discriminant`, as that's their main use.
734
731
if ty. is_enum ( ) {
735
732
let discr_ty = ty. discriminant_ty ( tcx) ;
736
- if filter ( discr_ty) {
733
+ if discr_ty. is_scalar ( ) {
737
734
let discr = * self
738
735
. projections
739
736
. entry ( ( place, TrackElem :: Discriminant ) )
0 commit comments