From: bors Date: Mon, 24 Feb 2020 00:31:01 +0000 (+0000) Subject: Auto merge of #69366 - Centril:unified-items, r=petrochenkov X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=79cd224e758f603898b64308e849fbb9be6e6f4d;p=rust.git 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`. 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 --- 79cd224e758f603898b64308e849fbb9be6e6f4d