Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Instructions for adding a new query #1299

Open
Labels
A-incr-compArea: incremental compilation A-query-systemArea: query system E-hardDifficulty: might require advanced knowledge I-terseIssue: info is very terse T-compilerRelevant to compiler team
@pierwill

Description

Summary of issue

We have a good start on documenting adding a new query: https://rustc-dev-guide.rust-lang.org/query.html#adding-a-new-kind-of-query. However, I think there's room for greater clarity.

☞ After reading this section, I know where to define a query. I want to know where and how to implement one.

Details

Currently, this section of the guide has two summaries of the process:

So suppose you want to add a new kind of query, how do you do so? Well, defining a query takes place in two steps:

  1. first, you have to specify the query name and arguments; and then,
  2. you have to supply query providers where needed.

and

So, to add a query:

  1. Add an entry to rustc_queries! using the format above.
  2. Link the provider by modifying the appropriate provide method; or add a new one if needed and ensure that rustc_driver is invoking it.

Where are these providers?
How do I find "the appropriate provide method" for a new query? Do I always need to create a new one for a new query? Or can I sometimes reuse ("modify") an existing one?

The section immediately before this one gives information on Providers, but does not say how to add a new one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-incr-compArea: incremental compilation A-query-systemArea: query system E-hardDifficulty: might require advanced knowledge I-terseIssue: info is very terse T-compilerRelevant to compiler team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /