diff options
| author | Jason Newcomb <jsnewcomb@pm.me> | 2024-02-24 17:22:28 -0500 |
|---|---|---|
| committer | Jason Newcomb <jsnewcomb@pm.me> | 2024-03-05 13:28:15 -0500 |
| commit | be9b125d4180126f259d392fdf72ddb33e63013a (patch) | |
| tree | a8766be6e1360cde6b9bfca49898116ab8c200d6 /compiler/rustc_macros/src | |
| parent | 5abfb3775da61ed9059c6efa3f9bec5b86b67c7a (diff) | |
| download | rust-be9b125d4180126f259d392fdf72ddb33e63013a.tar.gz rust-be9b125d4180126f259d392fdf72ddb33e63013a.zip | |
Convert `TypeVisitor` and `DefIdVisitor` to use `VisitorResult`
Diffstat (limited to 'compiler/rustc_macros/src')
| -rw-r--r-- | compiler/rustc_macros/src/type_visitable.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/rustc_macros/src/type_visitable.rs b/compiler/rustc_macros/src/type_visitable.rs index c8430380345..94e86e0e246 100644 --- a/compiler/rustc_macros/src/type_visitable.rs +++ b/compiler/rustc_macros/src/type_visitable.rs @@ -34,7 +34,14 @@ pub fn type_visitable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2: s.add_bounds(synstructure::AddBounds::Generics); let body_visit = s.each(|bind| { quote! { - ::rustc_middle::ty::visit::TypeVisitable::visit_with(#bind, __visitor)?; + match ::rustc_ast_ir::visit::VisitorResult::branch( + ::rustc_middle::ty::visit::TypeVisitable::visit_with(#bind, __visitor) + ) { + ::core::ops::ControlFlow::Continue(()) => {}, + ::core::ops::ControlFlow::Break(r) => { + return ::rustc_ast_ir::visit::VisitorResult::from_residual(r); + }, + } } }); s.bind_with(|_| synstructure::BindStyle::Move); @@ -45,9 +52,9 @@ pub fn type_visitable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2: fn visit_with<__V: ::rustc_middle::ty::visit::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>( &self, __visitor: &mut __V - ) -> ::std::ops::ControlFlow<__V::BreakTy> { + ) -> __V::Result { match *self { #body_visit } - ::std::ops::ControlFlow::Continue(()) + <__V::Result as ::rustc_ast_ir::visit::VisitorResult>::output() } }, ) |
