Skip to content

Commit 1bfcb28

Browse files
committed
Auto merge of #155392 - WaffleLapkin:alias-termmm, r=BoxyUwU
`AliasTerm` refactor follow up to #154758 tracking issue: #154941
2 parents f9988fe + be8bfb2 commit 1bfcb28

56 files changed

Lines changed: 414 additions & 351 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

compiler/rustc_borrowck/src/region_infer/opaque_types/member_constraints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for CollectMemberConstraintsVisitor<'_, '_,
177177
| ty::Coroutine(def_id, args) => self.visit_closure_args(def_id, args),
178178

179179
ty::Alias(ty::AliasTy { kind, args, .. })
180-
if let Some(variances) = self.cx().opt_alias_variances(kind, kind.def_id()) =>
180+
if let Some(variances) = self.cx().opt_alias_variances(kind) =>
181181
{
182182
// Skip lifetime parameters that are not captured, since they do
183183
// not need member constraints registered for them; we'll erase

compiler/rustc_borrowck/src/region_infer/opaque_types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ impl<'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for ToArgRegionsFolder<'_, 'tcx> {
501501
}
502502

503503
ty::Alias(ty::AliasTy { kind, args, .. })
504-
if let Some(variances) = tcx.opt_alias_variances(kind, kind.def_id()) =>
504+
if let Some(variances) = tcx.opt_alias_variances(kind) =>
505505
{
506506
let args = tcx.mk_args_from_iter(std::iter::zip(variances, args.iter()).map(
507507
|(&v, s)| {

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2735,7 +2735,7 @@ fn param_env_with_gat_bounds<'tcx>(
27352735
_ => predicates.push(
27362736
ty::Binder::bind_with_vars(
27372737
ty::ProjectionPredicate {
2738-
projection_term: ty::AliasTerm::new_from_args(
2738+
projection_term: ty::AliasTerm::new_from_def_id(
27392739
tcx,
27402740
trait_ty.def_id,
27412741
rebased_args,

compiler/rustc_hir_analysis/src/check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,10 @@ fn bounds_from_generic_predicates<'tcx>(
370370
let mut projections_str = vec![];
371371
for projection in &projections {
372372
let p = projection.skip_binder();
373-
if bound == tcx.parent(p.projection_term.def_id)
373+
if bound == tcx.parent(p.projection_term.def_id())
374374
&& p.projection_term.self_ty() == ty
375375
{
376-
let name = tcx.item_name(p.projection_term.def_id);
376+
let name = tcx.item_name(p.projection_term.def_id());
377377
projections_str.push(format!("{} = {}", name, p.term));
378378
}
379379
}

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,7 @@ pub(super) fn check_where_clauses<'tcx>(wfcx: &WfCheckingCtxt<'_, 'tcx>, def_id:
16551655
.map_bound(|pred| {
16561656
pred.term.as_const().map(|ct| {
16571657
let assoc_const_ty = tcx
1658-
.type_of(pred.projection_term.def_id)
1658+
.type_of(pred.projection_term.def_id())
16591659
.instantiate(tcx, pred.projection_term.args)
16601660
.skip_norm_wip();
16611661
ty::ClauseKind::ConstArgHasType(ct, assoc_const_ty)

compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
526526
);
527527
debug!(?alias_args);
528528

529-
ty::AliasTerm::new_from_args(tcx, assoc_item.def_id, alias_args)
529+
ty::AliasTerm::new_from_def_id(tcx, assoc_item.def_id, alias_args)
530530
})
531531
};
532532

@@ -543,7 +543,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
543543
hir::Term::Ty(ty) => self.lower_ty(ty).into(),
544544
hir::Term::Const(ct) => {
545545
let ty = projection_term.map_bound(|alias| {
546-
tcx.type_of(alias.def_id).instantiate(tcx, alias.args).skip_norm_wip()
546+
tcx.type_of(alias.def_id()).instantiate(tcx, alias.args).skip_norm_wip()
547547
});
548548
let ty = check_assoc_const_binding_type(
549549
self,

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
13641364
&item_segment,
13651365
trait_ref.args,
13661366
);
1367-
ty::AliasTerm::new_from_args(
1367+
ty::AliasTerm::new_from_def_id(
13681368
tcx,
13691369
assoc_item.def_id,
13701370
alias_args,
@@ -1374,7 +1374,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
13741374
// FIXME(mgca): code duplication with other places we lower
13751375
// the rhs' of associated const bindings
13761376
let ty = projection_term.map_bound(|alias| {
1377-
tcx.type_of(alias.def_id)
1377+
tcx.type_of(alias.def_id())
13781378
.instantiate(tcx, alias.args)
13791379
.skip_norm_wip()
13801380
});

compiler/rustc_hir_typeck/src/closure.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,11 +1057,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10571057
// The `Future` trait has only one associated item, `Output`,
10581058
// so check that this is what we see.
10591059
let output_assoc_item = self.tcx.associated_item_def_ids(trait_def_id)[0];
1060-
if output_assoc_item != predicate.projection_term.def_id {
1060+
if output_assoc_item != predicate.projection_term.def_id() {
10611061
span_bug!(
10621062
cause_span,
10631063
"projecting associated item `{:?}` from future, which is not Output `{:?}`",
1064-
predicate.projection_term.def_id,
1064+
predicate.projection_term.kind,
10651065
output_assoc_item,
10661066
);
10671067
}

compiler/rustc_infer/src/infer/outlives/for_liveness.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ where
9595
} else {
9696
// Skip lifetime parameters that are not captured, since they do
9797
// not need to be live.
98-
let variances = tcx.opt_alias_variances(kind, kind.def_id());
98+
let variances = tcx.opt_alias_variances(kind);
9999

100100
for (idx, s) in args.iter().enumerate() {
101101
if variances.map(|variances| variances[idx]) != Some(ty::Bivariant) {

compiler/rustc_infer/src/infer/outlives/obligations.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ where
485485
&& (alias_ty.has_infer_regions() || matches!(kind, ty::Opaque { .. }))
486486
{
487487
debug!("no declared bounds");
488-
let opt_variances = self.tcx.opt_alias_variances(kind, kind.def_id());
488+
let opt_variances = self.tcx.opt_alias_variances(kind);
489489
self.args_must_outlive(alias_ty.args, origin, region, opt_variances);
490490
return;
491491
}

0 commit comments

Comments
 (0)