aboutsummaryrefslogtreecommitdiff
path: root/crates/hir/src/semantics/source_to_def.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-02-14 16:17:03 +0000
committerGitHub <[email protected]>2021-02-14 16:17:03 +0000
commita0322defc375d7fd3890225768a85a31f2bdb0be (patch)
treee09243414c566cde0ecdb500e7441bf21ead1d0e /crates/hir/src/semantics/source_to_def.rs
parentd50a37d3aa473937919030b39587df3d93f9bd8c (diff)
parent8ac6041bcf7c970104939bdbdda5af4873ebd472 (diff)
Merge #7656
7656: Implement constructor usage search for almost all items r=matklad a=Veykril This PR moves the filering for enum constructors to the HIR, with this unprefixed variants as well as when the enum has been renamed via use will then still show up properly. We now walk the ast of the `NameRef` up until we find a `PathExpr`(which also handles `CallExpr` for tuple-type structs and variants already) or a `RecordExpr`. For enum search we then take the `path` out of that expression and do a resolution on it to compare it with the definition enum. With this PR we now support searching for all constructor literals, Unit-, Tuple- and Record-Structs, Unit-, Tuple- and Record-Variants as well as Unions. There is one shortcoming due to how the search is triggered. Unit Variants constructors can't be searched as we have no position for it to kick off the search(since a comma doesn't have to exist for the last variant). Closes #2549 though it doesn't implement it as outlined in the issue since the reference kind was removed recently, though I believe the approach taken here is better personally. Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir/src/semantics/source_to_def.rs')
0 files changed, 0 insertions, 0 deletions