From 6005b0ad2fc1398d7d4f757cc96eb783ee8fc1ac Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Mon, 25 Jun 2018 17:41:20 +0200 Subject: Move the Lrc outside the error type and name the fields --- src/librustc_codegen_llvm/mir/constant.rs | 9 +++++---- src/librustc_codegen_llvm/mir/operand.rs | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/librustc_codegen_llvm') diff --git a/src/librustc_codegen_llvm/mir/constant.rs b/src/librustc_codegen_llvm/mir/constant.rs index 7c1035e2fcb..fc219df9b04 100644 --- a/src/librustc_codegen_llvm/mir/constant.rs +++ b/src/librustc_codegen_llvm/mir/constant.rs @@ -14,6 +14,7 @@ use rustc_mir::interpret::{read_target_uint, const_val_field}; use rustc::hir::def_id::DefId; use rustc::mir; use rustc_data_structures::indexed_vec::Idx; +use rustc_data_structures::sync::Lrc; use rustc::mir::interpret::{GlobalId, Pointer, Scalar, Allocation, ConstValue, AllocType}; use rustc::ty::{self, Ty}; use rustc::ty::layout::{self, HasDataLayout, LayoutOf, Size}; @@ -117,7 +118,7 @@ pub fn const_alloc_to_llvm(cx: &CodegenCx, alloc: &Allocation) -> ValueRef { pub fn codegen_static_initializer<'a, 'tcx>( cx: &CodegenCx<'a, 'tcx>, def_id: DefId) - -> Result> + -> Result>> { let instance = ty::Instance::mono(cx.tcx, def_id); let cid = GlobalId { @@ -139,7 +140,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { &mut self, bx: &Builder<'a, 'tcx>, constant: &'tcx ty::Const<'tcx>, - ) -> Result, ConstEvalErr<'tcx>> { + ) -> Result, Lrc>> { match constant.val { ConstVal::Unevaluated(def_id, ref substs) => { let tcx = bx.tcx(); @@ -160,7 +161,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { &mut self, bx: &Builder<'a, 'tcx>, constant: &mir::Constant<'tcx>, - ) -> Result, ConstEvalErr<'tcx>> { + ) -> Result, Lrc>> { match constant.literal { mir::Literal::Promoted { index } => { let param_env = ty::ParamEnv::reveal_all(); @@ -189,7 +190,7 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> { ty::TyArray(_, n) => n.unwrap_usize(bx.tcx()), ref other => bug!("invalid simd shuffle type: {}", other), }; - let values: Result, _> = (0..fields).map(|field| { + let values: Result, Lrc<_>> = (0..fields).map(|field| { let field = const_val_field( bx.tcx(), ty::ParamEnv::reveal_all(), diff --git a/src/librustc_codegen_llvm/mir/operand.rs b/src/librustc_codegen_llvm/mir/operand.rs index 9f32b41cb13..0381a5e2987 100644 --- a/src/librustc_codegen_llvm/mir/operand.rs +++ b/src/librustc_codegen_llvm/mir/operand.rs @@ -15,6 +15,7 @@ use rustc::mir::interpret::ConstValue; use rustc::ty; use rustc::ty::layout::{self, Align, LayoutOf, TyLayout}; use rustc_data_structures::indexed_vec::Idx; +use rustc_data_structures::sync::Lrc; use base; use common::{self, CodegenCx, C_null, C_undef, C_usize}; @@ -97,7 +98,7 @@ impl<'a, 'tcx> OperandRef<'tcx> { pub fn from_const(bx: &Builder<'a, 'tcx>, val: ConstValue<'tcx>, ty: ty::Ty<'tcx>) - -> Result, ConstEvalErr<'tcx>> { + -> Result, Lrc>> { let layout = bx.cx.layout_of(ty); if layout.is_zst() { -- cgit 1.4.1-3-g733a5