about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2019-12-22 12:59:15 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2019-12-26 22:50:17 +0100
commitcb8d1c3c65a0ce88df45acb63fbeb31e19de36ea (patch)
tree164ad8909dd5d5563051a20992fe0417b7a31372
parent8a88ff1006189de229c0c92c48e1ddd7a3144e81 (diff)
downloadrust-cb8d1c3c65a0ce88df45acb63fbeb31e19de36ea.tar.gz
rust-cb8d1c3c65a0ce88df45acb63fbeb31e19de36ea.zip
Explain what we are doing with parameter environments for statics
-rw-r--r--src/librustc_mir/interpret/eval_context.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs
index 7a26857c560..76f74a3ecaa 100644
--- a/src/librustc_mir/interpret/eval_context.rs
+++ b/src/librustc_mir/interpret/eval_context.rs
@@ -758,11 +758,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
         &self,
         gid: GlobalId<'tcx>,
     ) -> InterpResult<'tcx, MPlaceTy<'tcx, M::PointerTag>> {
-        // FIXME(oli-obk): make this check an assertion that it's not a static here
-        // FIXME(RalfJ, oli-obk): document that `Place::Static` can never be anything but a static
-        // and `ConstValue::Unevaluated` can never be a static
-        // FIXME(oli-obk, spastorino): the above FIXME is not true anymore, PlaceBase::Static does
-        // not exist anymore (except for promoteds but it's going away soon).
+        // For statics we pick `ParamEnv::reveal_all`, because statics don't have generics
+        // and thus don't care about the parameter environment. While we could just use
+        // `self.param_env`, that would mean we invoke the query to evaluate the static
+        // with different parameter environments, thus causing the static to be evaluated
+        // multiple times.
         let param_env = if self.tcx.is_static(gid.instance.def_id()) {
             ty::ParamEnv::reveal_all()
         } else {