Make TypeFoldable
implementors short-circuit on error
Co-authored-by: Alan Egerton <eggyal@gmail.com>
This commit is contained in:
parent
c5f0d0ebb4
commit
6e3fa20b00
11 changed files with 299 additions and 204 deletions
|
@ -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::fold_with(#bind, __folder)?
|
||||
}
|
||||
})
|
||||
});
|
||||
|
@ -28,8 +28,8 @@ pub fn type_foldable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::
|
|||
fn super_fold_with<__F: ::rustc_middle::ty::fold::TypeFolder<'tcx>>(
|
||||
self,
|
||||
__folder: &mut __F
|
||||
) -> Self {
|
||||
match self { #body_fold }
|
||||
) -> Result<Self, __F::Error> {
|
||||
Ok(match self { #body_fold })
|
||||
}
|
||||
|
||||
fn super_visit_with<__F: ::rustc_middle::ty::fold::TypeVisitor<'tcx>>(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue