Skip to content

Commit bf409af

Browse files
committed
Move AliasTy and AliasTerm types to ty/alias.rs
1 parent c3bdf72 commit bf409af

5 files changed

Lines changed: 10 additions & 7 deletions

File tree

compiler/rustc_type_ir/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub use predicate_kind::*;
8181
pub use region_kind::*;
8282
pub use rustc_ast_ir::{FloatTy, IntTy, Movability, Mutability, Pinnedness, UintTy};
8383
use rustc_type_ir_macros::GenericTypeVisitable;
84-
pub use ty::Alias;
84+
pub use ty::{Alias, AliasTerm, AliasTy};
8585
pub use ty_info::*;
8686
pub use ty_kind::*;
8787
pub use unnormalized::Unnormalized;

compiler/rustc_type_ir/src/predicate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use rustc_type_ir_macros::{
1010

1111
use crate::fold::{FallibleTypeFolder, TypeFoldable, TypeFolder};
1212
use crate::inherent::*;
13+
use crate::ty::AliasTerm;
1314
use crate::upcast::{Upcast, UpcastFrom};
1415
use crate::visit::{TypeVisitable, TypeVisitableExt as _, TypeVisitor};
1516
use crate::{self as ty, Alias, AliasTyKind, Interner, UnevaluatedConstKind, try_visit};
@@ -662,8 +663,6 @@ impl<I: Interner> From<ty::UnevaluatedConstKind<I>> for AliasTermKind<I> {
662663
}
663664
}
664665

665-
pub type AliasTerm<I> = Alias<I, AliasTermKind<I>>;
666-
667666
impl<I: Interner> AliasTerm<I> {
668667
pub fn new_from_args(
669668
interner: I,
@@ -722,6 +721,7 @@ impl<I: Interner> AliasTerm<I> {
722721
ty::UnevaluatedConst { kind, args: self.args, _use_unevaluated_const_new_instead: () }
723722
}
724723

724+
// FIXME: replace with explicit matches
725725
pub fn def_id(self) -> I::DefId {
726726
self.kind.def_id()
727727
}

compiler/rustc_type_ir/src/ty/alias.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use rustc_type_ir_macros::{
66
};
77

88
use crate::Interner;
9+
use crate::predicate::AliasTermKind;
10+
use crate::ty_kind::AliasTyKind;
911

1012
/// Represents an alias of a type, constant, or other term-like item.
1113
///
@@ -59,3 +61,6 @@ impl<I: Interner> Alias<I, I::UnevaluatedConstId> {
5961
Alias { kind, args, _use_alias_new_instead: () }
6062
}
6163
}
64+
65+
pub type AliasTerm<I> = Alias<I, AliasTermKind<I>>;
66+
pub type AliasTy<I> = Alias<I, AliasTyKind<I>>;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
mod alias;
22

3-
pub use alias::Alias;
3+
pub use alias::{Alias, AliasTerm, AliasTy};

compiler/rustc_type_ir/src/ty_kind.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_type_ir_macros::{
1717
use self::TyKind::*;
1818
pub use self::closure::*;
1919
use crate::inherent::*;
20-
use crate::ty::Alias;
20+
use crate::ty::AliasTy;
2121
#[cfg(feature = "nightly")]
2222
use crate::visit::TypeVisitable;
2323
use crate::{self as ty, BoundVarIndexKind, FloatTy, IntTy, Interner, UintTy};
@@ -432,8 +432,6 @@ impl<I: Interner> fmt::Debug for TyKind<I> {
432432
}
433433
}
434434

435-
pub type AliasTy<I> = Alias<I, AliasTyKind<I>>;
436-
437435
impl<I: Interner> AliasTy<I> {
438436
pub fn new_from_args(interner: I, kind: AliasTyKind<I>, args: I::GenericArgs) -> AliasTy<I> {
439437
interner.debug_assert_args_compatible(kind.def_id(), args);

0 commit comments

Comments
 (0)