Skip to content

Commit 09bb5bb

Browse files
committed
remove AliasTerm::kind() method
1 parent 7ec390a commit 09bb5bb

20 files changed

Lines changed: 37 additions & 43 deletions

File tree

compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
636636
| PredicateFilter::SelfAndAssociatedTypeBounds
637637
| PredicateFilter::ConstIfConst => {
638638
let projection_ty = projection_term
639-
.map_bound(|projection_term| projection_term.expect_ty(self.tcx()));
639+
.map_bound(|projection_term| projection_term.expect_ty());
640640
// Calling `skip_binder` is okay, because `lower_bounds` expects the `param_ty`
641641
// parameter to have a skipped binder.
642642
let param_ty = Ty::new_alias(tcx, projection_ty.skip_binder());

compiler/rustc_infer/src/infer/projection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl<'tcx> InferCtxt<'tcx> {
2323
debug_assert!(!self.next_trait_solver());
2424

2525
let span = self.tcx.def_span(alias_term.def_id());
26-
let infer_var = if alias_term.kind(self.tcx).is_type() {
26+
let infer_var = if alias_term.kind.is_type() {
2727
self.next_ty_var(span).into()
2828
} else {
2929
self.next_const_var(span).into()

compiler/rustc_infer/src/infer/relate/generalize.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl<'tcx> InferCtxt<'tcx> {
187187
let Some(source_alias) = source_term.to_alias_term() else {
188188
bug!("generalized `{source_term:?} to infer, not an alias");
189189
};
190-
match source_alias.kind(self.tcx) {
190+
match source_alias.kind {
191191
ty::AliasTermKind::ProjectionTy { .. }
192192
| ty::AliasTermKind::ProjectionConst { .. } => {
193193
// FIXME: This does not handle subtyping correctly, we could
@@ -426,7 +426,7 @@ impl<'tcx> Generalizer<'_, 'tcx> {
426426
/// Create a new type variable in the universe of the target when
427427
/// generalizing an alias.
428428
fn next_var_for_alias_of_kind(&self, alias: ty::AliasTerm<'tcx>) -> ty::Term<'tcx> {
429-
if alias.kind(self.cx()).is_type() {
429+
if alias.kind.is_type() {
430430
self.infcx.next_ty_var_in_universe(self.span, self.for_universe).into()
431431
} else {
432432
self.infcx.next_const_var_in_universe(self.span, self.for_universe).into()

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3156,7 +3156,7 @@ define_print! {
31563156
}
31573157

31583158
ty::AliasTerm<'tcx> {
3159-
match self.kind(p.tcx()) {
3159+
match self.kind {
31603160
ty::AliasTermKind::InherentTy {..} | ty::AliasTermKind::InherentConst {..} => p.pretty_print_inherent_projection(*self)?,
31613161
ty::AliasTermKind::ProjectionTy { def_id } => {
31623162
if !(p.should_print_verbose() || with_reduced_queries())

compiler/rustc_next_trait_solver/src/solve/normalizes_to/anon_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ where
1616
goal: Goal<I, ty::NormalizesTo<I>>,
1717
def_id: I::UnevaluatedConstId,
1818
) -> QueryResultOrRerunNonErased<I> {
19-
let uv = goal.predicate.alias.expect_ct(self.cx());
19+
let uv = goal.predicate.alias.expect_ct();
2020
self.evaluate_const_and_instantiate_normalizes_to_term(goal, uv)
2121
}
2222
}

compiler/rustc_next_trait_solver/src/solve/normalizes_to/free_alias.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ where
3131
.map(|pred| goal.with(cx, pred)),
3232
);
3333

34-
let actual = match free_alias.kind(cx) {
34+
let actual = match free_alias.kind {
3535
ty::AliasTermKind::FreeTy { def_id } => {
3636
cx.type_of(def_id.into()).instantiate(cx, free_alias.args).skip_norm_wip().into()
3737
}
@@ -43,7 +43,7 @@ where
4343
ty::AliasTermKind::FreeConst { .. } => {
4444
return self.evaluate_const_and_instantiate_normalizes_to_term(
4545
goal,
46-
free_alias.expect_ct(cx),
46+
free_alias.expect_ct(),
4747
);
4848
}
4949
kind => panic!("expected free alias, found {kind:?}"),

compiler/rustc_next_trait_solver/src/solve/normalizes_to/inherent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ where
5454
.map(|pred| goal.with(cx, pred)),
5555
);
5656

57-
let normalized = match inherent.kind(cx) {
57+
let normalized = match inherent.kind {
5858
ty::AliasTermKind::InherentTy { def_id } => {
5959
cx.type_of(def_id.into()).instantiate(cx, inherent_args).skip_norm_wip().into()
6060
}

compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ where
287287
);
288288

289289
let error_response = |ecx: &mut EvalCtxt<'_, D>, guar| {
290-
let error_term = match goal.predicate.alias.kind(cx) {
290+
let error_term = match goal.predicate.alias.kind {
291291
ty::AliasTermKind::ProjectionTy { .. } => Ty::new_error(cx, guar).into(),
292292
ty::AliasTermKind::ProjectionConst { .. } => Const::new_error(cx, guar).into(),
293293
kind => panic!("expected projection, found {kind:?}"),
@@ -400,7 +400,7 @@ where
400400
}
401401

402402
// Finally we construct the actual value of the associated type.
403-
let term = match goal.predicate.alias.kind(cx) {
403+
let term = match goal.predicate.alias.kind {
404404
ty::AliasTermKind::ProjectionTy { .. } => cx
405405
.type_of(target_item_def_id.into())
406406
.instantiate(cx, target_args)

compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
16661666

16671667
if let Some(lhs) = lhs.to_alias_term()
16681668
&& let ty::AliasTermKind::ProjectionTy { .. }
1669-
| ty::AliasTermKind::ProjectionConst { .. } = lhs.kind(self.tcx)
1669+
| ty::AliasTermKind::ProjectionConst { .. } = lhs.kind
16701670
&& let Some((better_type_err, expected_term)) =
16711671
derive_better_type_error(lhs, rhs)
16721672
{
@@ -1676,7 +1676,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
16761676
)
16771677
} else if let Some(rhs) = rhs.to_alias_term()
16781678
&& let ty::AliasTermKind::ProjectionTy { .. }
1679-
| ty::AliasTermKind::ProjectionConst { .. } = rhs.kind(self.tcx)
1679+
| ty::AliasTermKind::ProjectionConst { .. } = rhs.kind
16801680
&& let Some((better_type_err, expected_term)) =
16811681
derive_better_type_error(rhs, lhs)
16821682
{

compiler/rustc_trait_selection/src/error_reporting/traits/overflow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
7878
let mut err = match cause {
7979
OverflowCause::DeeplyNormalize(alias_term) => {
8080
let alias_term = self.resolve_vars_if_possible(alias_term);
81-
let kind = alias_term.kind(self.tcx).descr();
81+
let kind = alias_term.kind.descr();
8282
let alias_str = with_short_path(self.tcx, alias_term);
8383
struct_span_code_err!(
8484
self.dcx(),

0 commit comments

Comments
 (0)