-
Notifications
You must be signed in to change notification settings - Fork 545
rustc: rename ty::maps to ty::query. #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ get to use the nice method-call-style syntax. Instead, you invoke | |
using the `try_get` method, which looks roughly like this: | ||
|
||
```rust,ignore | ||
use ty::maps::queries; | ||
use ty::queries; | ||
... | ||
match queries::type_of::try_get(tcx, DUMMY_SP, self.did) { | ||
Ok(result) => { | ||
|
@@ -215,14 +215,14 @@ Well, defining a query takes place in two steps: | |
|
||
To specify the query name and arguments, you simply add an entry to | ||
the big macro invocation in | ||
[`src/librustc/ty/maps/mod.rs`][maps-mod]. This will probably have | ||
[`src/librustc/ty/query/mod.rs`][query-mod]. This will probably have | ||
changed by the time you read this README, but at present it looks | ||
something like: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please remove the last sentence (even though you didn't add it)? |
||
|
||
[maps-mod]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/maps/index.html | ||
[query-mod]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/query/index.html | ||
|
||
```rust,ignore | ||
define_maps! { <'tcx> | ||
define_queries! { <'tcx> | ||
/// Records the type of every item. | ||
[] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>, | ||
|
||
|
@@ -250,7 +250,7 @@ Let's go over them one by one: | |
processed. | ||
- **Name of query:** the name of the query method | ||
(`tcx.type_of(..)`). Also used as the name of a struct | ||
(`ty::maps::queries::type_of`) that will be generated to represent | ||
(`ty::queries::type_of`) that will be generated to represent | ||
this query. | ||
- **Dep-node constructor:** indicates the constructor function that | ||
connects this query to incremental compilation. Typically, this is a | ||
|
@@ -262,7 +262,7 @@ Let's go over them one by one: | |
bottom of the file. This is typically used when the query key is | ||
not a def-id, or just not the type that the dep-node expects. | ||
- **Query key type:** the type of the argument to this query. | ||
This type must implement the `ty::maps::keys::Key` trait, which | ||
This type must implement the `ty::query::keys::Key` trait, which | ||
defines (for example) how to map it to a crate, and so forth. | ||
- **Result type of query:** the type produced by this query. This type | ||
should (a) not use `RefCell` or other interior mutability and (b) be | ||
|
@@ -277,14 +277,14 @@ Let's go over them one by one: | |
|
||
So, to add a query: | ||
|
||
- Add an entry to `define_maps!` using the format above. | ||
- Add an entry to `define_queries!` using the format above. | ||
- Possibly add a corresponding entry to the dep-node macro. | ||
- Link the provider by modifying the appropriate `provide` method; | ||
or add a new one if needed and ensure that `rustc_driver` is invoking it. | ||
|
||
#### Query structs and descriptions | ||
|
||
For each kind, the `define_maps` macro will generate a "query struct" | ||
For each kind, the `define_queries` macro will generate a "query struct" | ||
named after the query. This struct is a kind of a place-holder | ||
describing the query. Each such struct implements the | ||
`self::config::QueryConfig` trait, which has associated types for the | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually could you change this to a link to the queries/incr comp chapter?