about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2019-12-14 00:05:28 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2019-12-26 22:50:16 +0100
commit13694de4a260e461bd832bd7bc09eb7c3a367c2a (patch)
tree66eed17dd275e935a6f2ad535db882e9bf47d68c
parentbb1ecee5b6d96a8b045a6f44c85d738429b3d6c4 (diff)
downloadrust-13694de4a260e461bd832bd7bc09eb7c3a367c2a.tar.gz
rust-13694de4a260e461bd832bd7bc09eb7c3a367c2a.zip
Comment on a few odd things that we should look at
-rw-r--r--src/librustc_mir/interpret/eval_context.rs2
-rw-r--r--src/librustc_mir/interpret/operand.rs7
2 files changed, 4 insertions, 5 deletions
diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs
index 5ba9dcd3aa5..7a26857c560 100644
--- a/src/librustc_mir/interpret/eval_context.rs
+++ b/src/librustc_mir/interpret/eval_context.rs
@@ -761,6 +761,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
         // 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).
         let param_env = if self.tcx.is_static(gid.instance.def_id()) {
             ty::ParamEnv::reveal_all()
         } else {
diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs
index a89abe71c65..82974f338d2 100644
--- a/src/librustc_mir/interpret/operand.rs
+++ b/src/librustc_mir/interpret/operand.rs
@@ -578,13 +578,10 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
             ty::ConstKind::Param(_) => throw_inval!(TooGeneric),
             ty::ConstKind::Unevaluated(def_id, substs) => {
                 let instance = self.resolve(def_id, substs)?;
+                // FIXME: don't use `const_eval_raw` for regular constants, instead use `const_eval`
+                // which immediately validates the result before we continue with it here.
                 return Ok(OpTy::from(self.const_eval_raw(GlobalId { instance, promoted: None })?));
             }
-            ty::ConstKind::Infer(..)
-            | ty::ConstKind::Bound(..)
-            | ty::ConstKind::Placeholder(..) => {
-                bug!("eval_const_to_op: Unexpected ConstKind {:?}", val)
-            }
             ty::ConstKind::Value(val_val) => val_val,
         };
         // Other cases need layout.