Skip to content

Commit e70797b

Browse files
committed
Add PlaceholderConst
1 parent f5712d2 commit e70797b

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/librustc/infer/canonical/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ impl CanonicalVarInfo {
117117
CanonicalVarKind::Region(_) => true,
118118
CanonicalVarKind::PlaceholderRegion(..) => false,
119119
CanonicalVarKind::Const(_) => true,
120+
CanonicalVarKind::PlaceholderConst(_) => false,
120121
}
121122
}
122123
}
@@ -142,6 +143,9 @@ pub enum CanonicalVarKind {
142143

143144
/// Some kind of const inference variable.
144145
Const(ty::UniverseIndex),
146+
147+
/// A "placeholder" that represents "any const".
148+
PlaceholderConst(ty::PlaceholderConst),
145149
}
146150

147151
impl CanonicalVarKind {
@@ -156,6 +160,7 @@ impl CanonicalVarKind {
156160
CanonicalVarKind::Region(ui) => ui,
157161
CanonicalVarKind::PlaceholderRegion(placeholder) => placeholder.universe,
158162
CanonicalVarKind::Const(ui) => ui,
163+
CanonicalVarKind::PlaceholderConst(placeholder) => placeholder.universe,
159164
}
160165
}
161166
}
@@ -405,6 +410,13 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
405410
universe_map(ui),
406411
).into()
407412
}
413+
414+
CanonicalVarKind::PlaceholderConst(
415+
ty::PlaceholderConst { universe, name },
416+
) => {
417+
let _ = (universe, name);
418+
unimplemented!() // FIXME(const_generics)
419+
}
408420
}
409421
}
410422
}

src/librustc/mir/interpret/value.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use std::fmt;
22
use rustc_macros::HashStable;
33

44
use crate::ty::{Ty, InferConst, ParamConst, layout::{HasDataLayout, Size}, subst::SubstsRef};
5+
use crate::ty::PlaceholderConst;
56
use crate::hir::def_id::DefId;
67

78
use super::{EvalResult, Pointer, PointerArithmetic, Allocation, AllocId, sign_extend, truncate};
@@ -26,6 +27,9 @@ pub enum ConstValue<'tcx> {
2627
/// Infer the value of the const.
2728
Infer(InferConst<'tcx>),
2829

30+
/// A placeholder const - universally quantified higher-ranked const.
31+
Placeholder(PlaceholderConst),
32+
2933
/// Used only for types with `layout::abi::Scalar` ABI and ZSTs.
3034
///
3135
/// Not using the enum `Value` to encode that this must not be `Undef`.

src/librustc/ty/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,6 +1632,8 @@ pub type PlaceholderRegion = Placeholder<BoundRegion>;
16321632

16331633
pub type PlaceholderType = Placeholder<BoundVar>;
16341634

1635+
pub type PlaceholderConst = Placeholder<BoundVar>;
1636+
16351637
/// When type checking, we use the `ParamEnv` to track
16361638
/// details about the set of where-clauses that are in scope at this
16371639
/// particular point.

0 commit comments

Comments
 (0)