Add PlaceholderConst

This commit is contained in:
varkor 2019-03-12 20:26:16 +00:00
parent f5712d2de0
commit e70797b575
3 changed files with 18 additions and 0 deletions

View File

@ -117,6 +117,7 @@ impl CanonicalVarInfo {
CanonicalVarKind::Region(_) => true,
CanonicalVarKind::PlaceholderRegion(..) => false,
CanonicalVarKind::Const(_) => true,
CanonicalVarKind::PlaceholderConst(_) => false,
}
}
}
@ -142,6 +143,9 @@ pub enum CanonicalVarKind {
/// Some kind of const inference variable.
Const(ty::UniverseIndex),
/// A "placeholder" that represents "any const".
PlaceholderConst(ty::PlaceholderConst),
}
impl CanonicalVarKind {
@ -156,6 +160,7 @@ impl CanonicalVarKind {
CanonicalVarKind::Region(ui) => ui,
CanonicalVarKind::PlaceholderRegion(placeholder) => placeholder.universe,
CanonicalVarKind::Const(ui) => ui,
CanonicalVarKind::PlaceholderConst(placeholder) => placeholder.universe,
}
}
}
@ -405,6 +410,13 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
universe_map(ui),
).into()
}
CanonicalVarKind::PlaceholderConst(
ty::PlaceholderConst { universe, name },
) => {
let _ = (universe, name);
unimplemented!() // FIXME(const_generics)
}
}
}
}

View File

@ -2,6 +2,7 @@ use std::fmt;
use rustc_macros::HashStable;
use crate::ty::{Ty, InferConst, ParamConst, layout::{HasDataLayout, Size}, subst::SubstsRef};
use crate::ty::PlaceholderConst;
use crate::hir::def_id::DefId;
use super::{EvalResult, Pointer, PointerArithmetic, Allocation, AllocId, sign_extend, truncate};
@ -26,6 +27,9 @@ pub enum ConstValue<'tcx> {
/// Infer the value of the const.
Infer(InferConst<'tcx>),
/// A placeholder const - universally quantified higher-ranked const.
Placeholder(PlaceholderConst),
/// Used only for types with `layout::abi::Scalar` ABI and ZSTs.
///
/// Not using the enum `Value` to encode that this must not be `Undef`.

View File

@ -1632,6 +1632,8 @@ pub type PlaceholderRegion = Placeholder<BoundRegion>;
pub type PlaceholderType = Placeholder<BoundVar>;
pub type PlaceholderConst = Placeholder<BoundVar>;
/// When type checking, we use the `ParamEnv` to track
/// details about the set of where-clauses that are in scope at this
/// particular point.