diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-04-03 15:29:31 +0200 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-05-25 10:07:01 +0200 |
| commit | e694b63cd147512ad5e73ff4f9bee057e0c27c19 (patch) | |
| tree | bdf2dad3178352604ed4ea3d1f8b6923125c70e2 /src/librustc_codegen_ssa | |
| parent | 9d82107f16185987048fdf06dae59efe3cf60924 (diff) | |
| download | rust-e694b63cd147512ad5e73ff4f9bee057e0c27c19.tar.gz rust-e694b63cd147512ad5e73ff4f9bee057e0c27c19.zip | |
Don't use `ty::Const` without immediately interning
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/mir/constant.rs | 6 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/mir/operand.rs | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_codegen_ssa/mir/constant.rs b/src/librustc_codegen_ssa/mir/constant.rs index 3f8dc420cf4..eaa1dd186a5 100644 --- a/src/librustc_codegen_ssa/mir/constant.rs +++ b/src/librustc_codegen_ssa/mir/constant.rs @@ -13,7 +13,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { pub fn eval_mir_constant( &mut self, constant: &mir::Constant<'tcx>, - ) -> Result<ty::Const<'tcx>, ErrorHandled> { + ) -> Result<&'tcx ty::Const<'tcx>, ErrorHandled> { match constant.literal.val { mir::interpret::ConstValue::Unevaluated(def_id, ref substs) => { let substs = self.monomorphize(substs); @@ -26,7 +26,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { }; self.cx.tcx().const_eval(ty::ParamEnv::reveal_all().and(cid)) }, - _ => Ok(*self.monomorphize(&constant.literal)), + _ => Ok(self.monomorphize(&constant.literal)), } } @@ -36,7 +36,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { bx: &Bx, span: Span, ty: Ty<'tcx>, - constant: Result<ty::Const<'tcx>, ErrorHandled>, + constant: Result<&'tcx ty::Const<'tcx>, ErrorHandled>, ) -> (Bx::Value, Ty<'tcx>) { constant .map(|c| { diff --git a/src/librustc_codegen_ssa/mir/operand.rs b/src/librustc_codegen_ssa/mir/operand.rs index 3db05b7214d..75f0c6a6c53 100644 --- a/src/librustc_codegen_ssa/mir/operand.rs +++ b/src/librustc_codegen_ssa/mir/operand.rs @@ -67,7 +67,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> OperandRef<'tcx, V> { pub fn from_const<Bx: BuilderMethods<'a, 'tcx, Value = V>>( bx: &mut Bx, - val: ty::Const<'tcx> + val: &'tcx ty::Const<'tcx> ) -> Result<Self, ErrorHandled> { let layout = bx.layout_of(val.ty); |
