Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3bcdf30

Browse files
committedMay 13, 2024
split out AliasTy -> AliasTerm
1 parent ecbe3fd commit 3bcdf30

File tree

70 files changed

+688
-387
lines changed

Some content is hidden

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

70 files changed

+688
-387
lines changed
 

‎compiler/rustc_hir_typeck/src/method/suggest.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
172172
}
173173
}
174174
}
175-
ty::Slice(..) | ty::Adt(..) | ty::Alias(ty::AliasKind::Opaque, _) => {
175+
ty::Slice(..) | ty::Adt(..) | ty::Alias(ty::Opaque, _) => {
176176
for unsatisfied in unsatisfied_predicates.iter() {
177177
if is_iterator_predicate(unsatisfied.0, self.tcx) {
178178
return true;
@@ -787,26 +787,26 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
787787
ty::PredicateKind::Clause(ty::ClauseKind::Projection(pred)) => {
788788
let pred = bound_predicate.rebind(pred);
789789
// `<Foo as Iterator>::Item = String`.
790-
let projection_ty = pred.skip_binder().projection_ty;
790+
let projection_term = pred.skip_binder().projection_term;
791791

792792
let args_with_infer_self = tcx.mk_args_from_iter(
793793
iter::once(Ty::new_var(tcx, ty::TyVid::ZERO).into())
794-
.chain(projection_ty.args.iter().skip(1)),
794+
.chain(projection_term.args.iter().skip(1)),
795795
);
796796

797-
let quiet_projection_ty =
798-
ty::AliasTy::new(tcx, projection_ty.def_id, args_with_infer_self);
797+
let quiet_projection_term =
798+
ty::AliasTerm::new(tcx, projection_term.def_id, args_with_infer_self);
799799

800800
let term = pred.skip_binder().term;
801801

802-
let obligation = format!("{projection_ty} = {term}");
802+
let obligation = format!("{projection_term} = {term}");
803803
let quiet = with_forced_trimmed_paths!(format!(
804804
"{} = {}",
805-
quiet_projection_ty, term
805+
quiet_projection_term, term
806806
));
807807

808-
bound_span_label(projection_ty.self_ty(), &obligation, &quiet);
809-
Some((obligation, projection_ty.self_ty()))
808+
bound_span_label(projection_term.self_ty(), &obligation, &quiet);
809+
Some((obligation, projection_term.self_ty()))
810810
}
811811
ty::PredicateKind::Clause(ty::ClauseKind::Trait(poly_trait_ref)) => {
812812
let p = poly_trait_ref.trait_ref;

‎compiler/rustc_infer/src/infer/at.rs

+14
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,20 @@ impl<'tcx> ToTrace<'tcx> for ty::TraitRef<'tcx> {
430430
}
431431

432432
impl<'tcx> ToTrace<'tcx> for ty::AliasTy<'tcx> {
433+
fn to_trace(
434+
cause: &ObligationCause<'tcx>,
435+
a_is_expected: bool,
436+
a: Self,
437+
b: Self,
438+
) -> TypeTrace<'tcx> {
439+
TypeTrace {
440+
cause: cause.clone(),
441+
values: Aliases(ExpectedFound::new(a_is_expected, a.into(), b.into())),
442+
}
443+
}
444+
}
445+
446+
impl<'tcx> ToTrace<'tcx> for ty::AliasTerm<'tcx> {
433447
fn to_trace(
434448
cause: &ObligationCause<'tcx>,
435449
a_is_expected: bool,

‎compiler/rustc_infer/src/infer/error_reporting/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ impl<'tcx> InferCtxt<'tcx> {
410410
.kind()
411411
.map_bound(|kind| match kind {
412412
ty::ClauseKind::Projection(projection_predicate)
413-
if projection_predicate.projection_ty.def_id == item_def_id =>
413+
if projection_predicate.projection_term.def_id == item_def_id =>
414414
{
415415
projection_predicate.term.ty()
416416
}
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Failed to load comments.