Rollup merge of #106739 - WaffleLapkin:astconv, r=estebank

Remove `<dyn AstConv<'tcx>>::fun(c, ...)` calls in favour of `c.astconv().fun(...)`

This removes the need for <>><><><<>> dances and makes the code a bit nicer.

Not sure if `astconv` is the best name though, maybe someone has a better idea?
This commit is contained in:
Michael Goulet 2023-01-11 22:25:50 -08:00 committed by GitHub
commit 9ec36f5668
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 660 additions and 696 deletions

View file

@ -545,7 +545,7 @@ pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty<'_>) -> Ty<'tcx> {
// scope. This is derived from the enclosing item-like thing.
let env_def_id = tcx.hir().get_parent_item(hir_ty.hir_id);
let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id.to_def_id());
<dyn AstConv<'_>>::ast_ty_to_ty(&item_cx, hir_ty)
item_cx.astconv().ast_ty_to_ty(hir_ty)
}
pub fn hir_trait_to_predicates<'tcx>(
@ -559,8 +559,7 @@ pub fn hir_trait_to_predicates<'tcx>(
let env_def_id = tcx.hir().get_parent_item(hir_trait.hir_ref_id);
let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id.to_def_id());
let mut bounds = Bounds::default();
let _ = <dyn AstConv<'_>>::instantiate_poly_trait_ref(
&item_cx,
let _ = &item_cx.astconv().instantiate_poly_trait_ref(
hir_trait,
DUMMY_SP,
ty::BoundConstness::NotConst,