]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_mir_transform/src/const_prop.rs
Rollup merge of #105004 - TaKO8Ki:fix-104897, r=wesleywiser
[rust.git] / compiler / rustc_mir_transform / src / const_prop.rs
index 3f5890040c394112e9afab059c7d3db0990f4493..b0514e033566c9a65ebe8f5484a41d74ddb39898 100644 (file)
@@ -3,6 +3,8 @@
 
 use std::cell::Cell;
 
+use either::Right;
+
 use rustc_ast::Mutability;
 use rustc_data_structures::fx::FxHashSet;
 use rustc_hir::def::DefKind;
@@ -429,7 +431,7 @@ fn get_const(&self, place: Place<'tcx>) -> Option<OpTy<'tcx>> {
         // Try to read the local as an immediate so that if it is representable as a scalar, we can
         // handle it as such, but otherwise, just return the value as is.
         Some(match self.ecx.read_immediate_raw(&op) {
-            Ok(Ok(imm)) => imm.into(),
+            Ok(Right(imm)) => imm.into(),
             _ => op,
         })
     }
@@ -743,7 +745,7 @@ fn replace_with_const(
         // FIXME> figure out what to do when read_immediate_raw fails
         let imm = self.use_ecx(|this| this.ecx.read_immediate_raw(value));
 
-        if let Some(Ok(imm)) = imm {
+        if let Some(Right(imm)) = imm {
             match *imm {
                 interpret::Immediate::Scalar(scalar) => {
                     *rval = Rvalue::Use(self.operand_from_scalar(