]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_codegen_ssa/mir/operand.rs
Rollup merge of #61389 - Zoxc:arena-cleanup, r=eddyb
[rust.git] / src / librustc_codegen_ssa / mir / operand.rs
index ec471a1323eab917dd548d77c968fadb1b5d1621..0ae2fbe8071adb5787ae3a228094ef4ddacca1af 100644 (file)
@@ -68,11 +68,11 @@ pub fn new_zst<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
     pub fn from_const<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
         bx: &mut Bx,
         val: &'tcx ty::Const<'tcx>
-    ) -> Result<Self, ErrorHandled> {
+    ) -> Self {
         let layout = bx.layout_of(val.ty);
 
         if layout.is_zst() {
-            return Ok(OperandRef::new_zst(bx, layout));
+            return OperandRef::new_zst(bx, layout);
         }
 
         let val = match val.val {
@@ -110,14 +110,14 @@ pub fn from_const<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
                 OperandValue::Pair(a_llval, b_llval)
             },
             ConstValue::ByRef(ptr, alloc) => {
-                return Ok(bx.load_operand(bx.from_const_alloc(layout, alloc, ptr.offset)));
+                return bx.load_operand(bx.from_const_alloc(layout, alloc, ptr.offset));
             },
         };
 
-        Ok(OperandRef {
+        OperandRef {
             val,
             layout
-        })
+        }
     }
 
     /// Asserts that this operand refers to a scalar and returns
@@ -468,7 +468,7 @@ pub fn codegen_operand(
             mir::Operand::Constant(ref constant) => {
                 let ty = self.monomorphize(&constant.ty);
                 self.eval_mir_constant(constant)
-                    .and_then(|c| OperandRef::from_const(bx, c))
+                    .map(|c| OperandRef::from_const(bx, c))
                     .unwrap_or_else(|err| {
                         match err {
                             // errored or at least linted