about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-04-23 00:03:00 +0100
committervarkor <github@varkor.com>2019-05-01 23:11:19 +0100
commita29eca5d82d36bdbda5cccf317b9c0b3e33ed23d (patch)
treef0d2f1628a7425966f20da94a04a41365af39210
parentbeb2f84b31efc5cb852f485672d3059acb706a88 (diff)
Fix issue with const params in operand.rs
-rw-r--r--src/librustc_mir/interpret/operand.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs
index df6d4568ab3..ed7c316e3da 100644
--- a/src/librustc_mir/interpret/operand.rs
+++ b/src/librustc_mir/interpret/operand.rs
@@ -524,7 +524,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M>
         layout: Option<TyLayout<'tcx>>,
     ) -> EvalResult<'tcx, OpTy<'tcx, M::PointerTag>> {
         let op = match val.val {
-            ConstValue::Param(_) | ConstValue::Infer(_) | ConstValue::Placeholder(_) => bug!(),
+            ConstValue::Param(_) => return err!(TooGeneric),
+            ConstValue::Infer(_) | ConstValue::Placeholder(_) => bug!(),
             ConstValue::ByRef(ptr, alloc) => {
                 // We rely on mutability being set correctly in that allocation to prevent writes
                 // where none should happen -- and for `static mut`, we copy on demand anyway.