rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Add more methods for resolving definitions from AST to their corresponding HIR types

Open regexident opened this issue 1 year ago • 3 comments

In order to be able to add these methods with consistent naming I had to also rename two existing methods that would otherwise be conflicting/confusing:

Semantics::to_module_def(&self, file: FileId) -> Option<Module> (before) Semantics::file_to_module_def(&self, file: FileId) -> Option<Module> (after)

Semantics::to_module_defs(&self, file: FileId) -> impl Iterator<Item = Module> (before) Semantics::file_to_module_defs(&self, file: FileId) -> impl Iterator<Item = Module> (after)

(the PR is motivated by an outside use of the ra_ap_hir crate that would benefit from being able to walk a hir::Function's AST, resolving its exprs/stmts/items to their HIR equivalents)

regexident avatar Feb 28 '24 09:02 regexident

@bors r+

Veykril avatar Feb 28 '24 09:02 Veykril

@bors r+

Veykril avatar Feb 29 '24 13:02 Veykril

@bors r+

Veykril avatar Mar 01 '24 18:03 Veykril

@bors r+

Veykril avatar Mar 04 '24 08:03 Veykril

Bots having a moment? 😅

regexident avatar Mar 04 '24 08:03 regexident

bors is always having a moment

Veykril avatar Mar 04 '24 08:03 Veykril

@bors r+

Veykril avatar Mar 04 '24 08:03 Veykril

:pushpin: Commit fac8a14de874d36aed74e3e29022342f77b0c01d has been approved by Veykril

It is now in the queue for this repository.

bors avatar Mar 04 '24 08:03 bors

:hourglass: Testing commit fac8a14de874d36aed74e3e29022342f77b0c01d with merge d8feb908beb9585645891bf06233d15ec4857cc1...

bors avatar Mar 04 '24 09:03 bors

:sunny: Test successful - checks-actions Approved by: Veykril Pushing d8feb908beb9585645891bf06233d15ec4857cc1 to master...

bors avatar Mar 04 '24 09:03 bors