Skip to content

Commit 79f92ae

Browse files
committed
Move ty::Ty to its own little module (cute)
1 parent 24c89cd commit 79f92ae

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ mod impl_polarity;
146146
mod param_env;
147147
mod predicate;
148148
mod term;
149+
mod ty_; // FIXME: rename to `ty` once we don't import `crate::ty` here
149150
mod visibility;
150151

151152
pub use bound_constness::BoundConstness;
@@ -158,6 +159,7 @@ pub use predicate::{
158159
RegionOutlivesPredicate, SubtypePredicate, ToPredicate, TraitPredicate, TypeOutlivesPredicate,
159160
};
160161
pub use term::{Term, TermKind};
162+
pub use ty_::Ty;
161163
pub use visibility::Visibility;
162164

163165
pub struct ResolverOutputs {
@@ -326,12 +328,6 @@ pub struct CReaderCacheKey {
326328
pub pos: usize,
327329
}
328330

329-
/// Use this rather than `TyKind`, whenever possible.
330-
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)]
331-
#[rustc_diagnostic_item = "Ty"]
332-
#[rustc_pass_by_value]
333-
pub struct Ty<'tcx>(Interned<'tcx, WithCachedTypeInfo<TyKind<'tcx>>>);
334-
335331
impl ty::EarlyBoundRegion {
336332
/// Does this early bound region have a name? Early bound regions normally
337333
/// always have names except when using anonymous lifetimes (`'_`).

compiler/rustc_middle/src/ty/ty_.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use crate::ty::{Interned, TyKind, WithCachedTypeInfo};
2+
3+
/// Use this rather than `TyKind`, whenever possible.
4+
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)]
5+
#[rustc_diagnostic_item = "Ty"]
6+
#[rustc_pass_by_value]
7+
pub struct Ty<'tcx>(pub(super) Interned<'tcx, WithCachedTypeInfo<TyKind<'tcx>>>);
8+
9+
// FIXME: move `Ty` inherent impls here (and possibly change structure wrt `sty` mod)

0 commit comments

Comments
 (0)