Skip to content

Commit cb8d1c3

Browse files
committed
Explain what we are doing with parameter environments for statics
1 parent 8a88ff1 commit cb8d1c3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc_mir/interpret/eval_context.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -758,11 +758,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
758758
&self,
759759
gid: GlobalId<'tcx>,
760760
) -> InterpResult<'tcx, MPlaceTy<'tcx, M::PointerTag>> {
761-
// FIXME(oli-obk): make this check an assertion that it's not a static here
762-
// FIXME(RalfJ, oli-obk): document that `Place::Static` can never be anything but a static
763-
// and `ConstValue::Unevaluated` can never be a static
764-
// FIXME(oli-obk, spastorino): the above FIXME is not true anymore, PlaceBase::Static does
765-
// not exist anymore (except for promoteds but it's going away soon).
761+
// For statics we pick `ParamEnv::reveal_all`, because statics don't have generics
762+
// and thus don't care about the parameter environment. While we could just use
763+
// `self.param_env`, that would mean we invoke the query to evaluate the static
764+
// with different parameter environments, thus causing the static to be evaluated
765+
// multiple times.
766766
let param_env = if self.tcx.is_static(gid.instance.def_id()) {
767767
ty::ParamEnv::reveal_all()
768768
} else {

0 commit comments

Comments
 (0)