diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-20 17:22:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-20 17:22:19 +0100 |
| commit | ec82174fad385882798b6c223dc1b8ac44f58332 (patch) | |
| tree | 0602c23ea16b14f9f76377c3506143575df88c3c /src/libsyntax/util/node_count.rs | |
| parent | ba1a4882514c3262caff38deabc30b669c709b95 (diff) | |
| parent | 054458b48db87ce767d7cc3d2dd86846ada3e3da (diff) | |
| download | rust-ec82174fad385882798b6c223dc1b8ac44f58332.tar.gz rust-ec82174fad385882798b6c223dc1b8ac44f58332.zip | |
Rollup merge of #67131 - Centril:item-merge, r=petrochenkov
Merge `TraitItem` & `ImplItem into `AssocItem`
In this PR we:
- Merge `{Trait,Impl}Item{Kind?}` into `AssocItem{Kind?}` as discussed in https://github.com/rust-lang/rust/issues/65041#issuecomment-538105286.
- This is done by using the cover grammar of both forms.
- In particular, it requires that we syntactically allow (under `#[cfg(FALSE)]`):
- `default`ness on `trait` items,
- `impl` items without a body / definition (`const`, `type`, and `fn`),
- and associated `type`s in `impl`s with bounds, e.g., `type Foo: Ord;`.
- The syntactic restrictions are replaced by semantic ones in `ast_validation`.
- Move syntactic restrictions around C-variadic parameters from the parser into `ast_validation`:
- `fn`s in all contexts now syntactically allow `...`,
- `...` can occur anywhere in the list syntactically (`fn foo(..., x: usize) {}`),
- and `...` can be the sole parameter (`fn foo(...) {}`.
r? @petrochenkov
Diffstat (limited to 'src/libsyntax/util/node_count.rs')
| -rw-r--r-- | src/libsyntax/util/node_count.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/libsyntax/util/node_count.rs b/src/libsyntax/util/node_count.rs index a64fec70961..3db9955d304 100644 --- a/src/libsyntax/util/node_count.rs +++ b/src/libsyntax/util/node_count.rs @@ -73,13 +73,9 @@ impl<'ast> Visitor<'ast> for NodeCounter { self.count += 1; walk_fn(self, fk, fd, s) } - fn visit_trait_item(&mut self, ti: &TraitItem) { + fn visit_assoc_item(&mut self, ti: &AssocItem) { self.count += 1; - walk_trait_item(self, ti) - } - fn visit_impl_item(&mut self, ii: &ImplItem) { - self.count += 1; - walk_impl_item(self, ii) + walk_assoc_item(self, ti) } fn visit_trait_ref(&mut self, t: &TraitRef) { self.count += 1; |
