rust-lang / rust-lang/rustc_public

Clarify and rename `CrateItem`

Open
#34 14 comments 1 reaction 1 assignee View on GitHub

@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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.