pub mod print;
pub mod query;
pub mod relate;
-pub mod steal;
pub mod subst;
pub mod trait_def;
pub mod util;
outer_exclusive_binder: ty::DebruijnIndex,
}
+impl<'tcx> TyS<'tcx> {
+ /// A constructor used only for internal testing.
+ #[allow(rustc::usage_of_ty_tykind)]
+ pub fn make_for_test(
+ kind: TyKind<'tcx>,
+ flags: TypeFlags,
+ outer_exclusive_binder: ty::DebruijnIndex,
+ ) -> TyS<'tcx> {
+ TyS { kind, flags, outer_exclusive_binder }
+ }
+}
+
// `TyS` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(target_arch = "x86_64")]
static_assert_size!(TyS<'_>, 32);
}
}
-/// The "placeholder index" fully defines a placeholder region.
-/// Placeholder regions are identified by both a **universe** as well
-/// as a "bound-region" within that universe. The `bound_region` is
-/// basically a name -- distinct bound regions within the same
-/// universe are just two regions with an unknown relationship to one
+/// The "placeholder index" fully defines a placeholder region, type, or const. Placeholders are
+/// identified by both a universe, as well as a name residing within that universe. Distinct bound
+/// regions/types/consts within the same universe simply have an unknown relationship to one
/// another.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, TyEncodable, TyDecodable, PartialOrd, Ord)]
pub struct Placeholder<T> {
pub type PlaceholderType = Placeholder<BoundVar>;
-pub type PlaceholderConst = Placeholder<BoundVar>;
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)]
+#[derive(TyEncodable, TyDecodable, PartialOrd, Ord)]
+pub struct BoundConst<'tcx> {
+ pub var: BoundVar,
+ pub ty: Ty<'tcx>,
+}
+
+pub type PlaceholderConst<'tcx> = Placeholder<BoundConst<'tcx>>;
/// A `DefId` which is potentially bundled with its corresponding generic parameter
/// in case `did` is a const argument.
}
impl<'tcx> TypeFoldable<'tcx> for ParamEnv<'tcx> {
- fn super_fold_with<F: ty::fold::TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
+ fn super_fold_with<F: ty::fold::TypeFolder<'tcx>>(self, folder: &mut F) -> Self {
ParamEnv::new(self.caller_bounds().fold_with(folder), self.reveal().fold_with(folder))
}