Comment on a few odd things that we should look at

This commit is contained in:
Oliver Scherer 2019-12-14 00:05:28 +01:00
parent bb1ecee5b6
commit 13694de4a2
2 changed files with 4 additions and 5 deletions

View File

@ -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 {

View File

@ -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.