Auto merge of #125076 - compiler-errors:alias-term, r=lcnr · rust-lang/rust@3458211 (original) (raw)

`@@ -47,7 +47,6 @@ use std::borrow::Cow;

`

47

47

`use super::probe::{AutorefOrPtrAdjustment, IsSuggestion, Mode, ProbeScope};

`

48

48

`use super::{CandidateSource, MethodError, NoMatchData};

`

49

49

`use rustc_hir::intravisit::Visitor;

`

50

``

`-

use std::iter;

`

51

50

``

52

51

`impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

`

53

52

`fn is_fn_ty(&self, ty: Ty<'tcx>, span: Span) -> bool {

`

`@@ -173,7 +172,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

`

173

172

`}

`

174

173

`}

`

175

174

`}

`

176

``

`-

ty::Slice(..) | ty::Adt(..) | ty::Alias(ty::AliasKind::Opaque, _) => {

`

``

175

`+

ty::Slice(..) | ty::Adt(..) | ty::Alias(ty::Opaque, _) => {

`

177

176

`for unsatisfied in unsatisfied_predicates.iter() {

`

178

177

`if is_iterator_predicate(unsatisfied.0, self.tcx) {

`

179

178

`return true;

`

`@@ -788,26 +787,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

`

788

787

` ty::PredicateKind::Clause(ty::ClauseKind::Projection(pred)) => {

`

789

788

`let pred = bound_predicate.rebind(pred);

`

790

789

`` // <Foo as Iterator>::Item = String.

``

791

``

`-

let projection_ty = pred.skip_binder().projection_ty;

`

792

``

-

793

``

`-

let args_with_infer_self = tcx.mk_args_from_iter(

`

794

``

`-

iter::once(Ty::new_var(tcx, ty::TyVid::ZERO).into())

`

795

``

`-

.chain(projection_ty.args.iter().skip(1)),

`

796

``

`-

);

`

797

``

-

798

``

`-

let quiet_projection_ty =

`

799

``

`-

ty::AliasTy::new(tcx, projection_ty.def_id, args_with_infer_self);

`

``

790

`+

let projection_term = pred.skip_binder().projection_term;

`

``

791

`+

let quiet_projection_term =

`

``

792

`+

projection_term.with_self_ty(tcx, Ty::new_var(tcx, ty::TyVid::ZERO));

`

800

793

``

801

794

`let term = pred.skip_binder().term;

`

802

795

``

803

``

`-

let obligation = format!("{projection_ty} = {term}");

`

``

796

`+

let obligation = format!("{projection_term} = {term}");

`

804

797

`let quiet = with_forced_trimmed_paths!(format!(

`

805

798

`"{} = {}",

`

806

``

`-

quiet_projection_ty, term

`

``

799

`+

quiet_projection_term, term

`

807

800

`));

`

808

801

``

809

``

`-

bound_span_label(projection_ty.self_ty(), &obligation, &quiet);

`

810

``

`-

Some((obligation, projection_ty.self_ty()))

`

``

802

`+

bound_span_label(projection_term.self_ty(), &obligation, &quiet);

`

``

803

`+

Some((obligation, projection_term.self_ty()))

`

811

804

`}

`

812

805

` ty::PredicateKind::Clause(ty::ClauseKind::Trait(poly_trait_ref)) => {

`

813

806

`let p = poly_trait_ref.trait_ref;

`