diff options
| author | bors <bors@rust-lang.org> | 2020-02-24 00:31:01 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-02-24 00:31:01 +0000 |
| commit | 79cd224e758f603898b64308e849fbb9be6e6f4d (patch) | |
| tree | 6baaaa0f7f57a4b5b20013878c06e9087b4ee58c /src/libsyntax/attr | |
| parent | 6d0e58bff88f620c1a4f641a627f046bf4cde4ad (diff) | |
| parent | 1c75f5aaa177734c8dbdab91612a8d59b519bf07 (diff) | |
Auto merge of #69366 - Centril:unified-items, r=petrochenkov
parse: unify item parsing & filter illegal item kinds This PR fully unifies item parsing into a single `fn parse_item_common` method which produces `Option<Item>`. The `Item` is then mapped into `ForeignItem` and `AssocItem` as necessary by transforming the `*Kind` and converting contextually bad variants into `None`, thereby filtering them away. The PR does not yet unmerge the definition of `ForeignItemKind` from `AssocItemKind`. I've left that as future work as it didn't feel like this parser-focused PR would be the best one to deal with it. Changes to the AST data structures are instead kept to a reasonable minimum. Based on https://github.com/rust-lang/rust/pull/69361. Fixes https://github.com/rust-lang/rust/issues/48137. RELNOTES: Now, `item` macro fragments can be interpolated into `impl`, `trait`, and `extern` contexts. See `src/test/ui/parser/issue-48137-macros-cannot-interpolate-impl-items.rs` for the relevant test. r? @petrochenkov cc @estebank
Diffstat (limited to 'src/libsyntax/attr')
| -rw-r--r-- | src/libsyntax/attr/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index 313f5269235..cd485e71378 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -722,6 +722,6 @@ macro_rules! derive_has_attrs { } derive_has_attrs! { - Item, Expr, Local, ast::ForeignItem, ast::StructField, ast::AssocItem, ast::Arm, + Item, Expr, Local, ast::ForeignItem, ast::StructField, ast::Arm, ast::Field, ast::FieldPat, ast::Variant, ast::Param, GenericParam } |
