Burn some invariants we keep up into code
This commit is contained in:
parent
bd18cc5708
commit
b2bf37aec0
2 changed files with 3 additions and 3 deletions
|
@ -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>>> {
|
||||
|
|
Loading…
Reference in a new issue