-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Stop using driver queries in the public API #134130
Merged
Merged
+32
−34
Conversation
This file contains 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
bjorn3
added
the
A-driver
Area: rustc_driver that ties everything together into the `rustc` compiler
label
Dec 10, 2024
r? @Nadrieril rustbot has assigned @Nadrieril. Use |
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Dec 10, 2024
This comment has been minimized.
This comment has been minimized.
jieyouxu
added
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Dec 10, 2024
bjorn3
force-pushed
the
prepare_driver_query_removal
branch
from
December 12, 2024 11:15
a5914c8
to
7e37943
Compare
@rustbot ready |
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
and removed
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
labels
Dec 12, 2024
oli-obk
approved these changes
Dec 12, 2024
r? @oli-obk |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Dec 12, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 13, 2024
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#133900 (Advent of `tests/ui` (misc cleanups and improvements) [1/N]) - rust-lang#133937 (Keep track of parse errors in `mod`s and don't emit resolve errors for paths involving them) - rust-lang#133938 (`rustc_mir_dataflow` cleanups, including some renamings) - rust-lang#134058 (interpret: reduce usage of TypingEnv::fully_monomorphized) - rust-lang#134130 (Stop using driver queries in the public API) - rust-lang#134140 (Add AST support for unsafe binders) - rust-lang#134229 (Fix typos in docs on provenance) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 13, 2024
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#133900 (Advent of `tests/ui` (misc cleanups and improvements) [1/N]) - rust-lang#133937 (Keep track of parse errors in `mod`s and don't emit resolve errors for paths involving them) - rust-lang#133938 (`rustc_mir_dataflow` cleanups, including some renamings) - rust-lang#134058 (interpret: reduce usage of TypingEnv::fully_monomorphized) - rust-lang#134130 (Stop using driver queries in the public API) - rust-lang#134140 (Add AST support for unsafe binders) - rust-lang#134229 (Fix typos in docs on provenance) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 14, 2024
Rollup merge of rust-lang#134130 - bjorn3:prepare_driver_query_removal, r=oli-obk Stop using driver queries in the public API Follow up to rust-lang#132410 and rust-lang#133567 The next PR will completely get rid of driver queries. That PR will also contains some non-trivial refactorings enabled by no longer needing to support entering TyCtxt multiple times after it is constructed. The changes in the current PR have been split out to make it easier to review the api changes and to reduce the size of the next PR to review. ## Custom driver breaking change The `after_crate_root_parsing` and `after_expansion` callbacks now accept `ast::Crate` and `TyCtxt` respectively rather than `Queries`. The only safe query in `Queries` to call inside these callbacks are `parse()` and `global_ctxt()` respectively which allows you to access the `ast::Crate` and `TyCtxt` either way. To fix your custom driver, replace the `queries: &'tcx Queries<'tcx>` argument with `crate_: ast::Crate` and `tcx: TyCtxt<'tcx>` respectively and for `after_expansion` remove your `queries.global_ctxt().unwrap().enter(|tcx| { ... })` call and only keep the contents of the closure.
flip1995
pushed a commit
to flip1995/rust
that referenced
this pull request
Dec 15, 2024
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#133900 (Advent of `tests/ui` (misc cleanups and improvements) [1/N]) - rust-lang#133937 (Keep track of parse errors in `mod`s and don't emit resolve errors for paths involving them) - rust-lang#133938 (`rustc_mir_dataflow` cleanups, including some renamings) - rust-lang#134058 (interpret: reduce usage of TypingEnv::fully_monomorphized) - rust-lang#134130 (Stop using driver queries in the public API) - rust-lang#134140 (Add AST support for unsafe binders) - rust-lang#134229 (Fix typos in docs on provenance) r? `@ghost` `@rustbot` modify labels: rollup
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-driver
Area: rustc_driver that ties everything together into the `rustc` compiler
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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.
Follow up to #132410 and #133567
The next PR will completely get rid of driver queries. That PR will also contains some non-trivial refactorings enabled by no longer needing to support entering TyCtxt multiple times after it is constructed. The changes in the current PR have been split out to make it easier to review the api changes and to reduce the size of the next PR to review.
Custom driver breaking change
The
after_crate_root_parsing
andafter_expansion
callbacks now acceptast::Crate
andTyCtxt
respectively rather thanQueries
. The only safe query inQueries
to call inside these callbacks areparse()
andglobal_ctxt()
respectively which allows you to access theast::Crate
andTyCtxt
either way. To fix your custom driver, replace thequeries: &'tcx Queries<'tcx>
argument withcrate_: ast::Crate
andtcx: TyCtxt<'tcx>
respectively and forafter_expansion
remove yourqueries.global_ctxt().unwrap().enter(|tcx| { ... })
call and only keep the contents of the closure.