rust-lang / rust-lang/rust-bindgen

Include template arguments in instantiations' names (support marking "nested" instantiations as opaque)

Open
#774 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug enhancement I-cleanup
Dominant language
Rust
Stars
5.3k
Forks
829
Avg merge
1d 1h
Merged PRs (30d)
15

Description

Follow up to #773

To fully support template instantiations, and particularly template instantiations where a template argument is another template instantiation, with our various flags that depend on names (eg marking things opaque) we need to stop making template instantiations just use their template definition's name and start appending their template arguments.

The catch is that there are a bunch of places that assume that the names we return are valid rust identifiers and don't have characters like < in them. I kind of feel like we want multiple name-getting traits and/or multiple different name-getting methods on the ItemCanonicalName trait. Or maybe even extending the ItemCanonicalPath to return a tree rather than a vec so we can properly represent paths with instantiations and have each instantiation argument also be a path...

Anyways, after #773, we can make certain instantiations opaque, like Rooted<SavedFrameCache>, but not any "nested" instantiations, like Rooted<Cache<SavedFrame>>. Supporting the latter requires figuring out this naming mess.

Contributor guide

Open the contributing guide

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.

Research direction

Start with issue #773, then inspect the ItemCanonicalName trait and ItemCanonicalPath references mentioned here. Determine how nested template instantiations should represent their arguments without breaking callers that require Rust identifiers. Done means nested names such as Rooted<Cache> are represented and can be marked opaque.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.