Some more refactorings towards removing driver queries#132410
Merged
bors merged 7 commits intorust-lang:masterfrom Nov 28, 2024
Merged
Some more refactorings towards removing driver queries#132410bors merged 7 commits intorust-lang:masterfrom
bors merged 7 commits intorust-lang:masterfrom
Conversation
Collaborator
Collaborator
|
The Miri subtree was changed cc @rust-lang/miri |
Member
|
Probably compat relnotes for custom drivers? |
b17abaa to
aaf0567
Compare
Member
Author
Custom drivers are unstable and by the time we get release notes all custom drivers that are still maintained will have updated already for at least a month. If you are writing a custom driver you have to be looking for PR's when something breaks anyway. |
This comment has been minimized.
This comment has been minimized.
aaf0567 to
86b0254
Compare
This comment has been minimized.
This comment has been minimized.
86b0254 to
c2423f3
Compare
This comment has been minimized.
This comment has been minimized.
c2423f3 to
7e7a344
Compare
This comment has been minimized.
This comment has been minimized.
7e7a344 to
a30d62f
Compare
This comment has been minimized.
This comment has been minimized.
5bc8708 to
dd67650
Compare
This allows simplifying the call site and make_input by using a single match instead of two levels of if's.
This allows re-entrant entering of the GlobalCtxt
We now only exit the GlobalCtxt when calling a callback and all the way at the end when the GlobalCtxt is about to be destroyed.
dd67650 to
74fdbb7
Compare
74fdbb7 to
159ba4c
Compare
Closed
Member
Author
|
@bors r=cjgillot |
Collaborator
joboet
added a commit
to joboet/rust
that referenced
this pull request
Nov 27, 2024
…_round, r=cjgillot Some more refactorings towards removing driver queries Follow up to rust-lang#127184 ## Custom driver breaking change The `after_analysis` callback is changed to accept `TyCtxt` instead of `Queries`. The only safe query in `Queries` to call at this point is `global_ctxt()` which allows you to enter the `TyCtxt` either way. To fix your custom driver, replace the `queries: &'tcx Queries<'tcx>` argument with `tcx: TyCtxt<'tcx>` and remove your `queries.global_ctxt().unwrap().enter(|tcx| { ... })` call and only keep the contents of the closure. ## Custom driver deprecation The `after_crate_root_parsing` callback is now deprecated. Several custom drivers are incorrectly calling `queries.global_ctxt()` from inside of it, which causes some driver code to be skipped. As such I would like to either remove it in the future or if custom drivers still need it, change it to accept an `&rustc_ast::Crate` instead.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Nov 27, 2024
Rollup of 6 pull requests Successful merges: - rust-lang#116161 (Stabilize `extended_varargs_abi_support`) - rust-lang#132410 (Some more refactorings towards removing driver queries) - rust-lang#133418 (coverage: Store coverage source regions as `Span` until codegen) - rust-lang#133498 (Add missing code examples on `LocalKey`) - rust-lang#133518 (Structurally resolve before checking `!` in HIR typeck) - rust-lang#133521 (Structurally resolve before matching on type of projection) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Nov 28, 2024
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#132410 (Some more refactorings towards removing driver queries) - rust-lang#133418 (coverage: Store coverage source regions as `Span` until codegen) - rust-lang#133498 (Add missing code examples on `LocalKey`) - rust-lang#133518 (Structurally resolve before checking `!` in HIR typeck) - rust-lang#133521 (Structurally resolve before matching on type of projection) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Nov 28, 2024
Rollup merge of rust-lang#132410 - bjorn3:yet_another_driver_refactor_round, r=cjgillot Some more refactorings towards removing driver queries Follow up to rust-lang#127184 ## Custom driver breaking change The `after_analysis` callback is changed to accept `TyCtxt` instead of `Queries`. The only safe query in `Queries` to call at this point is `global_ctxt()` which allows you to enter the `TyCtxt` either way. To fix your custom driver, replace the `queries: &'tcx Queries<'tcx>` argument with `tcx: TyCtxt<'tcx>` and remove your `queries.global_ctxt().unwrap().enter(|tcx| { ... })` call and only keep the contents of the closure. ## Custom driver deprecation The `after_crate_root_parsing` callback is now deprecated. Several custom drivers are incorrectly calling `queries.global_ctxt()` from inside of it, which causes some driver code to be skipped. As such I would like to either remove it in the future or if custom drivers still need it, change it to accept an `&rustc_ast::Crate` instead.
Merged
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Dec 9, 2024
A bunch of cleanups These are all extracted from a branch I have to get rid of driver queries. Most of the commits are not directly necessary for this, but were found in the process of implementing the removal of driver queries. Previous PR: rust-lang#132410
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 9, 2024
Rollup merge of rust-lang#133567 - bjorn3:various_cleanups, r=cjgillot A bunch of cleanups These are all extracted from a branch I have to get rid of driver queries. Most of the commits are not directly necessary for this, but were found in the process of implementing the removal of driver queries. Previous PR: rust-lang#132410
RalfJung
pushed a commit
to RalfJung/miri
that referenced
this pull request
Dec 9, 2024
A bunch of cleanups These are all extracted from a branch I have to get rid of driver queries. Most of the commits are not directly necessary for this, but were found in the process of implementing the removal of driver queries. Previous PR: rust-lang/rust#132410
github-merge-queue bot
pushed a commit
to model-checking/kani
that referenced
this pull request
Dec 9, 2024
Upgrade toolchain to 12/09. Culprit PRs: - rust-lang/rust#132410 - rust-lang/rust#133746 - Unnecessary `map_or` [clippy lint](https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or) As with previous toolchain upgrades, it's unclear why the LLBC tests regressed. Resolves #3754 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
bjorn3
pushed a commit
to rust-lang/rustc_codegen_cranelift
that referenced
this pull request
Dec 11, 2024
A bunch of cleanups These are all extracted from a branch I have to get rid of driver queries. Most of the commits are not directly necessary for this, but were found in the process of implementing the removal of driver queries. Previous PR: rust-lang/rust#132410
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Dec 13, 2024
…l, 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.
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.
christian-schilling
pushed a commit
to christian-schilling/rustc_codegen_cranelift
that referenced
this pull request
Jan 27, 2026
A bunch of cleanups These are all extracted from a branch I have to get rid of driver queries. Most of the commits are not directly necessary for this, but were found in the process of implementing the removal of driver queries. Previous PR: rust-lang/rust#132410
christian-schilling
pushed a commit
to christian-schilling/rustc_codegen_cranelift
that referenced
this pull request
Jan 27, 2026
A bunch of cleanups These are all extracted from a branch I have to get rid of driver queries. Most of the commits are not directly necessary for this, but were found in the process of implementing the removal of driver queries. Previous PR: rust-lang/rust#132410
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #127184
Custom driver breaking change
The
after_analysiscallback is changed to acceptTyCtxtinstead ofQueries. The only safe query inQueriesto call at this point isglobal_ctxt()which allows you to enter theTyCtxteither way. To fix your custom driver, replace thequeries: &'tcx Queries<'tcx>argument withtcx: TyCtxt<'tcx>and remove yourqueries.global_ctxt().unwrap().enter(|tcx| { ... })call and only keep the contents of the closure.Custom driver deprecation
The
after_crate_root_parsingcallback is now deprecated. Several custom drivers are incorrectly callingqueries.global_ctxt()from inside of it, which causes some driver code to be skipped. As such I would like to either remove it in the future or if custom drivers still need it, change it to accept an&rustc_ast::Crateinstead.