- match place_base {
- PlaceBase::Static(box Static { kind: StaticKind::Static, def_id, .. }) => {
- debug!("visiting static {:?} @ {:?}", def_id, location);
-
- let tcx = self.tcx;
- let instance = Instance::mono(tcx, *def_id);
- if should_monomorphize_locally(tcx, &instance) {
- self.output.push(MonoItem::Static(*def_id));
- }
- }
- PlaceBase::Static(box Static {
- kind: StaticKind::Promoted(promoted, substs),
- def_id,
- ..
- }) => {
- let instance = Instance::new(*def_id, substs.subst(self.tcx, self.param_substs));
- match self.tcx.const_eval_promoted(instance, *promoted) {
- Ok(val) => collect_const(self.tcx, val, substs, self.output),
- Err(ErrorHandled::Reported) => {}
- Err(ErrorHandled::TooGeneric) => {
- let span = self.tcx.promoted_mir(*def_id)[*promoted].span;
- span_bug!(span, "collection encountered polymorphic constant")
- }
- }
- }
- PlaceBase::Local(_) => {
- // Locals have no relevance for collector.
- }
- }