rust-lang / rust-lang/rustc_public
Add an API to resolve the name of a function
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
It would be really nice to be able to get the definition of a function by its name. In some cases, users may query a tool to perform analysis starting from a specific function. In other cases, tools may want to provide further instrumentation or manipulation such as adding extra assertions, or stubbing a method.
Ideally, the API should be something like:
/// Resolve the name of a function starting from the context of a definition.
fn resolve_function<T: CrateDef>(path: &str, context: T) -> Result<FnDef, Error> { /* */ }
See this discussion here where multiple tool developers describe their current solution:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin with the proposed resolve_function signature and read the linked Zulip discussion, where tool developers describe their current solutions. Done would mean an API can resolve a function name from a definition context and return either an FnDef or an Error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100