diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-04-22 13:53:52 +0200 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-05-30 11:19:22 +0200 |
| commit | 5b9848912a85e28d000602fc2e81bad9c2f2a981 (patch) | |
| tree | 7d6a280aec9b093ac0da7313e4533795cebb866f /src/librustc_codegen_ssa | |
| parent | 14178efa5dd48968c951b3266c6a9bebcd914884 (diff) | |
| download | rust-5b9848912a85e28d000602fc2e81bad9c2f2a981.tar.gz rust-5b9848912a85e28d000602fc2e81bad9c2f2a981.zip | |
Make the `type_name` intrinsic's output deterministic
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/mir/operand.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/librustc_codegen_ssa/mir/operand.rs b/src/librustc_codegen_ssa/mir/operand.rs index ec471a1323e..0ae2fbe8071 100644 --- a/src/librustc_codegen_ssa/mir/operand.rs +++ b/src/librustc_codegen_ssa/mir/operand.rs @@ -68,11 +68,11 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, 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 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, 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 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { 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 |
