Skip to content

Commit

Permalink
Remove to_term
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed May 14, 2024
1 parent 50a5f5d commit 1b9baca
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
4 changes: 0 additions & 4 deletions compiler/rustc_middle/src/ty/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,6 @@ impl<'tcx> rustc_type_ir::inherent::Const<TyCtxt<'tcx>> for Const<'tcx> {
fn ty(self) -> Ty<'tcx> {
self.ty()
}

fn into_term(self) -> ty::Term<'tcx> {
self.into()
}
}

impl<'tcx> Const<'tcx> {
Expand Down
4 changes: 0 additions & 4 deletions compiler/rustc_middle/src/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1660,10 +1660,6 @@ impl<'tcx> rustc_type_ir::inherent::Ty<TyCtxt<'tcx>> for Ty<'tcx> {
) -> Self {
Ty::new_alias(interner, kind, alias_ty)
}

fn into_term(self) -> ty::Term<'tcx> {
self.into()
}
}

/// Type utilities
Expand Down
6 changes: 2 additions & 4 deletions compiler/rustc_type_ir/src/inherent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub trait Ty<I: Interner<Ty = Self>>:
+ Hash
+ Eq
+ Into<I::GenericArg>
+ Into<I::Term>
+ IntoKind<Kind = TyKind<I>>
+ TypeSuperVisitable<I>
+ TypeSuperFoldable<I>
Expand All @@ -23,8 +24,6 @@ pub trait Ty<I: Interner<Ty = Self>>:
fn new_anon_bound(interner: I, debruijn: DebruijnIndex, var: BoundVar) -> Self;

fn new_alias(interner: I, kind: AliasTyKind, alias_ty: AliasTy<I>) -> Self;

fn into_term(self) -> I::Term;
}

pub trait Region<I: Interner<Region = Self>>:
Expand All @@ -41,6 +40,7 @@ pub trait Const<I: Interner<Const = Self>>:
+ Hash
+ Eq
+ Into<I::GenericArg>
+ Into<I::Term>
+ IntoKind<Kind = ConstKind<I>>
+ TypeSuperVisitable<I>
+ TypeSuperFoldable<I>
Expand All @@ -51,8 +51,6 @@ pub trait Const<I: Interner<Const = Self>>:
fn new_unevaluated(interner: I, uv: UnevaluatedConst<I>, ty: I::Ty) -> Self;

fn ty(self) -> I::Ty;

fn into_term(self) -> I::Term;
}

pub trait GenericsOf<I: Interner<GenericsOf = Self>> {
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_type_ir/src/predicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,32 +437,32 @@ impl<I: Interner> AliasTerm<I> {
AliasTyKind::Projection,
AliasTy { def_id: self.def_id, args: self.args, _use_alias_ty_new_instead: () },
)
.into_term(),
.into(),
AliasTermKind::InherentTy => Ty::new_alias(
interner,
AliasTyKind::Inherent,
AliasTy { def_id: self.def_id, args: self.args, _use_alias_ty_new_instead: () },
)
.into_term(),
.into(),
AliasTermKind::OpaqueTy => Ty::new_alias(
interner,
AliasTyKind::Opaque,
AliasTy { def_id: self.def_id, args: self.args, _use_alias_ty_new_instead: () },
)
.into_term(),
.into(),
AliasTermKind::WeakTy => Ty::new_alias(
interner,
AliasTyKind::Weak,
AliasTy { def_id: self.def_id, args: self.args, _use_alias_ty_new_instead: () },
)
.into_term(),
.into(),
AliasTermKind::UnevaluatedConst | AliasTermKind::ProjectionConst => {
I::Const::new_unevaluated(
interner,
UnevaluatedConst::new(self.def_id, self.args),
interner.type_of_instantiated(self.def_id, self.args),
)
.into_term()
.into()
}
}
}
Expand Down

0 comments on commit 1b9baca

Please sign in to comment.