Reduce boilerplate around infallible folders

This commit is contained in:
Alan Egerton
2021-12-01 00:55:57 +00:00
parent db7295fa96
commit bfc434b6d0
41 changed files with 898 additions and 727 deletions

View File

@@ -17,7 +17,7 @@ pub fn type_foldable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::
vi.construct(|_, index| {
let bind = &bindings[index];
quote! {
::rustc_middle::ty::fold::TypeFoldable::fold_with(#bind, __folder)?
::rustc_middle::ty::fold::TypeFoldable::try_fold_with(#bind, __folder)?
}
})
});
@@ -25,7 +25,7 @@ pub fn type_foldable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::
s.bound_impl(
quote!(::rustc_middle::ty::fold::TypeFoldable<'tcx>),
quote! {
fn super_fold_with<__F: ::rustc_middle::ty::fold::TypeFolder<'tcx>>(
fn try_super_fold_with<__F: ::rustc_middle::ty::fold::TypeFolderFallible<'tcx>>(
self,
__folder: &mut __F
) -> Result<Self, __F::Error> {