diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-12-14 00:05:28 +0100 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-12-26 22:50:16 +0100 |
| commit | 13694de4a260e461bd832bd7bc09eb7c3a367c2a (patch) | |
| tree | 66eed17dd275e935a6f2ad535db882e9bf47d68c /src | |
| parent | bb1ecee5b6d96a8b045a6f44c85d738429b3d6c4 (diff) | |
| download | rust-13694de4a260e461bd832bd7bc09eb7c3a367c2a.tar.gz rust-13694de4a260e461bd832bd7bc09eb7c3a367c2a.zip | |
Comment on a few odd things that we should look at
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/interpret/eval_context.rs | 2 | ||||
| -rw-r--r-- | src/librustc_mir/interpret/operand.rs | 7 |
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. |
