Skip to content

Commit 7f2a4f7

Browse files
varkoryodaldevoid
andcommitted
Add ConstValue::Param and ConstValue::Infer
Co-Authored-By: Gabriel Smith <[email protected]>
1 parent 1ebc858 commit 7f2a4f7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/librustc/mir/interpret/value.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::fmt;
22

3-
use crate::ty::{Ty, layout::{HasDataLayout, Size}};
3+
use crate::ty::{Ty, InferConst, ParamConst, layout::{HasDataLayout, Size}};
44

55
use super::{EvalResult, Pointer, PointerArithmetic, Allocation, AllocId, sign_extend, truncate};
66

@@ -17,6 +17,12 @@ pub struct RawConst<'tcx> {
1717
/// match the `LocalState` optimizations for easy conversions between `Value` and `ConstValue`.
1818
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash)]
1919
pub enum ConstValue<'tcx> {
20+
/// A const generic parameter.
21+
Param(ParamConst),
22+
23+
/// Infer the value of the const.
24+
Infer(InferConst<'tcx>),
25+
2026
/// Used only for types with `layout::abi::Scalar` ABI and ZSTs.
2127
///
2228
/// Not using the enum `Value` to encode that this must not be `Undef`.
@@ -43,6 +49,8 @@ impl<'tcx> ConstValue<'tcx> {
4349
#[inline]
4450
pub fn try_to_scalar(&self) -> Option<Scalar> {
4551
match *self {
52+
ConstValue::Param(_) |
53+
ConstValue::Infer(_) |
4654
ConstValue::ByRef(..) |
4755
ConstValue::Slice(..) => None,
4856
ConstValue::Scalar(val) => Some(val),

0 commit comments

Comments
 (0)