Skip to content

Commit 7ca97d1

Browse files
committed
Move ty::{OutlivesPredicate, PolyRegionOutlivesPredicate, PolyTypeOutlivesPredicate, RegionOutlivesPredicate, TypeOutlivesPredicate} to their own little module (cute)
1 parent c19b3f1 commit 7ca97d1

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ mod visibility;
156156
pub use bound_constness::BoundConstness;
157157
pub use impl_polarity::ImplPolarity;
158158
pub use predicate::{
159-
InstantiatedPredicates, PolyTraitPredicate, Predicate, PredicateKind, TraitPredicate,
159+
InstantiatedPredicates, OutlivesPredicate, PolyRegionOutlivesPredicate, PolyTraitPredicate,
160+
PolyTypeOutlivesPredicate, Predicate, PredicateKind, RegionOutlivesPredicate, TraitPredicate,
161+
TypeOutlivesPredicate,
160162
};
161163
pub use visibility::Visibility;
162164

@@ -394,16 +396,6 @@ pub struct CratePredicatesMap<'tcx> {
394396
/// bounds, it will have no entry.
395397
pub predicates: FxHashMap<DefId, &'tcx [(Clause<'tcx>, Span)]>,
396398
}
397-
398-
/// `A: B`
399-
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
400-
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
401-
pub struct OutlivesPredicate<A, B>(pub A, pub B);
402-
pub type RegionOutlivesPredicate<'tcx> = OutlivesPredicate<ty::Region<'tcx>, ty::Region<'tcx>>;
403-
pub type TypeOutlivesPredicate<'tcx> = OutlivesPredicate<Ty<'tcx>, ty::Region<'tcx>>;
404-
pub type PolyRegionOutlivesPredicate<'tcx> = ty::Binder<'tcx, RegionOutlivesPredicate<'tcx>>;
405-
pub type PolyTypeOutlivesPredicate<'tcx> = ty::Binder<'tcx, TypeOutlivesPredicate<'tcx>>;
406-
407399
/// Encodes that `a` must be a subtype of `b`. The `a_is_expected` flag indicates
408400
/// whether the `a` type is the type that we should label as "expected" when
409401
/// presenting user diagnostics.

compiler/rustc_middle/src/ty/predicate.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ use rustc_type_ir::WithCachedTypeInfo;
77

88
use crate::ty::{
99
self, AliasRelationDirection, Binder, BoundConstness, Clause, ClosureKind, CoercePredicate,
10-
Const, DebruijnIndex, EarlyBinder, GenericArg, PolyProjectionPredicate,
11-
PolyTypeOutlivesPredicate, SubstsRef, SubtypePredicate, Term, Ty, TypeFlags,
10+
Const, DebruijnIndex, EarlyBinder, GenericArg, PolyProjectionPredicate, SubstsRef,
11+
SubtypePredicate, Term, Ty, TypeFlags,
1212
};
1313

1414
mod instantiated_predicates;
15+
mod outlives_predicate;
1516
mod trait_predicate;
1617

1718
pub use instantiated_predicates::InstantiatedPredicates;
19+
pub use outlives_predicate::{
20+
OutlivesPredicate, PolyRegionOutlivesPredicate, PolyTypeOutlivesPredicate,
21+
RegionOutlivesPredicate, TypeOutlivesPredicate,
22+
};
1823
pub use trait_predicate::{PolyTraitPredicate, TraitPredicate};
1924

2025
/// Use this rather than `PredicateKind`, whenever possible.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use crate::ty::{self, Ty};
2+
3+
pub type RegionOutlivesPredicate<'tcx> = OutlivesPredicate<ty::Region<'tcx>, ty::Region<'tcx>>;
4+
pub type TypeOutlivesPredicate<'tcx> = OutlivesPredicate<Ty<'tcx>, ty::Region<'tcx>>;
5+
pub type PolyRegionOutlivesPredicate<'tcx> = ty::Binder<'tcx, RegionOutlivesPredicate<'tcx>>;
6+
pub type PolyTypeOutlivesPredicate<'tcx> = ty::Binder<'tcx, TypeOutlivesPredicate<'tcx>>;
7+
8+
/// `A: B`
9+
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
10+
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
11+
pub struct OutlivesPredicate<A, B>(pub A, pub B);

0 commit comments

Comments
 (0)