]> git.lizzy.rs Git - rust.git/commit
internal: remove accidental code re-use
authorAleksey Kladov <aleksey.kladov@gmail.com>
Sun, 5 Sep 2021 19:30:06 +0000 (22:30 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Sun, 5 Sep 2021 19:36:36 +0000 (22:36 +0300)
commitdbb702cfc1419850e7d208a1b375e4a69dbe8e87
treea9e4ab2b7f1271c2119a7028c6d893895870a0f0
parent847d0faf92707f84fa32560313e91f7ad8d40b94
internal: remove accidental code re-use

FragmentKind played two roles:

* entry point to the parser
* syntactic category of a macro call

These are different use-cases, and warrant different types. For example,
macro can't expand to visibility, but we have such fragment today.

This PR introduces `ExpandsTo` enum to separate this two use-cases.

I suspect we might further split `FragmentKind` into `$x:specifier` enum
specific to MBE, and a general parser entry point, but that's for
another PR!
18 files changed:
Cargo.lock
crates/hir_def/src/attr.rs
crates/hir_def/src/item_tree.rs
crates/hir_def/src/item_tree/lower.rs
crates/hir_def/src/item_tree/pretty.rs
crates/hir_def/src/lib.rs
crates/hir_def/src/nameres/collector.rs
crates/hir_expand/Cargo.toml
crates/hir_expand/src/builtin_derive.rs
crates/hir_expand/src/builtin_macro.rs
crates/hir_expand/src/db.rs
crates/hir_expand/src/eager.rs
crates/hir_expand/src/hygiene.rs
crates/hir_expand/src/lib.rs
crates/mbe/src/lib.rs
crates/mbe/src/syntax_bridge.rs
crates/mbe/src/tests.rs
crates/parser/src/lib.rs