Skip to content

Commit 13694de

Browse files
committed
Comment on a few odd things that we should look at
1 parent bb1ecee commit 13694de

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/librustc_mir/interpret/eval_context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
761761
// FIXME(oli-obk): make this check an assertion that it's not a static here
762762
// FIXME(RalfJ, oli-obk): document that `Place::Static` can never be anything but a static
763763
// 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).
764766
let param_env = if self.tcx.is_static(gid.instance.def_id()) {
765767
ty::ParamEnv::reveal_all()
766768
} else {

src/librustc_mir/interpret/operand.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -578,13 +578,10 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
578578
ty::ConstKind::Param(_) => throw_inval!(TooGeneric),
579579
ty::ConstKind::Unevaluated(def_id, substs) => {
580580
let instance = self.resolve(def_id, substs)?;
581+
// FIXME: don't use `const_eval_raw` for regular constants, instead use `const_eval`
582+
// which immediately validates the result before we continue with it here.
581583
return Ok(OpTy::from(self.const_eval_raw(GlobalId { instance, promoted: None })?));
582584
}
583-
ty::ConstKind::Infer(..)
584-
| ty::ConstKind::Bound(..)
585-
| ty::ConstKind::Placeholder(..) => {
586-
bug!("eval_const_to_op: Unexpected ConstKind {:?}", val)
587-
}
588585
ty::ConstKind::Value(val_val) => val_val,
589586
};
590587
// Other cases need layout.

0 commit comments

Comments
 (0)