Skip to content
Permalink
Browse files

Burn some invariants we keep up into code

  • Loading branch information...
oli-obk committed Feb 16, 2019
1 parent bd18cc5 commit b2bf37aec075099a8b58c1a52ebca944f318d530
Showing with 3 additions and 3 deletions.
  1. +1 −1 src/librustc_mir/const_eval.rs
  2. +2 −2 src/librustc_mir/interpret/operand.rs
@@ -76,7 +76,7 @@ pub fn op_to_const<'tcx>(
_ => false,
};
let normalized_op = if normalize {
ecx.try_read_immediate(op)?
Ok(*ecx.read_immediate(op).expect("normalization works on validated constants"))
} else {
match *op {
Operand::Indirect(mplace) => Err(mplace),
@@ -269,7 +269,7 @@ pub(super) fn from_known_layout<'tcx>(
impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
/// Try reading an immediate in memory; this is interesting particularly for ScalarPair.
/// Returns `None` if the layout does not permit loading this as a value.
pub(super) fn try_read_immediate_from_mplace(
fn try_read_immediate_from_mplace(
&self,
mplace: MPlaceTy<'tcx, M::PointerTag>,
) -> EvalResult<'tcx, Option<Immediate<M::PointerTag>>> {
@@ -323,7 +323,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
/// Note that for a given layout, this operation will either always fail or always
/// succeed! Whether it succeeds depends on whether the layout can be represented
/// in a `Immediate`, not on which data is stored there currently.
pub(crate) fn try_read_immediate(
pub(super) fn try_read_immediate(
&self,
src: OpTy<'tcx, M::PointerTag>,
) -> EvalResult<'tcx, Result<Immediate<M::PointerTag>, MemPlace<M::PointerTag>>> {

0 comments on commit b2bf37a

Please sign in to comment.
You can’t perform that action at this time.