1
Fork 0

Rollup merge of #132787 - maxcabrajac:fnctxt, r=petrochenkov

Unify FnKind between AST visitors and make WalkItemKind more straight forward

Unifying `FnKind` requires a bunch of changes to `WalkItemKind::walk` signature so I'll change them in one go

related to #128974

r? `@petrochenkov`
This commit is contained in:
Matthias Krüger 2024-11-16 21:05:46 +01:00 committed by GitHub
commit 6b47c6d786
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 157 additions and 88 deletions

View file

@ -204,10 +204,10 @@ impl MutVisitor for CfgEval<'_> {
fn flat_map_assoc_item(
&mut self,
item: P<ast::AssocItem>,
_ctxt: AssocCtxt,
ctxt: AssocCtxt,
) -> SmallVec<[P<ast::AssocItem>; 1]> {
let item = configure!(self, item);
mut_visit::walk_flat_map_item(self, item)
mut_visit::walk_flat_map_assoc_item(self, item, ctxt)
}
fn flat_map_foreign_item(

View file

@ -144,7 +144,15 @@ impl<'a> MutVisitor for TestHarnessGenerator<'a> {
item.kind
{
let prev_tests = mem::take(&mut self.tests);
walk_item_kind(&mut item.kind, item.span, item.id, self);
walk_item_kind(
&mut item.kind,
item.span,
item.id,
&mut item.ident,
&mut item.vis,
(),
self,
);
self.add_test_cases(item.id, span, prev_tests);
} else {
// But in those cases, we emit a lint to warn the user of these missing tests.