Skip to content

Commit 67197e2

Browse files
committed
Implement only visit_place_base for monomorphize/collector
1 parent cc52746 commit 67197e2

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/librustc_mir/monomorphize/collector.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ use rustc::ty::{self, TypeFoldable, Ty, TyCtxt, GenericParamDefKind, Instance};
185185
use rustc::ty::print::obsolete::DefPathBasedNames;
186186
use rustc::ty::adjustment::{CustomCoerceUnsized, PointerCast};
187187
use rustc::session::config::EntryFnType;
188-
use rustc::mir::{self, Location, Place, PlaceBase, Promoted, Static, StaticKind};
188+
use rustc::mir::{self, Location, PlaceBase, Promoted, Static, StaticKind};
189189
use rustc::mir::visit::Visitor as MirVisitor;
190190
use rustc::mir::mono::{MonoItem, InstantiationMode};
191191
use rustc::mir::interpret::{Scalar, GlobalId, GlobalAlloc, ErrorHandled};
@@ -655,14 +655,12 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
655655
self.super_terminator_kind(kind, location);
656656
}
657657

658-
fn visit_place(&mut self,
659-
place: &mir::Place<'tcx>,
660-
context: mir::visit::PlaceContext,
661-
location: Location) {
662-
match place {
663-
Place::Base(
664-
PlaceBase::Static(box Static{ kind:StaticKind::Static(def_id), .. })
665-
) => {
658+
fn visit_place_base(&mut self,
659+
place_base: &mir::PlaceBase<'tcx>,
660+
_context: mir::visit::PlaceContext,
661+
location: Location) {
662+
match place_base {
663+
PlaceBase::Static(box Static { kind: StaticKind::Static(def_id), .. }) => {
666664
debug!("visiting static {:?} @ {:?}", def_id, location);
667665

668666
let tcx = self.tcx;
@@ -671,10 +669,13 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> {
671669
self.output.push(MonoItem::Static(*def_id));
672670
}
673671
}
674-
_ => {}
672+
PlaceBase::Static(box Static { kind: StaticKind::Promoted(_), .. }) => {
673+
// FIXME: should we handle promoteds here instead of eagerly in collect_neighbours?
674+
}
675+
PlaceBase::Local(_) => {
676+
// Locals have no relevance for collector
677+
}
675678
}
676-
677-
self.super_place(place, context, location);
678679
}
679680
}
680681

0 commit comments

Comments
 (0)