Skip to content

Commit 94d522e

Browse files
committed
Move ty::{CoercePredicate, PolyCoercePredicate} to their own little module (cute)
1 parent 81f69a3 commit 94d522e

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,10 @@ mod visibility;
156156
pub use bound_constness::BoundConstness;
157157
pub use impl_polarity::ImplPolarity;
158158
pub use predicate::{
159-
InstantiatedPredicates, OutlivesPredicate, PolyRegionOutlivesPredicate, PolySubtypePredicate,
160-
PolyTraitPredicate, PolyTypeOutlivesPredicate, Predicate, PredicateKind,
161-
RegionOutlivesPredicate, SubtypePredicate, TraitPredicate, TypeOutlivesPredicate,
159+
CoercePredicate, InstantiatedPredicates, OutlivesPredicate, PolyCoercePredicate,
160+
PolyRegionOutlivesPredicate, PolySubtypePredicate, PolyTraitPredicate,
161+
PolyTypeOutlivesPredicate, Predicate, PredicateKind, RegionOutlivesPredicate, SubtypePredicate,
162+
TraitPredicate, TypeOutlivesPredicate,
162163
};
163164
pub use visibility::Visibility;
164165

@@ -397,15 +398,6 @@ pub struct CratePredicatesMap<'tcx> {
397398
pub predicates: FxHashMap<DefId, &'tcx [(Clause<'tcx>, Span)]>,
398399
}
399400

400-
/// Encodes that we have to coerce *from* the `a` type to the `b` type.
401-
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, TyEncodable, TyDecodable)]
402-
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
403-
pub struct CoercePredicate<'tcx> {
404-
pub a: Ty<'tcx>,
405-
pub b: Ty<'tcx>,
406-
}
407-
pub type PolyCoercePredicate<'tcx> = ty::Binder<'tcx, CoercePredicate<'tcx>>;
408-
409401
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
410402
pub struct Term<'tcx> {
411403
ptr: NonZeroUsize,

compiler/rustc_middle/src/ty/predicate.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@ use rustc_hir::def_id::DefId;
66
use rustc_type_ir::WithCachedTypeInfo;
77

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

14+
mod coerce_predicate;
1415
mod instantiated_predicates;
1516
mod outlives_predicate;
1617
mod subtype_predicate;
1718
mod trait_predicate;
1819

20+
pub use coerce_predicate::{CoercePredicate, PolyCoercePredicate};
1921
pub use instantiated_predicates::InstantiatedPredicates;
2022
pub use outlives_predicate::{
2123
OutlivesPredicate, PolyRegionOutlivesPredicate, PolyTypeOutlivesPredicate,
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 PolyCoercePredicate<'tcx> = ty::Binder<'tcx, CoercePredicate<'tcx>>;
4+
5+
/// Encodes that we have to coerce *from* the `a` type to the `b` type.
6+
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, TyEncodable, TyDecodable)]
7+
#[derive(HashStable, TypeFoldable, TypeVisitable, Lift)]
8+
pub struct CoercePredicate<'tcx> {
9+
pub a: Ty<'tcx>,
10+
pub b: Ty<'tcx>,
11+
}

0 commit comments

Comments
 (0)