rust-lang / rust-lang/rustc_public
Clarify and rename `CrateItem`
@ouz-a is already working on this.
Since Sep 5, 2023.
- Dominant language
- Rust
- Stars
- 125
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
I was trying to write a test that would traverse the body of every function in a crate, but I couldn't do that by only using StableMIR APIs.
Not every CrateItem is a function, and there is no method to retrieve information about the type of CrateItem, so users can't tell whether it's valid to retrieve the item body. If a user tries to get the body of a non-function, StableMIR crashes. Note that just knowing that an item is a function will likely not be enough, since there are cases where the function body might not be available.
Besides providing more information about a CrateItem, we could also change the body of CrateItem::body to return Result<> instead.
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.
Assessment
This issue has not been assessed yet.