Skip to content

Commit cacaab6

Browse files
committed
Move ty::{Placeholder, PlaceholderConst, PlaceholderRegion, PlaceholderType} to their own little module (cute)
1 parent 8be9b84 commit cacaab6

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ mod field_def;
146146
mod impl_polarity;
147147
mod opaque_hidden_type;
148148
mod param_env;
149+
mod placeholder;
149150
mod predicate;
150151
mod term;
151152
mod ty_; // FIXME: rename to `ty` once we don't import `crate::ty` here
@@ -158,6 +159,7 @@ pub use field_def::FieldDef;
158159
pub use impl_polarity::ImplPolarity;
159160
pub use opaque_hidden_type::OpaqueHiddenType;
160161
pub use param_env::{ParamEnv, ParamEnvAnd};
162+
pub use placeholder::{Placeholder, PlaceholderConst, PlaceholderRegion, PlaceholderType};
161163
pub use predicate::{
162164
CoercePredicate, InstantiatedPredicates, OutlivesPredicate, PolyCoercePredicate,
163165
PolyProjectionPredicate, PolyRegionOutlivesPredicate, PolySubtypePredicate, PolyTraitPredicate,
@@ -417,30 +419,13 @@ pub struct OpaqueTypeKey<'tcx> {
417419
pub substs: SubstsRef<'tcx>,
418420
}
419421

420-
/// The "placeholder index" fully defines a placeholder region, type, or const. Placeholders are
421-
/// identified by both a universe, as well as a name residing within that universe. Distinct bound
422-
/// regions/types/consts within the same universe simply have an unknown relationship to one
423-
/// another.
424-
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
425-
#[derive(HashStable, TyEncodable, TyDecodable)]
426-
pub struct Placeholder<T> {
427-
pub universe: UniverseIndex,
428-
pub bound: T,
429-
}
430-
431-
pub type PlaceholderRegion = Placeholder<BoundRegion>;
432-
433-
pub type PlaceholderType = Placeholder<BoundTy>;
434-
435422
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)]
436423
#[derive(TyEncodable, TyDecodable, PartialOrd, Ord)]
437424
pub struct BoundConst<'tcx> {
438425
pub var: BoundVar,
439426
pub ty: Ty<'tcx>,
440427
}
441428

442-
pub type PlaceholderConst<'tcx> = Placeholder<BoundVar>;
443-
444429
// FIXME(ecstaticmorse): Audit all occurrences of `without_const().to_predicate(tcx)` to ensure that
445430
// the constness of trait bounds is being propagated correctly.
446431
impl<'tcx> PolyTraitRef<'tcx> {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
use crate::ty::{BoundRegion, BoundTy, BoundVar, UniverseIndex};
2+
3+
pub type PlaceholderRegion = Placeholder<BoundRegion>;
4+
5+
pub type PlaceholderType = Placeholder<BoundTy>;
6+
7+
pub type PlaceholderConst<'tcx> = Placeholder<BoundVar>;
8+
9+
/// The "placeholder index" fully defines a placeholder region, type, or const. Placeholders are
10+
/// identified by both a universe, as well as a name residing within that universe. Distinct bound
11+
/// regions/types/consts within the same universe simply have an unknown relationship to one
12+
/// another.
13+
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14+
#[derive(HashStable, TyEncodable, TyDecodable)]
15+
pub struct Placeholder<T> {
16+
pub universe: UniverseIndex,
17+
pub bound: T,
18+
}

0 commit comments

Comments
 (0)