diff options
| author | varkor <github@varkor.com> | 2019-03-12 20:26:16 +0000 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-05-01 23:10:57 +0100 |
| commit | e70797b575f4806528e24f7316cbfbacb27c6cf2 (patch) | |
| tree | e9cd7f3eef1d950b7021b7ee076784156b92cf43 /src | |
| parent | f5712d2de09e2c35843150b05fdf3672534dff00 (diff) | |
| download | rust-e70797b575f4806528e24f7316cbfbacb27c6cf2.tar.gz rust-e70797b575f4806528e24f7316cbfbacb27c6cf2.zip | |
Add `PlaceholderConst`
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/infer/canonical/mod.rs | 12 | ||||
| -rw-r--r-- | src/librustc/mir/interpret/value.rs | 4 | ||||
| -rw-r--r-- | src/librustc/ty/mod.rs | 2 |
3 files changed, 18 insertions, 0 deletions
diff --git a/src/librustc/infer/canonical/mod.rs b/src/librustc/infer/canonical/mod.rs index e8c881fcae7..9fad1f47f13 100644 --- a/src/librustc/infer/canonical/mod.rs +++ b/src/librustc/infer/canonical/mod.rs @@ -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) + } } } } diff --git a/src/librustc/mir/interpret/value.rs b/src/librustc/mir/interpret/value.rs index 12178196cef..7e45568725f 100644 --- a/src/librustc/mir/interpret/value.rs +++ b/src/librustc/mir/interpret/value.rs @@ -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`. diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 09fd7f2e79a..2cdf718c3ac 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -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. |
