X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_hir_analysis%2Fsrc%2Fcollect%2Fpredicates_of.rs;h=a7e6494c15adb4cf57198821423968c51c4b9c66;hb=8ea26ca17f1baf0877b7b249323f3d5d72f0d3b4;hp=18fc43ce15cbd4794c5f9d84273a8a4f748ff72f;hpb=e23b0fd318c3e5d28092e78d69977d21d1b1843e;p=rust.git diff --git a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs index 18fc43ce15c..a7e6494c15a 100644 --- a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs @@ -87,7 +87,8 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP Node::Item(item) => match item.kind { ItemKind::Impl(ref impl_) => { if impl_.defaultness.is_default() { - is_default_impl_trait = tcx.impl_trait_ref(def_id).map(ty::Binder::dummy); + is_default_impl_trait = + tcx.impl_trait_ref(def_id).map(|t| ty::Binder::dummy(t.subst_identity())); } &impl_.generics } @@ -162,8 +163,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP let mut bounds = Bounds::default(); // Params are implicitly sized unless a `?Sized` bound is found - >::add_implicitly_sized( - &icx, + icx.astconv().add_implicitly_sized( &mut bounds, param_ty, &[], @@ -211,22 +211,16 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP } let mut bounds = Bounds::default(); - >::add_bounds( - &icx, - ty, - bound_pred.bounds.iter(), - &mut bounds, - bound_vars, - ); + icx.astconv().add_bounds(ty, bound_pred.bounds.iter(), &mut bounds, bound_vars); predicates.extend(bounds.predicates()); } hir::WherePredicate::RegionPredicate(region_pred) => { - let r1 = >::ast_region_to_region(&icx, ®ion_pred.lifetime, None); + let r1 = icx.astconv().ast_region_to_region(®ion_pred.lifetime, None); predicates.extend(region_pred.bounds.iter().map(|bound| { let (r2, span) = match bound { hir::GenericBound::Outlives(lt) => { - (>::ast_region_to_region(&icx, lt, None), lt.ident.span) + (icx.astconv().ast_region_to_region(lt, None), lt.ident.span) } _ => bug!(), }; @@ -258,7 +252,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP // for details. if let Node::Item(&Item { kind: ItemKind::Impl { .. }, .. }) = node { let self_ty = tcx.type_of(def_id); - let trait_ref = tcx.impl_trait_ref(def_id); + let trait_ref = tcx.impl_trait_ref(def_id).map(ty::EarlyBinder::subst_identity); cgp::setup_constraining_predicates( tcx, &mut predicates, @@ -279,7 +273,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP debug!(?lifetimes); for (arg, duplicate) in std::iter::zip(lifetimes, ast_generics.params) { let hir::GenericArg::Lifetime(arg) = arg else { bug!() }; - let orig_region = >::ast_region_to_region(&icx, &arg, None); + let orig_region = icx.astconv().ast_region_to_region(&arg, None); if !matches!(orig_region.kind(), ty::ReEarlyBound(..)) { // Only early-bound regions can point to the original generic parameter. continue; @@ -527,14 +521,9 @@ pub(super) fn super_predicates_that_define_assoc_type( // Convert the bounds that follow the colon, e.g., `Bar + Zed` in `trait Foo: Bar + Zed`. let self_param_ty = tcx.types.self_param; let superbounds1 = if let Some(assoc_name) = assoc_name { - >::compute_bounds_that_match_assoc_type( - &icx, - self_param_ty, - bounds, - assoc_name, - ) + icx.astconv().compute_bounds_that_match_assoc_type(self_param_ty, bounds, assoc_name) } else { - >::compute_bounds(&icx, self_param_ty, bounds) + icx.astconv().compute_bounds(self_param_ty, bounds) }; let superbounds1 = superbounds1.predicates();